Need Help w/ Subset on GRangesList
2
0
Entering edit mode
mat149 ▴ 80
@mat149-11450
Last seen 22 days ago
United States

Hello,

Can someone help me to subset each first intron (only) from a GRangesList representing intronsByTranscript? I've been somewhat out of practice for a period of time, and I'm stuck. Thanks,

tx

TxDb object:
# Db type: TxDb
# Supporting package: GenomicFeatures
# Data source: GCA_007735645.1
# Organism: Venturia.effusa
# Taxonomy ID: 50376
# miRBase build ID: NA
# Genome: ASM773564v1
# Nb of transcripts: 10897
# Db created by: GenomicFeatures package from Bioconductor
# Creation time: 2024-02-01 11:28:21 -0500 (Thu, 01 Feb 2024)
# GenomicFeatures version at creation time: 1.52.1
# RSQLite version at creation time: 2.3.1
# DBSCHEMAVERSION: 1.2

intr<-intronsByTranscript(tx)
intr


GRangesList object of length 10897:
$`1`
GRanges object with 0 ranges and 0 metadata columns:
   seqnames    ranges strand
      <Rle> <IRanges>  <Rle>
  -------
  seqinfo: 21 sequences from ASM773564v1 genome

$`2`
GRanges object with 1 range and 0 metadata columns:
        seqnames        ranges strand
           <Rle>     <IRanges>  <Rle>
  [1] CP042185.1 102664-102719      +
  -------
  seqinfo: 21 sequences from ASM773564v1 genome

$`3`
GRanges object with 1 range and 0 metadata columns:
        seqnames        ranges strand
           <Rle>     <IRanges>  <Rle>
  [1] CP042185.1 114417-114472      +
  -------
  seqinfo: 21 sequences from ASM773564v1 genome

...
<10894 more elements>


> intr[10400]

GRangesList object of length 1:
$`10400`
GRanges object with 2 ranges and 0 metadata columns:
        seqnames        ranges strand
           <Rle>     <IRanges>  <Rle>
  [1] CP042202.1 614609-614653      -
  [2] CP042202.1 615053-615568      -
  -------
  seqinfo: 21 sequences from ASM773564v1 genome




> la<-lapply(intr,"[[",1)

Error in getListElement(x, i, ...) : 
  GRanges objects don't support [[, as.list(), lapply(), or unlist() at the
  moment
GenomicRange GenomicRanges • 546 views
ADD COMMENT
2
Entering edit mode
@james-w-macdonald-5106
Last seen 12 minutes ago
United States

How about this?

> library(TxDb.Hsapiens.UCSC.hg19.knownGene)
> intr <- intronsByTranscript(TxDb.Hsapiens.UCSC.hg19.knownGene)
> unlist(intr)[names(intr)[lengths(intr) > 0L]]
GRanges object with 72404 ranges and 0 metadata columns:
              seqnames        ranges strand
                 <Rle>     <IRanges>  <Rle>
      1           chr1   12228-12612      +
      2           chr1   12228-12594      +
      3           chr1   12228-12645      +
      7           chr1 322229-324287      +
      8           chr1 324061-324287      +
    ...            ...           ...    ...
  82952 chrUn_gl000228 114116-123599      +
  82953 chrUn_gl000228   31036-31352      -
  82954 chrUn_gl000228   31036-31352      -
  82956 chrUn_gl000237     1004-2472      -
  82957 chrUn_gl000241   20482-22731      -
  -------
  seqinfo: 93 sequences (1 circular) from hg19 genome

Login before adding your answer.

Traffic: 797 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6