SCM

Forum: help

Monitor Forum | Start New Thread Start New Thread
RE: How to extract the species vectors from the BOLD sequences? [ Reply ]
By: Samuel Brown on 2012-03-18 23:06
[forum:5591]
Hi Sergey

In addition to the method suggested by Rupert, you can use the attr(object, "species") function to retrieve the species vector:

nn <- search.BOLD("Dolomedes")
tt <- read.BOLD(nn)
str(tt) #Investigate the structure of the object
spp <- attr(tt, "species")
spp

RE: How to extract the species vectors from the BOLD sequences? [ Reply ]
By: Rupert Collins on 2012-03-18 22:31
[forum:5590]
Hi Sergey.

Thanks for posting. We've very recently updated the BOLD search function, and a new version on Spider (1.1-2) is up on CRAN. I recommend you install it, as the previous version no longer works.

#get newest Spider version
install.packages("spider")

Now, you can try this example to get the species vectors from BOLD data. You need to split the taxon labels at the pipe symbol.

#seach BOLD for genus "Dolomedes"
nn <- search.BOLD("Dolomedes")

#download DNA seqs from BOLD
tt <- read.BOLD(nn)

#split the taxon labels at the pipe
spp <- strsplit(names(tt), split="\\|")

#grab the second element as the species vector
spp <- sapply(spp, function(x) x[2])


Hope this helps.

Rupert

How to extract the species vectors from the BOLD sequences? [ Reply ]
By: Sergey Turanov on 2012-03-17 12:20
[forum:5588]
I still have not understood how to do it. Help, please.

Thanks to:
Vienna University of Economics and Business Powered By FusionForge