Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R XCMS包-保留时间_R_Bioconductor - Fatal编程技术网

R XCMS包-保留时间

R XCMS包-保留时间,r,bioconductor,R,Bioconductor,有没有一种简单的方法可以从xcmsRaw对象获取保留时间列表/数组 示例代码: xraw <- xcmsRaw(cdfFile) 或 您可以使用查看xcmsRaw实例中的可用插槽 > slotNames(xraw) [1] "env" "tic" "scantime" [4] "scanindex" "polarity" "acq

有没有一种简单的方法可以从
xcmsRaw
对象获取保留时间列表/数组

示例代码:

xraw <- xcmsRaw(cdfFile) 


您可以使用查看
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"
您需要的是
xraw@msnRt
-它是一个
向量
,属于
数值

env
插槽是一个存储3个变量的环境:

> ls(xraw@env)
[1] "intensity" "mz"        "profile"
有关类本身的更多详细信息,请访问
class?xcmsRaw

编辑:仅当您指定
includeMSn=TRUE
并且输入文件必须位于
mzXML
mzML
中,而不是位于
cdf
中时,才会填充
msnRt
插槽;如果使用
?xcmasRaw
中的
faahKO
示例,您将看到

xr <- xcmsRaw(cdffiles[1], includeMSn = TRUE)
Warning message:
In xcmsRaw(cdffiles[1], includeMSn = TRUE) :
  Reading of MSn spectra for NetCDF not supported
但是,如果您选择此路线,您将不在默认的
xcms
管道中(尽管
xcms
的Steffen Neumann非常清楚
mzR

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


希望这有帮助。

答案不错,但我一直在寻找:

xraw <- xcmsRaw(cdfFile)
dp_index <- which(duplicated(rawMat(xraw)[,1]))
xraw_rt_dp <- rawMat(xraw)[,1]
xrawData.rt <- xraw_rt_dp[-dp_index]
观察-->使用mzr包:

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

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

nc我对该软件包一无所知,但文档表明这可能就是您想要的
xraw@msnRt
?好的,我尝试了您的解决方案,但对于真实数据,它不会返回任何内容。但你是对的,它应该是……可能是因为你正在使用的对象中没有保留时间信息,但这正是信息应该存在的地方。从
class@xcmsRaw<代码> >代码> MSNRT:扫描< /代码>的保留时间。我认为这是一个很好的unSWER,但我已经做了一个关于我真正想做的帖子!!!和
相同(ncData$rt,hd$retentionTime)
TRUE
> 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
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.
nc     <- mzR:::netCDFOpen(cdfFile)
ncData <- mzR:::netCDFRawData(nc)
mzR:::netCDFClose(nc)

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