【问题标题】:GenomicFeatures: Keeping track of reads and scores when mapping to transcriptsGenomicFeatures:在映射到转录本时跟踪读数和分数
【发布时间】:2016-03-07 21:17:53
【问题描述】:

我有一个包含基因组坐标及其分数的病床文件。我想将这些坐标映射到人类外显子并跟踪分数。

这里是一个例子(我的床文件只有三行存储在一个 GRanges 对象中):

   library(GenomicRanges)

   reads<-GRanges(
    seqnames = Rle(rep("chr1", 3)),
    ranges = IRanges(c(3044402,3044562,3044827),c(3044402,3044562,3044827)),
    strand = Rle(rep("*",3)),
    score = c(0.111111,-0.101128,-0.25)
    )
   reads

   GRanges object with 3 ranges and 1 metadata column:
         seqnames             ranges strand |     score
            <Rle>          <IRanges>  <Rle> | <numeric>
     [1]     chr1 [3044402, 3044402]      * |  0.111111
     [2]     chr1 [3044562, 3044562]      * | -0.101128
     [3]     chr1 [3044827, 3044827]      * |     -0.25
     -------
     seqinfo: 1 sequence from an unspecified genome; no seqlengths

加载必要的库后...

   library(TxDb.Hsapiens.UCSC.hg19.knownGene)
   library(BSgenome.Hsapiens.UCSC.hg19)

   txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene
   exon_by_tx<-exonsBy(txdb, by="tx", use.names=TRUE)

...我可以像这样将这些基因组坐标映射到外显子:

   library(GenomicFeatures)

   mapped_exon <- mapToTranscripts(reads, exon_by_tx,ignore.strand=FALSE)
   mapped_exon

   GRanges object with 1 range and 2 metadata columns:
           seqnames    ranges strand |     xHits transcriptsHits
              <Rle> <IRanges>  <Rle> | <integer>       <integer>
     [1] uc021oez.1  [24, 24]      + |         2             158

我知道 uc021oez.1 (NR_036215) 的基因组坐标是 chr1:3044539-3044599。这意味着chr1 [3044562, 3044562] 映射到uc021oez.1 [24, 24],其得分为-0.101128。

如何跟踪这些信息?换句话说,如何使用对应的reads 条目自动向mapped_exon 添加额外的列?

【问题讨论】:

    标签: r mapping bioconductor


    【解决方案1】:

    好的。我找到了解决方案! :)

    mcols(mapped_exon)<-cbind(mcols(mapped_exon),DataFrame(reads[mapped_exon$xHits]))
    
    mapped_exon
    GRanges object with 1 range and 4 metadata columns:
            seqnames    ranges strand |     xHits transcriptsHits                         X     score
               <Rle> <IRanges>  <Rle> | <integer>       <integer>                 <GRanges> <numeric>
      [1] uc021oez.1  [24, 24]      + |         2             158 chr1:*:[3044562, 3044562] -0.101128
      -------
      seqinfo: 1 sequence from an unspecified genome; no seqlengths
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多