2012-11-07 46 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