Adding names and other descriptors to DNAStrings
1
0
Entering edit mode
12 months ago
peter.durr • 0

Hi everyone

I am in the process of learning how to work in R with Biostrings

With DNAStringSets (and AAStringSets) it is possible to add descriptors to the sequence using the names function

Thus if you have the sequence AGTCACC, and make this a DNAStringSet you can add a description:

seq <- "AGTCACC"
seq_2 <- DNAStringSet(seq)
names(seq_2) <- "My example"
seq_2

However, if I try this with a DNAString, nothing gets stored

seq_3 <- DNAString(seq)
names(seq_3) <- "My example"
seq_3

Is there a clever way to add descriptors to a DNAString? Or do I need to work with DNAStringSets?

Thanks

Biostrings DNAString • 858 views
ADD COMMENT
2
Entering edit mode
12 months ago

You can add any information you want in the meta-data of the DNAString object.

Example data.

library("Biostrings")

dna_string <- DNAString("ATGCGGAT")

> dna_string
  8-letter "DNAString" instance
seq: ATGCGGAT

The metadata function is used to set and get the meta-data.

metadata(dna_string)$name <- "string1"

> metadata(dna_string)
$name
[1] "string1"
ADD COMMENT
0
Entering edit mode

A really clear and useful reply

Thanks

ADD REPLY

Login before adding your answer.

Traffic: 2470 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6