sgibb / MALDIquant

Quantitative Analysis of Mass Spectrometry Data
https://strimmerlab.github.io/software/maldiquant/
60 stars 25 forks source link

filterPeaks: minNumber must not be higher than the maximal number of MassPeaks objects #26

Closed sgibb closed 11 years ago

sgibb commented 11 years ago

minNumber should be reduced to the maximal number of MassPeaks objects in the current label otherwise all peaks will removed:

library("MALDIquant")

p <- c(createMassPeaks(1:3, 1:3),
       createMassPeaks(1:2, 1:2),
       createMassPeaks(1, 1))

filterPeaks(p, minNumber=2, labels=c(1, 2, 2))

# [[1]]
# S4 class type            : MassPeaks
# Number of m/z values     : 0        
# Range of m/z values      : NA       
# Range of intensity values: NA       
# Range of snr values      : NA       
# Memory usage             : 1.234 KiB
# 
# [[2]]
# S4 class type            : MassPeaks
# Number of m/z values     : 1        
# Range of m/z values      : 1 - 1    
# Range of intensity values: 1 - 1    
# Range of snr values      : NA - NA  
# Memory usage             : 1.258 KiB
# 
# [[3]]
# S4 class type            : MassPeaks    
# Number of m/z values     : 1            
# Range of m/z values      : 1 - 1        
# Range of intensity values: 1e+00 - 1e+00
# Range of snr values      : NA - NA      
# Memory usage             : 1.258 KiB 

expected output:

# warning: reduce minNumber for label "1" because minNumber > n doesn't make sense!

# [[1]]
# S4 class type            : MassPeaks
# Number of m/z values     : 3        
# Range of m/z values      : 1 - 3    
# Range of intensity values: 1 - 3    
# Range of snr values      : NA - NA  
# Memory usage             : 1.281 KiB
sgibb commented 11 years ago

Introduced in #21.

sgibb commented 10 years ago

Since MALDIquant 1.8.16 minFrequency and minNumber could be vectors so this is not needed any more and we could use minFrequency > 1 and minNumber > n as feature to remove all peaks (or avoid the generation of a whitelist if mergeWhitelists=TRUE (MALDIquant 1.8.17))