[R] SLLOOOWWW function ...

Bartjoosen bartjoosen at hotmail.com
Thu Jul 19 20:57:25 CEST 2007


Hi

If I'm right you are trying to find peaks with about the same mass as the
maximum intensity.
Why not make the difference between the maximum mass and the list of masses
subsetted by intensity.
then subset the difference with a thresholded value.


If I'm not understanding your question clear, please let me know what you
are trying to do.
I've written some scripts for MS spectra analyses, if you're interested,
I'll try to find them.


Good luck

Bart



Johannes Graumann-2 wrote:
> 
> Does anybody have any insight into how to make this faster?
> I suspect, that the rounding going on may be an issue, as is the stepping
> through data frame rows using integers ...
> 
> If you have the patience to teach a noob, he will highly appreciate it ;0)
> 
> Joh
> 
> digit <- 4
> for (minute in seq(from=25,to=lrange[2])){
>   # Extract all data associtaed with the current time (minute)
>   frame <- subset(mylist,mylist[["Time"]] == minute)
>   # Sort by Intensity
>   frame <- frame[order(frame[["Intensity"]],decreasing = TRUE),]
>   # Establish output frame using the most intense candidate
>   newframe <- frame[1,]
>   # Establish overlap-checking vector using the most intense candidate
>   lowppm <- round(newframe[1,][["Mass"]]-newframe[1,
> [["Mass"]]/1E6*ppmrange,digits=digit)
>   highppm <- round(newframe[1,][["Mass"]]+newframe[1,
> [["Mass"]]/1E6*ppmrange,digits=digit)
>   presence <- seq(from=lowppm,to=highppm,by=10^(-digit))
>   # Walk through the entire original frame and check whether peaks are
> overlap-free ... do so until max of 2000 entries
>   for (int in seq(from=2,to=nrow(frame))) {
>     if(nrow(newframe) < 2000) {
>       lowppm <- round(frame[int,][["Mass"]]-frame[int,
> [["Mass"]]/1E6*ppmrange,digits=digit)
>       highppm <- round(frame[int,][["Mass"]]+frame[int,
> [["Mass"]]/1E6*ppmrange,digits=digit)
>       windowrange <- seq(from=lowppm,to=highppm,by=10^(-digit))
>       if (sum(round(windowrange,digits=digit) %in%
> round(presence,digits=digit)) < 1) {
>         newframe <- rbind(newframe,frame[int,])
>         presence <- c(presence,windowrange)
>       }
>     } else {
>       break()
>     }
>   }
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 

-- 
View this message in context: http://www.nabble.com/SLLOOOWWW-function-...-tf4096328.html#a11695601
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list