Displaying 2 results from an estimated 2 matches for "gcsequence".
Did you mean:
g_sequence
2009 May 21
1
Loop avoidance and logical subscripts
...I'm writing a script with a lot of loops and it executes really slowly over
huge amounts of data. I assume it's because I don't know how to avoid using
loops. Logical subscripts are more desirable, but I don't know how to
implement them. One example of that issue:
library(seqinr)
GCsequence <- vector()
for( i in 1:(length(data$sequence))) {
c(GCsequence,GC(s2c(data$sequence[i])))->data$GCsequence[i]
}
rm(GCsequence)
How should I speed up that?
Thank you,
Retama
--
View this message in context: http://www.nabble.com/Loop-avoidance-and-logical-subscripts-tp23652935p2365...
2009 Jun 01
1
installing sn package
...ripts
To: r-help@r-project.org
Message-ID: <23745814.post@talk.nabble.com>
Content-Type: text/plain; charset=us-ascii
Thank you! The script is now adapted to Biostrings and it is really fast! For
example, it does:
alph_sequence <- alphabetFrequency(data$sequence, baseOnly=TRUE)
data$GCsequence <- rowSums(alph_sequence[,c("G", "C")]) /
rowSums(alph_sequence)
in the G+C computation. It also works amazingly fast in substring extraction
(substring), reverse complement (reverseComplement sequences), palindromes
search (findComplementedPalindromes) and so on.
Now, my b...