Import mgf files as 'MSnExp' instances.
Reads a mgf file and generates an "MSnExp"
object.
readMgfData(filename, pdata = NULL, centroided = TRUE, smoothed = FALSE, verbose = isMSnbaseVerbose(), cache = 1)
filename |
character vector with file name to be read. |
pdata |
an object of class |
smoothed |
|
centroided |
|
cache |
Numeric indicating caching level. Default is 1. Under development. |
verbose |
verbosity flag. |
Note that when reading an mgf file, the original order of the spectra
is lost. Thus, if the data was originally written to mgf from an
MSnExp
object using writeMgfData
, although the feature
names will be identical, the spectra are not as a result of the
reordering. See example below.
An instance of
Guangchuang Yu <guangchuangyu@gmail.com> and Laurent Gatto <lg390@cam.ac.uk>
writeMgfData
method to write the content of
"Spectrum"
or "MSnExp"
objects to mgf files. Raw data files can also be read with the
readMSData
function.
data(itraqdata) writeMgfData(itraqdata, con="itraqdata.mgf", COM="MSnbase itraqdata") itraqdata2 <- readMgfData("itraqdata.mgf") ## note that the order of the spectra is altered ## and precision of some values (precursorMz for instance) match(signif(precursorMz(itraqdata2),4),signif(precursorMz(itraqdata),4)) ## [1] 1 10 11 12 13 14 15 16 17 18 ... ## ... but all the precursors are there all.equal(sort(precursorMz(itraqdata2)), sort(precursorMz(itraqdata)), check.attributes=FALSE, tolerance=10e-5) ## is TRUE all.equal(as.data.frame(itraqdata2[[1]]),as.data.frame(itraqdata[[1]])) ## is TRUE all.equal(as.data.frame(itraqdata2[[3]]),as.data.frame(itraqdata[[11]])) ## is TRUE f <- dir(system.file(package="MSnbase",dir="extdata"), full.name=TRUE, pattern="test.mgf") (x <- readMgfData(f)) x[[2]] precursorMz(x[[2]]) precursorIntensity(x[[2]]) precursorMz(x[[1]]) precursorIntensity(x[[1]]) ## was not in test.mgf scanIndex(x)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.