Question: Extracting Sequences from DNAString
0
gravatar for eulerphi8
4.4 years ago by
eulerphi80
United States
eulerphi80 wrote:

Sorry for the stupid question but I'm stuck on a really stupid problem. I'm trying to output the results of some analysis and want a column of the DNA sequences stored in a DNAString. For example, the example below, I can use start(DNAString), end(DNAString), and width(DNAString) to extract the start, end, and width columns, but how do I extract the last column, which contains the actual DNA sequences? Again, sorry for the stupid question and thank you in advance for any help.

 

  Views on a 249250621-letter DNAString subject
subject: NNNNNNNNNNNNNNNNNNNNNNNNNNNNNN...NNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
views:
          start       end width
  [1]   1534983   1534990     8 [ACGTCGGG]
  [2]   2017082   2017089     8 [ACGTCGGG]
  [3]   2017138   2017145     8 [ACGTCGGG]
  [4]   2017194   2017201     8 [ACGTCGGG]
  [5]   2946138   2946145     8 [ACGTCGGG]
  ...       ...       ...   ... ...
[121] 245722047 245722054     8 [ACGTCGGG]
[122] 245752365 245752372     8 [ACGTCGGG]
[123] 246954563 246954570     8 [ACGTCGGG]
[124] 247282857 247282864     8 [ACGTCGGG]
[125] 249239868 249239875     8 [ACGTCGGG]

 

dnastring • 452 views
ADD COMMENTlink modified 4.4 years ago by James W. MacDonald51k • written 4.4 years ago by eulerphi80
Answer: Extracting Sequences from DNAString
2
gravatar for James W. MacDonald
4.4 years ago by
United States
James W. MacDonald51k wrote:

That's not a DNAStringSet. It's a Views() on a DNAStringSet. Regardless, you want as.character().

> d <- DNAString("TTGTCAATGTGC")
> dd2 <- Views(d, start = 3:1, end = 5:7)
> dd2
  Views on a 12-letter DNAString subject
subject: TTGTCAATGTGC
views:
    start end width
[1]     3   5     3 [GTC]
[2]     2   6     5 [TGTCA]
[3]     1   7     7 [TTGTCAA]
> as.character(dd2)
[1] "GTC"     "TGTCA"   "TTGTCAA"
> as.character(d)
[1] "TTGTCAATGTGC"

 

ADD COMMENTlink written 4.4 years ago by James W. MacDonald51k
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 16.09
Traffic: 325 users visited in the last hour