如何找出R中对象中哪个索引超出范围

时间:2015-11-26 22:55:36

标签: r bioconductor

虽然我理解OOP,但我只是在R中遇到过它们 我正在使用Bioconductor的一个包来翻译一些基因组数据。 它创建的对象称为readCounts,并在命令中键入以下内容。

QDNAseqReadCounts (storageMode: lockedEnvironment)
assayData: 206391 features, 1 samples 
  element names: counts 
protocolData: none
phenoData
  sampleNames: SLX-10457.FastSeqA.BloodDMets_11AF_-AHMMH.s_1.r_1.fq.gz
  varLabels: name total.reads used.reads expected.variance
  varMetadata: labelDescription
featureData
  featureNames: 1:825001-840000 1:840001-855000 ... 22:51165001-51180000 (168063 total)
  fvarLabels: chromosome start ... use (9 total)
  fvarMetadata: labelDescription
experimentData: use 'experimentData(object)'
Annotation: 

我试图在一个简单的xy图上绘制读数,如下所示:

plot(readCounts, logTransform=TRUE, ylim=c(-1000, binSize * 15))

然而,当我这样做时,我收到以下错误:

Error in sort.int(x, partial = unique(c(lo, hi))) : 
  index 180 outside bounds

使用traceback()显示:

6: sort.int(x, partial = unique(c(lo, hi)))
5: FUN(newX[, i], ...)
4: apply(copynumber, 2, sdFUN, na.rm = TRUE)
3: .local(x, y, ...)
2: plot(readCounts, logTransform = TRUE, ylim = c(-1000, binSize * 
       15))
1: plot(readCounts, logTransform = TRUE, ylim = c(-1000, binSize * 
       15))

所以googled我认为它可能是一个缺失的值问题,所以我尝试na.omit(readCounts)但又得到了同样的错误,但这次将越界索引设置为207。

我试图检查数据,但我在第207行找不到任何错误,尽管我不确定这是指哪个插槽。我真的不知道如何调试这个。我很乐意提供有关我尝试做什么的更多信息,但我真的不知道如何确定R对象中此错误的问题。

当我str(readCounts)时,我得到:

Formal class 'QDNAseqReadCounts' [package "QDNAseq"] with 7 slots
  ..@ assayData        :<environment: 0x13a99ed90> 
  ..@ phenoData        :Formal class 'AnnotatedDataFrame' [package "Biobase"] with 4 slots
  .. .. ..@ varMetadata      :'data.frame': 4 obs. of  1 variable:
  .. .. .. ..$ labelDescription: chr [1:4] NA NA NA NA
  .. .. ..@ data             :'data.frame': 1 obs. of  4 variables:
  .. .. .. ..$ name             : chr "SLX-10457.FastSeqA.BloodDMets_11AF_-AHMMH.s_1.r_1.fq.gz"
  .. .. .. ..$ total.reads      : num 0
  .. .. .. ..$ used.reads       : num 0
  .. .. .. ..$ expected.variance: num Inf
  .. .. ..@ dimLabels        : chr [1:2] "sampleNames" "sampleColumns"
  .. .. ..@ .__classVersion__:Formal class 'Versions' [package "Biobase"] with 1 slot
  .. .. .. .. ..@ .Data:List of 1
  .. .. .. .. .. ..$ : int [1:3] 1 1 0
  ..@ featureData      :Formal class 'AnnotatedDataFrame' [package "Biobase"] with 4 slots
  .. .. ..@ varMetadata      :'data.frame': 9 obs. of  1 variable:
  .. .. .. ..$ labelDescription: chr [1:9] "Chromosome name" "Base pair start position" "Base pair end position" "Percentage of non-N nucleotides (of full bin size)" ...
  .. .. ..@ data             :'data.frame': 168063 obs. of  9 variables:
  .. .. .. ..$ chromosome : chr [1:168063] "1" "1" "1" "1" ...
  .. .. .. ..$ start      : num [1:168063] 825001 840001 855001 870001 885001 ...
  .. .. .. ..$ end        : num [1:168063] 840000 855000 870000 885000 900000 915000 930000 945000 960000 975000 ...
  .. .. .. ..$ bases      : num [1:168063] 100 100 100 100 100 100 100 100 100 100 ...
  .. .. .. ..$ gc         : num [1:168063] 48 61.8 65.1 65.5 62.6 ...
  .. .. .. ..$ mappability: num [1:168063] 58.6 91.5 94.1 93.2 93.9 ...
  .. .. .. ..$ blacklist  : num [1:168063] 0.727 0 0 0 0 ...
  .. .. .. ..$ residual   : num [1:168063] -0.0627 0.05036 0.09384 0.00541 -0.00588 ...
  .. .. .. ..$ use        : logi [1:168063] TRUE TRUE TRUE TRUE TRUE TRUE ...
  .. .. .. ..- attr(*, "na.action")=Class 'omit'  Named int [1:38328] 1 2 3 4 5 6 7 8 9 10 ...
  .. .. .. .. .. ..- attr(*, "names")= chr [1:38328] "1:1-15000" "1:15001-30000" "1:30001-45000" "1:45001-60000" ...
  .. .. ..@ dimLabels        : chr [1:2] "featureNames" "featureColumns"
  .. .. ..@ .__classVersion__:Formal class 'Versions' [package "Biobase"] with 1 slot
  .. .. .. .. ..@ .Data:List of 1
  .. .. .. .. .. ..$ : int [1:3] 1 1 0
  ..@ experimentData   :Formal class 'MIAME' [package "Biobase"] with 13 slots
  .. .. ..@ name             : chr ""
  .. .. ..@ lab              : chr ""
  .. .. ..@ contact          : chr ""
  .. .. ..@ title            : chr ""
  .. .. ..@ abstract         : chr ""
  .. .. ..@ url              : chr ""
  .. .. ..@ pubMedIds        : chr ""
  .. .. ..@ samples          : list()
  .. .. ..@ hybridizations   : list()
  .. .. ..@ normControls     : list()
  .. .. ..@ preprocessing    : list()
  .. .. ..@ other            : list()
  .. .. ..@ .__classVersion__:Formal class 'Versions' [package "Biobase"] with 1 slot
  .. .. .. .. ..@ .Data:List of 2
  .. .. .. .. .. ..$ : int [1:3] 1 0 0
  .. .. .. .. .. ..$ : int [1:3] 1 1 0
  ..@ annotation       : chr(0) 
  ..@ protocolData     :Formal class 'AnnotatedDataFrame' [package "Biobase"] with 4 slots
  .. .. ..@ varMetadata      :'data.frame': 0 obs. of  1 variable:
  .. .. .. ..$ labelDescription: chr(0) 
  .. .. ..@ data             :'data.frame': 1 obs. of  0 variables
  .. .. ..@ dimLabels        : chr [1:2] "sampleNames" "sampleColumns"
  .. .. ..@ .__classVersion__:Formal class 'Versions' [package "Biobase"] with 1 slot
  .. .. .. .. ..@ .Data:List of 1
  .. .. .. .. .. ..$ : int [1:3] 1 1 0
  ..@ .__classVersion__:Formal class 'Versions' [package "Biobase"] with 1 slot
  .. .. ..@ .Data:List of 4
  .. .. .. ..$ : int [1:3] 3 1 2
  .. .. .. ..$ : int [1:3] 2 26 0
  .. .. .. ..$ : int [1:3] 1 3 0
  .. .. .. ..$ : int [1:3] 1 2 4

0 个答案:

没有答案
相关问题