2012-11-07 39 views
0

是否有一种简单的方法可以从xcmsRaw对象中获取保留时间列表/数组?XCMS包装 - 保留时间

示例代码:

xraw <- xcmsRaw(cdfFile) 

因此,例如,从中获取信息:

[email protected]$intensity 

[email protected]$mz 
+2

我不知道任何有关那个软件包,但是文档表明这可能是'xraw @ msnRt'之后的东西? – GSee

+0

好吧,我试过你的解决方案,但对于一个真正的数据,它不会返回任何东西。但是你应该是这样的...... – alap

+0

可能是因为你正在使用的对象中没有保留时间信息,但这是信息预期的位置。从'class @ xcmsRaw':'msnRt:扫描的保留时间'。 – Laurent

回答

2

你可以看到槽在您的xcmsRaw实例可用

> slotNames(xraw) 
[1] "env"     "tic"     "scantime"    
[4] "scanindex"    "polarity"    "acquisitionNum"  
[7] "profmethod"   "profparam"    "mzrange"    
[10] "gradient"    "msnScanindex"   "msnAcquisitionNum"  
[13] "msnPrecursorScan"  "msnLevel"    "msnRt"     
[16] "msnPrecursorMz"  "msnPrecursorIntensity" "msnPrecursorCharge" 
[19] "msnCollisionEnergy" "filepath" 

你想要的是[email protected] - 它是vectornumeric

env插槽是存储3个变量环境:在class?xcmsRaw类本身

> ls([email protected]) 
[1] "intensity" "mz"  "profile" 

更多细节。

编辑:如果指定includeMSn = TRUE和输入文件必须在mzXMLmzML,不cdfmsnRt插槽仅填充;如果从?xcmasRaw使用faahKO例子,你会看到,

xr <- xcmsRaw(cdffiles[1], includeMSn = TRUE) 
Warning message: 
In xcmsRaw(cdffiles[1], includeMSn = TRUE) : 
    Reading of MSn spectra for NetCDF not supported 

此外,[email protected]只会存储的保留时间为MSN扫描,以n > 1。请参阅[email protected],其中xsetxcmsSet实例,用于xcms提供的原始/更正的MS1保留时间。

EDIT2:另外,具有与mzR

> library(mzR) 
> cdffiles[1] 
[2] "/home/lgatto/R/x86_64-unknown-linux-gnu-library/2.16/faahKO/cdf/KO/ko15.CDF" 
> xx <- openMSfile(cdffiles[1]) 
> xx 
Mass Spectrometry file handle. 
Filename: /home/lgatto/R/x86_64-unknown-linux-gnu-library/2.16/faahKO/cdf/KO/ko15.CDF 
Number of scans: 1278 
> hd <- header(xx) 
> names(hd) 
[1] "seqNum"     "acquisitionNum"   
[3] "msLevel"     "peaksCount"    
[5] "totIonCurrent"   "retentionTime"   
[7] "basePeakMZ"    "basePeakIntensity"  
[9] "collisionEnergy"   "ionisationEnergy"   
[11] "highMZ"     "precursorScanNum"   
[13] "precursorMZ"    "precursorCharge"   
[15] "precursorIntensity"  "mergedScan"    
[17] "mergedResultScanNum"  "mergedResultStartScanNum" 
[19] "mergedResultEndScanNum" 
> class(hd) 
[1] "data.frame" 
> dim(hd) 
[1] 1278 19 

一去,但你会默认xcms管道之外,如果你走这条路线(虽然斯特芬·诺伊曼,从xcms,不知道mzR很好,很明显)。

最后,如果您想最大限度地获得来自xcms开发人员的反馈,您最好使用xcms online forum的Bioconductor mailing list

希望这会有所帮助。

+0

我认为这是一个不错的,但我已经做了一个关于我真正想做的事情! – alap

0

很好的答案,但我一直在寻找这样的:

xraw <- xcmsRaw(cdfFile) 
dp_index <- which(duplicated(rawMat(xraw)[,1])) 
xraw_rt_dp <- rawMat(xraw)[,1] 
xrawData.rt <- xraw_rt_dp[-dp_index] 

现在:

xrawData.rt #contains the retention time. 

观察 - >使用MZR包:

nc  <- mzR:::netCDFOpen(cdfFile) 
ncData <- mzR:::netCDFRawData(nc) 
mzR:::netCDFClose(nc) 

ncData$rt #contains the same retention time for the same input !!! 
+1

和'相同(ncData $ rt,hd $ retentionTime)'是'TRUE' – Laurent