Search
Question: Irange _ Start and End
0
gravatar for pgreenbank
9 weeks ago by
pgreenbank0
pgreenbank0 wrote:

library("Biostrings")

s1 <-
  DNAString("TGCTCTCGGGAGCCGCCTCCCGACACCCGAGCCCCGCCGGCGCCTCCCGCTCCCGGCTCCCGGCTCCTGGCTCCCTCCGCCTCCCCCGCCCCTCGCCCCGCCGCCGAAGAGGCCCCGCTCCCGGGTCGGACGCCTGGGTCTGCCGGGAAGAGCGATGAGAGGTGTCTGAAGGTGGCTATTCACTGAGCGATGGGGTTGGACTTGAAGGAATGCCAAGAGATGCTGCCCCCACCCCCTTAGGCCCGAGGGATCAGGAGCTATGGGACCAGAGGCCCTGTCATCTTTACTGCTGCTGCTCTTGGTGGCAAGTGGAGATGCTGACATGAAGGGACATTTTGATCCTGCCAAGTGCCGCTATGCCCTGGGCATGCAGGACCGGACCATCCCAGACAGTGACATCTCTGCTTCCAGCTCCTGGTCAGATTCCACTGCCGCCCGCCACAGCAGGTTGGAGAGCAGTGACGGGGATGGGGCCTGGTGCCCCGCAGGGTCGGTGTTTCCCAAGGAGGAGGAGTACTTGCAGGTGGATCTACAACGACTGCACCTGGTGGCTCTGGTGGGCACCCAGGGACGGCATGCCGGGGGCCTGGGCAAGGAGTTCTCCCGGAGCTACCGGCTGCGTTACTCCCGGGATGGTCGCCGCTGGATGGGCTGGAAGGACCGCTGGGGTCAGGAGGTGATCTCAGGCAATGAGGACCCTGAGGGAGTGGTGCTGAAGGACCTTGGGCCCCCCATGGTTGCCCGACTGGTTCGCTTCTACCCCCGGGCTGACCGGGTCATGAGCGTCTGTCTGCGGGTAGAGCTCTATGGCTGCCTCTGGAGGGATGGACTCCTGTCTTACACCGCCCCTGTGGGGCAGACAATGTATTTATCTGAGGCCGTGTACCTCAACGACTCCACCTATGACGGACATACCGTGGGCGGACTGCAGTATGGGGGTCTGGGCCAGCTGGCAGATGGTGTGGTGGGGCTGGATGACTTTAGGAAGAGTCAGGAGCTGCGGGTCTGGCCAGGCTATGACTATGTG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GTGTGAGGTCGACAGCCCTCAAGATCTGGTTAGTCTTGATTTCCCCCTTAATGTGCGTAAGGGACACCCTTTGCTGGTAGCTGTCAAGATCTTACGGCCAGATGCCACCAAGAATGCCAGGAATGATTTCCTGAAAGAGGTGAAGATCATGTCGAGGCTCAAGGACCCAAACATCATTCGGCTGCTGGGCGTGTGTGTGCAGGACGACCCCCTCTGCATGATTACTGACTACATGGAGAACGGCGACCTCAACCAGTTCCTCAGTGCCCACCAGCTGGAGGACAAGGCAGCCGAGGGGGCCCCTGGGGACGGGCAGGCTGCGCAGGGGCCCACCATCAGCTACCCAATGCTGCTGCATGTGGCAGCCCAGATCGCCTCCGGCATGCGCTATCTGGCCACACTCAACTTTGTACATCGGGACCTGGCCACGCGGAACTGCCTAGTTGGGGAAAATTTCACCATCAAAATCGCAGACTTTGGCATGAGCCGGAACCTCTATGCTGGGGACTATTACCGTGTGCAGGGCCGGGCAGTGCTGCCCATCCGCTGGATGGCCTGGGAGTGCATCCTCATGGGGAAGTTCACGACTGCGAGTGACGTGTGGGCCTTTGGTGTGACCCTGTGGGAGGTGCTGATGCTCTGTAGGGCCCAGCCCTTTGGGCAGCTCACCGACGAGCAGGTCATCGAGAACGCGGGGGAGTTCTTCCGGGACCAGGGCCGGCAGGTGTACCTGTCCCGGCCGCCTGCCTGCCCGCAGGGCCTATATGAGCTGATGCTTCGGTGCTGGAGCCGGGAGTCTGAGCAGCGACCACCCTTTTCCCAGCTGCATCGGTTCCTGGCAGAGGATGCACTCAACACGGTGTGAATCACACATCCAGCTGCCCCTCCCTCAGGGAGCGATCCAGGGGAAGCCAGTGACACTAAAACAAGAGGACACAATGGCACCTCTGCCCTTCCCCTCCCGACAGCCCATCACCTCTAATAGAGGCAGTGAGACTGCAGGTGGGCTGGGCCCACCCAGGGAGCTGATGCCCCTTCTCCCCTTCCTGGACACACTCTCATGTCCCCTTCCTGTTCTTCCTTCCTAGAAGCCCCTGTCGCCCACCCAGCTGGTCCTGTGGATGGGATCCTCTCCACCCTCCTCTAGCCATCCCTTGGGGAAGGGTGGGGAGAAATATAGGATAGACACTGGACATGGCCCATTGGAGCACCTGGGCCCCACTGGACAACACTGATTCCTGGAGAGGTGGCTGCGCCCCCAGCTTCTCTCTCCCTGTCACACACTGGACCCCACTGGCTGAGAATCTGGGGGTGAGGAGGACAAGAAGGAGAGGAAAATGTTTCCTTGTGCCTGCTCCTGTACTTGTCCTCAGCTTGGGCTTCTTCCTCCTCCATCACCTGAAACACTGGACCTGGGGGTAGCCCCGCCCCAGCCCTCAGTCACCCCCACTTCCCACTTGCAGTCTTGTAGCTAGAACTTCTCTAAGCCTATACGTTTCTGTGGAGTAAATATTGGGATTGGGGGGAAAGAGGGAGCAACGGCCCATAGCCTTGGGGTTGGACATCTCTAGTGTAGCTGCCACATTGATTTTTCTATAATCACTTGGGGTTTGTACATTTTTGGGGGGAGAGACACAGATTTTTACACTAATATATGGACCTAGCTTGAGGCAATTTTAATCCCCTGCACTAGGCAGGTAATAATAAAGGTTGAGTTTTCCACAAAAAAAAAAAAAAAAAA")
s2 <-
  DNAString("GCCGCCGAAGAGGCCCCGCTCCCGGGTCGGACGCCTGGGTCTGCCGGGAAGAGCGATGAGAGAGATGCTGCCCCCACCCCCTTAGGCCCGAGGGATCAGGAGCTATGGGACCAGAGGCCCTGTCATCTTTACTGCTGCTGCTCTTGGTGGCAAGTGGAGATGCTGACATGAAGGGACATTTTGATCCTGCCAAGTGCCGCTATGCCCTGGGCATGCAGGACCGGACCATCCCAGACAGTGACATCTCTGCTTCCAGCTCCTGGTCAGATTCCACTGCCGCCCGCCACAGCAGGTTGGAGAGCAGTGACGGGGATGGGGCCTGGTGCCCCGCAGGGTCGGTGTTTCCCAAGGAGGAGGAGTACTTGCAGGTGGATCTACAACGACTGCACCTGGTGGCTCTGGTGGGCACCCAGGGACGGCATGCCGGGGGCCTGGGCAAGGAGTTCTCCCGGAGCTACCGGCTGCGTTACTCCCGGGATGGTCGCCGCTGGATGGGCTGGAAGGACCGCTGG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GGACTATATGGAGCCTGAGAAGCCAGGCGCCCCGCTTCTGCCCCCACCTCCCCAGAACAGCGTCCCCCATTATGCCGAGGCTGACATTGTTACCCTGCAGGGCGTCACCGGGGGCAACACCTATGCTGTGCCTGCACTGCCCCCAGGGGCAGTCGGGGATGGGCCCCCCAGAGTGGATTTCCCTCGATCTCGACTCCGCTTCAAGGAGAAGCTTGGCGAGGGCCAGTTTGGGGAGGTGCACCTGTGTGAGGTCGACAGCCCTCAAGATCTGGTCAGTCTTGATTTCCCCCTTAATGTGCGTAAGGGACACCCTTTGCTGGTAGCTGTCAAGATCTTACGGCCAGATGCCACCAAGAATGCCAGGAATGATTTCCTGAAAGAGGTGAAGATCATGTCGAGGCTCAAGGACCCAAACATCATTCGGCTGCTGGGCGTGTGTGTGCAGGACGACCCCCTCTGCATGATTACTGACTACATGGAGAACGGCGACCTCAACCAGTTCCTCAGTGCCCACCAGCTGGAGGACAAGGCAGCCGAGGGGGCCCCTGGGGACGGGCAGGCTGCGCAGGGGCCCACCATCAGCTACCAAATGCTGCTGCATGTGGCAGCCCAGATCGCCTCCGGCATGCGCTATCTGGCCACACTCAACTTTGTACATCGGGACCTGGCCACGCGGAACTGCCTAGTTGGGGAAAATTTCACCATCAAAATCGCAGACTTTGGCATGAGCCGGAACCTCTATGCTGGGGACTATTACCGTGTGCAGGGCCGGGCAGTGCTGCCCATCCGCTGGATGGCCTGGGAGTGCATCCTCATGGGGAAGTTCACGACTGCGAGTGACGTGTGGGCCTTTGGTGTGACCCTGTGGGAGGTGCTGATGCTCTGTAGGGCCCAGCCCTTTGGGCAGCTCACCGACGAGCAGGTCATCGAGAACGCGGGGGAGTTCTTCCGGGACCAGGGCCGGCAGGTGTACCTGTCCCGGCCGCCTGCCTGCCCGCAGGGCCTATATGAGCTGATGCTTCGGTGCTGGAGCCGGGAGTCTGAGCAGCGACCACCCTTTTCCCAGCTGCATCGGTTCCTGGCAGAGGATGCACTCAACACGGTGTGAATCACACATCCAGCTGCCCCTCCCTCAGGGAGCGATCCAGGGGAAGCCAGTGACACTAAAACAAGAGGACACAATGGCACCTCTGCCCTTCCCCTCCCGACAGCCCATCACCTCTAATAGAGGCAGTGAGACTGCAGGTGGGCTGGGCCCACCCAGGGAGCTGATGCCCCTTCTCCCCTTCCTGGACACACACTCATGTCCCCTTCCTGTTCTTCCTTCCTAGAAGCCCCTGTCGCCCACCCAGCTGGTCCTGTGGATGGGATCCTCTCCACCCTCCTCTAGCCATCCCTTGGGGAAGGGTGGGGAGAAATATAGGATAGACACTGGACATGGCCCATTGGAGCACCTGGGCCCCACTGGACAACACTGATTCCTGGAGAGGTGGCTGCGCCCCCAGCTTCTCTCTCCCTGTCACACACTGGACCCCACTGGCTGAGAATCTGGGGGTGAGGAGGACAAGAAGGAGAGGAAAATGTTTCCTTGTGCCTGCTCCTGTACTTGTCCTCAGCTTGGGCTTCTTCCTCCTCCATCACCTGAAACACTGGACCTGGGGGTAGCCCCGCCCCAGCCCTCAGTCACCCCCACTTCCCACTTGCAGTCTTGTAGCTAGAACTTCTCTAAGCCTATACGTTTCTGTGGAGTAAATATTGGGATTGGGGGGAAAGAGGGAGCAACGGCCCATAGCCTTGGGGTTGGACATCTCTAGTGTAGCTGCCACATTGATTTTTCTATAATCACTTGGGGTTTGTACATTTTTGGGGGGAGAGACACAGATTTTTACACTAATATATGGACCTAGCTTGAGGCAATTTTAATCCCCTGCACTAGGCAGGTAATAATAAAGGTTGAGTTTTCCACaaaaaaaaaaaaaaaa")
s1
s2

mat <- nucleotideSubstitutionMatrix(match = 2, mismatch = -3, baseOnly = FALSE)

psa2 <-
  pairwiseAlignment(pattern = s1,
                    subject = s2,
                    substitutionMatrix = mat,
                    type = "local",
                    gapOpening = 5, gapExtension = 2,
                    scoreOnly=FALSE)

 

x <- insertion(psa2)

 

gives 

 

IRangesList of length 1
[[1]]
IRanges object with 2 ranges and 0 metadata columns:
          start       end     width
      <integer> <integer> <integer>
  [1]        63       118        56
  [2]      1619      1729       111

 

I want a single string which looks like this  63-118, 1619-1729 or two strings which look like this 63,1619 & 118,1729.

i.e I just want all the start and ends in one variable.

Sorry but i'm not an R Programer or a Biologist so this is all a struggle to me.

ADD COMMENTlink modified 9 weeks ago by Michael Lawrence9.5k • written 9 weeks ago by pgreenbank0
0
gravatar for Michael Lawrence
9 weeks ago by
United States
Michael Lawrence9.5k wrote:
paste(as.character(x[[1]]), collapse=", ")
ADD COMMENTlink written 9 weeks ago by Michael Lawrence9.5k

Thanks Michael but that only works where there is one range otherwise I get this error message

Error in as.vector(x, mode) : 
  coercing an AtomicList object to an atomic vector is supported only for
  objects with top-level elements of length <= 1

ADD REPLYlink written 9 weeks ago by pgreenbank0

Are you using the latest version of Bioconductor (3.5)? Your installation may be too old.

ADD REPLYlink written 9 weeks ago by Michael Lawrence9.5k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 347 users visited in the last hour