This method trims an AbstractMassObject object.
That is useful if some mass ranges should be excluded from further analysis.
Usage
## S4 method for signature 'AbstractMassObject,numeric'
trim(object, range)
## S4 method for signature 'list,numeric'
trim(object, range, ...)
## S4 method for signature 'list,missing'
trim(object, range, ...)
Arguments
object
AbstractMassObject object or a
list of AbstractMassObject objects.
range
numeric, limits of trimming (left/minimal mass,
right/maximal mass). If missing it is automatically determined (largest
overlapping mass range) for a list of
AbstractMassObject.
...
arguments to be passed to underlying functions (currently only
mc.cores is supported).
## load package
library("MALDIquant")
## load example data
data("fiedler2009subset", package="MALDIquant")
## select only one spectrum
s <- fiedler2009subset[[1]]
## remove all mass lower 3000
trim(s, range=c(3000, Inf))
## remove all mass higher 8000
trim(s, range=c(0, 8000))
## remove all mass lower 3000 and higher 8000
trim(s, range=c(3000, 8000))
## choose largest overlapping mass range for all spectra
trim(fiedler2009subset)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(MALDIquant)
This is MALDIquant version 1.15
Quantitative Analysis of Mass Spectrometry Data
See '?MALDIquant' for more information about this package.
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/MALDIquant/trim-methods.Rd_%03d_medium.png", width=480, height=480)
> ### Name: trim-methods
> ### Title: Trim an AbstractMassObject object.
> ### Aliases: trim trim,AbstractMassObject,numeric-method
> ### trim,list,numeric-method trim,list,missing-method
> ### Keywords: methods
>
> ### ** Examples
>
> ## load package
> library("MALDIquant")
>
> ## load example data
> data("fiedler2009subset", package="MALDIquant")
>
> ## select only one spectrum
> s <- fiedler2009subset[[1]]
>
> ## remove all mass lower 3000
> trim(s, range=c(3000, Inf))
S4 class type : MassSpectrum
Number of m/z values : 28032
Range of m/z values : 3000.146 - 9999.734
Range of intensity values: 5 - 27518
Memory usage : 337.133 KiB
Name : Pankreas_HB_L_061019_G10.M19
File : /data/set A - discovery leipzig/control/Pankreas_HB_L_061019_G10/0_m19/1/1SLin/fid
>
> ## remove all mass higher 8000
> trim(s, range=c(0, 8000))
S4 class type : MassSpectrum
Number of m/z values : 35846
Range of m/z values : 1000.015 - 7999.732
Range of intensity values: 124 - 101840
Memory usage : 428.703 KiB
Name : Pankreas_HB_L_061019_G10.M19
File : /data/set A - discovery leipzig/control/Pankreas_HB_L_061019_G10/0_m19/1/1SLin/fid
>
> ## remove all mass lower 3000 and higher 8000
> trim(s, range=c(3000, 8000))
S4 class type : MassSpectrum
Number of m/z values : 21490
Range of m/z values : 3000.146 - 7999.732
Range of intensity values: 124 - 27518
Memory usage : 260.469 KiB
Name : Pankreas_HB_L_061019_G10.M19
File : /data/set A - discovery leipzig/control/Pankreas_HB_L_061019_G10/0_m19/1/1SLin/fid
>
> ## choose largest overlapping mass range for all spectra
> trim(fiedler2009subset)
$sPankreas_HB_L_061019_G10.M19.T_0209513_0020740_18
S4 class type : MassSpectrum
Number of m/z values : 42388
Range of m/z values : 1000.015 - 9999.734
Range of intensity values: 5 - 101840
Memory usage : 505.367 KiB
Name : Pankreas_HB_L_061019_G10.M19
File : /data/set A - discovery leipzig/control/Pankreas_HB_L_061019_G10/0_m19/1/1SLin/fid
$sPankreas_HB_L_061019_G10.M20.T_0209513_0020740_18
S4 class type : MassSpectrum
Number of m/z values : 42388
Range of m/z values : 1000.015 - 9999.734
Range of intensity values: 6 - 111862
Memory usage : 505.367 KiB
Name : Pankreas_HB_L_061019_G10.M20
File : /data/set A - discovery leipzig/control/Pankreas_HB_L_061019_G10/0_m20/1/1SLin/fid
$sPankreas_HB_L_061019_H7.O14.T_0209513_0020740_18
S4 class type : MassSpectrum
Number of m/z values : 42388
Range of m/z values : 1000.015 - 9999.734
Range of intensity values: 10 - 92807
Memory usage : 505.367 KiB
Name : Pankreas_HB_L_061019_H7.O14
File : /data/set A - discovery leipzig/control/Pankreas_HB_L_061019_H7/0_o14/1/1SLin/fid
$sPankreas_HB_L_061019_H7.P13.T_0209513_0020740_18
S4 class type : MassSpectrum
Number of m/z values : 42388
Range of m/z values : 1000.015 - 9999.734
Range of intensity values: 3 - 94368
Memory usage : 505.367 KiB
Name : Pankreas_HB_L_061019_H7.P13
File : /data/set A - discovery leipzig/control/Pankreas_HB_L_061019_H7/0_p13/1/1SLin/fid
$sPankreas_HB_L_061019_F10.L19.T_0209513_0020740_18
S4 class type : MassSpectrum
Number of m/z values : 42388
Range of m/z values : 1000.015 - 9999.734
Range of intensity values: 21 - 100220
Memory usage : 505.367 KiB
Name : Pankreas_HB_L_061019_F10.L19
File : /data/set A - discovery leipzig/tumor/Pankreas_HB_L_061019_F10/0_l19/1/1SLin/fid
$sPankreas_HB_L_061019_F10.L20.T_0209513_0020740_18
S4 class type : MassSpectrum
Number of m/z values : 42388
Range of m/z values : 1000.015 - 9999.734
Range of intensity values: 8 - 87928
Memory usage : 505.367 KiB
Name : Pankreas_HB_L_061019_F10.L20
File : /data/set A - discovery leipzig/tumor/Pankreas_HB_L_061019_F10/0_l20/1/1SLin/fid
$sPankreas_HB_L_061019_F9.L17.T_0209513_0020740_18
S4 class type : MassSpectrum
Number of m/z values : 42388
Range of m/z values : 1000.015 - 9999.734
Range of intensity values: 28 - 99022
Memory usage : 505.367 KiB
Name : Pankreas_HB_L_061019_F9.L17
File : /data/set A - discovery leipzig/tumor/Pankreas_HB_L_061019_F9/0_l17/1/1SLin/fid
$sPankreas_HB_L_061019_F9.L18.T_0209513_0020740_18
S4 class type : MassSpectrum
Number of m/z values : 42388
Range of m/z values : 1000.015 - 9999.734
Range of intensity values: 32 - 110268
Memory usage : 505.367 KiB
Name : Pankreas_HB_L_061019_F9.L18
File : /data/set A - discovery leipzig/tumor/Pankreas_HB_L_061019_F9/0_l18/1/1SLin/fid
$sPankreas_HB_L_061019_A6.A11.T_0209513_0020740_18
S4 class type : MassSpectrum
Number of m/z values : 42388
Range of m/z values : 1000.015 - 9999.734
Range of intensity values: 23 - 61160
Memory usage : 505.375 KiB
Name : Pankreas_HB_L_061019_A6.A11
File : /data/set B - discovery heidelberg/control/Pankreas_HB_L_061019_A6/0_a11/1/1SLin/fid
$sPankreas_HB_L_061019_A6.A12.T_0209513_0020740_18
S4 class type : MassSpectrum
Number of m/z values : 42388
Range of m/z values : 1000.015 - 9999.734
Range of intensity values: 46 - 54383
Memory usage : 505.375 KiB
Name : Pankreas_HB_L_061019_A6.A12
File : /data/set B - discovery heidelberg/control/Pankreas_HB_L_061019_A6/0_a12/1/1SLin/fid
$sPankreas_HB_L_061019_A8.A15.T_0209513_0020740_18
S4 class type : MassSpectrum
Number of m/z values : 42388
Range of m/z values : 1000.015 - 9999.734
Range of intensity values: 36 - 84852
Memory usage : 505.375 KiB
Name : Pankreas_HB_L_061019_A8.A15
File : /data/set B - discovery heidelberg/control/Pankreas_HB_L_061019_A8/0_a15/1/1SLin/fid
$sPankreas_HB_L_061019_A8.A16.T_0209513_0020740_18
S4 class type : MassSpectrum
Number of m/z values : 42388
Range of m/z values : 1000.015 - 9999.734
Range of intensity values: 75 - 86455
Memory usage : 505.375 KiB
Name : Pankreas_HB_L_061019_A8.A16
File : /data/set B - discovery heidelberg/control/Pankreas_HB_L_061019_A8/0_a16/1/1SLin/fid
$sPankreas_HB_L_061019_C4.F7.T_0209513_0020740_18
S4 class type : MassSpectrum
Number of m/z values : 42388
Range of m/z values : 1000.015 - 9999.734
Range of intensity values: 15 - 23448
Memory usage : 505.375 KiB
Name : Pankreas_HB_L_061019_C4.F7
File : /data/set B - discovery heidelberg/tumor/Pankreas_HB_L_061019_C4/0_f7/1/1SLin/fid
$sPankreas_HB_L_061019_C4.F8.T_0209513_0020740_18
S4 class type : MassSpectrum
Number of m/z values : 42388
Range of m/z values : 1000.015 - 9999.734
Range of intensity values: 36 - 30171
Memory usage : 505.375 KiB
Name : Pankreas_HB_L_061019_C4.F8
File : /data/set B - discovery heidelberg/tumor/Pankreas_HB_L_061019_C4/0_f8/1/1SLin/fid
$sPankreas_HB_L_061019_D9.G17.T_0209513_0020740_18
S4 class type : MassSpectrum
Number of m/z values : 42388
Range of m/z values : 1000.015 - 9999.734
Range of intensity values: 8 - 32828
Memory usage : 505.375 KiB
Name : Pankreas_HB_L_061019_D9.G17
File : /data/set B - discovery heidelberg/tumor/Pankreas_HB_L_061019_D9/0_g17/1/1SLin/fid
$sPankreas_HB_L_061019_D9.G18.T_0209513_0020740_18
S4 class type : MassSpectrum
Number of m/z values : 42388
Range of m/z values : 1000.015 - 9999.734
Range of intensity values: 7 - 22786
Memory usage : 505.375 KiB
Name : Pankreas_HB_L_061019_D9.G18
File : /data/set B - discovery heidelberg/tumor/Pankreas_HB_L_061019_D9/0_g18/1/1SLin/fid
>
>
>
>
>
> dev.off()
null device
1
>