Function to trim spectra in mzML or mzXML files
Source:R/fct_ms_convert_trim_files.R
trim_ms_files_spectra.Rd
Trim spectra in mzML or mzXML files based on time (in seconds) and m/z (in Da) ranges, using the mzR package.
Usage
trim_ms_files_spectra(
files,
MS1 = TRUE,
MS2 = TRUE,
rtWindow = NULL,
mzWindow = NULL,
mzWindow_ms2 = NULL,
intensityThreshold = NULL,
copyMetadata = TRUE,
path = NULL,
prefix = "trim_"
)
Arguments
- files
A character vector with the full path of the file/s to trim.
- MS1
Set to TRUE for trimming MS level 1 data.
- MS2
Set to TRUE for trimming MS level 2 data.
- rtWindow
A numeric vector of length 2 with the minimum and maximum time range to trim the files, in seconds.
- mzWindow
A numeric vector of length 2 with the minimum and maximum m/z range to trim the files, in Da.
- mzWindow_ms2
A numeric vector of length 2 with the minimum and maximum m/z range to trim MS2 data files, in Da. when NULL and MS2 is TRUE the
mzWindow
argument is used instead.- intensityThreshold
A numeric vector of length one with the minimum intensity threshold. Traces below the given intensity threshold are removed. If a length two vector is given, the first value if applied for MS1 data and the second to MS2 data.
- copyMetadata
Set to TRUE to copy metadata from the original file.
- path
A character string with the path to save the files. When
NULL
, the file directory is used instead.- prefix
A character string with the name prefix for the new trimmed file.
Value
Saves the trimmed mzML or mzXML files in a given path, adding a pre-defined prefix to the file name.
Note
When giving paths make sure that single backslash is changed to double backslash of to single forward slash.
References
Pedrioli PGA, Eng JK, Hubley R, Vogelzang M, Deutsch EW, Raught B, Pratt B, Nilsson E, Angeletti RH, Apweiler R, Cheung K, Costello CE, Hermjakob H, Huang S, Julian RK, Kapp E, McComb ME, Oliver SG, Omenn G, Paton NW, Simpson R, Smith R, Taylor CF, Zhu W, Aebersold R (2004). “A common open representation of mass spectrometry data and its application to proteomics research.” Nat Biotechnol, 22(11), 1459–1466. doi:10.1038/nbt1031 , http://www.ncbi.nlm.nih.gov/pubmed/15529173.
Keller A, Eng J, Zhang N, Li X, Aebersold R (2005). “A uniform proteomics MS/MS analysis platform utilizing open XML file formats.” Mol Syst Biol.
Martens L, Chambers M, Sturm M, Kessner D, Levander F, Shofstahl J, Tang WH, Rompp A, Neumann S, Pizarro AD, Montecchi-Palazzi L, Tasman N, Coleman M, Reisinger F, Souda P, Hermjakob H, Binz P, Deutsch EW (2010). “mzML - a Community Standard for Mass Spectrometry Data.” Mol Cell Proteomics. doi:10.1074/mcp.R110.000133 , http://www.ncbi.nlm.nih.gov/pubmed/20716697.
Chambers, C. M, Maclean, Brendan, Burke, Robert, Amodei, Dario, Ruderman, L. D, Neumann, Steffen, Gatto, Laurent, Fischer, Bernd, Pratt, Brian, Egertson, Jarrett, Hoff, Katherine, Kessner, Darren, Tasman, Natalie, Shulman, Nicholas, Frewen, Barbara, Baker, A. T, Brusniak, Mi-Youn, Paulse, Christopher, Creasy, David, Flashner, Lisa, Kani, Kian, Moulding, Chris, Seymour, L. S, Nuwaysir, M. L, Lefebvre, Brent, Kuhlmann, Frank, Roark, Joe, Rainer, Paape, Detlev, Suckau, Hemenway, Tina, Huhmer, Andreas, Langridge, James, Connolly, Brian, Chadick, Trey, Holly, Krisztina, Eckels, Josh, Deutsch, W. E, Moritz, L. R, Katz, E. J, Agus, B. D, MacCoss, Michael, Tabb, L. D, Mallick, Parag (2012). “A cross-platform toolkit for mass spectrometry and proteomics.” Nat Biotech, 30(10), 918–920. doi:10.1038/nbt.2377 , http://dx.doi.org/10.1038/nbt.2377.