Generate a track object from TxDb by given gene ids

geneTrack(ids, txdb, symbols, type = c("gene", "transcript"), asList = TRUE)

Arguments

ids

Gene IDs. A vector of character. It should be keys in txdb.

txdb

An object of TxDb.

symbols

symbol of genes.

type

Output type of track, "gene" or "transcript".

asList

Output a list of tracks or not. Default TRUE.

Value

An object of track

Examples

library(TxDb.Hsapiens.UCSC.hg19.knownGene)
library(org.Hs.eg.db)
ids <- c("3312", "390259", "341056", "79827")
symbols <- mget(ids, org.Hs.egSYMBOL)
geneTrack(ids, TxDb.Hsapiens.UCSC.hg19.knownGene, symbols)
#> $`3312`
#> This is an object of track
#>  slot name: HSPA8 
#>  slot type: gene 
#>  slot format:  
#> slot dat:
#> GRanges object with 23 ranges and 5 metadata columns:
#>         seqnames              ranges strand |     feature          id
#>            <Rle>           <IRanges>  <Rle> | <character> <character>
#>   HSPA8    chr11 122928200-122928441      - |        utr3        3312
#>   HSPA8    chr11 122928442-122928536      - |         CDS        3312
#>   HSPA8    chr11 122928537-122928627      - |         CDS        3312
#>   HSPA8    chr11 122928960-122929192      - |         CDS        3312
#>   HSPA8    chr11 122929340-122929474      - |         CDS        3312
#>     ...      ...                 ...    ... .         ...         ...
#>   HSPA8    chr11 122931301-122931506      - |         CDS        3312
#>   HSPA8    chr11 122931828-122932032      - |         CDS        3312
#>   HSPA8    chr11 122932033-122932037      - |        utr5        3312
#>   HSPA8    chr11 122932772-122932901      - |        utr5        3312
#>   HSPA8    chr11 122933055-122933186      - |        utr5        3312
#>                exon  transcript        gene
#>         <character> <character> <character>
#>   HSPA8      3312_1     unknown       HSPA8
#>   HSPA8      3312_1     unknown       HSPA8
#>   HSPA8      3312_2     unknown       HSPA8
#>   HSPA8      3312_3     unknown       HSPA8
#>   HSPA8      3312_4     unknown       HSPA8
#>     ...         ...         ...         ...
#>   HSPA8     3312_15     unknown       HSPA8
#>   HSPA8     3312_16     unknown       HSPA8
#>   HSPA8     3312_16     unknown       HSPA8
#>   HSPA8     3312_17     unknown       HSPA8
#>   HSPA8     3312_18     unknown       HSPA8
#>   -------
#>   seqinfo: 1 sequence from an unspecified genome; no seqlengths
#> slot dat2:
#> GRanges object with 0 ranges and 0 metadata columns:
#>    seqnames    ranges strand
#>       <Rle> <IRanges>  <Rle>
#>   -------
#>   seqinfo: no sequences
#> slot style: try object$style to see details.
#> 
#> $`341056`
#> This is an object of track
#>  slot name: SAE1P1 
#>  slot type: gene 
#>  slot format:  
#> slot dat:
#> GRanges object with 1 range and 1 metadata column:
#>          seqnames              ranges strand |     feature
#>             <Rle>           <IRanges>  <Rle> | <character>
#>   SAE1P1    chr11 122888274-122890319      + |       ncRNA
#>   -------
#>   seqinfo: 1 sequence from an unspecified genome; no seqlengths
#> slot dat2:
#> GRanges object with 0 ranges and 0 metadata columns:
#>    seqnames    ranges strand
#>       <Rle> <IRanges>  <Rle>
#>   -------
#>   seqinfo: no sequences
#> slot style: try object$style to see details.
#> 
#> $`390259`
#> This is an object of track
#>  slot name: BSX 
#>  slot type: gene 
#>  slot format:  
#> slot dat:
#> GRanges object with 3 ranges and 5 metadata columns:
#>       seqnames              ranges strand |     feature          id        exon
#>          <Rle>           <IRanges>  <Rle> | <character> <character> <character>
#>   BSX    chr11 122848357-122848599      - |         CDS      390259    390259_1
#>   BSX    chr11 122849969-122850165      - |         CDS      390259    390259_2
#>   BSX    chr11 122852118-122852379      - |         CDS      390259    390259_3
#>        transcript        gene
#>       <character> <character>
#>   BSX     unknown         BSX
#>   BSX     unknown         BSX
#>   BSX     unknown         BSX
#>   -------
#>   seqinfo: 1 sequence from an unspecified genome; no seqlengths
#> slot dat2:
#> GRanges object with 0 ranges and 0 metadata columns:
#>    seqnames    ranges strand
#>       <Rle> <IRanges>  <Rle>
#>   -------
#>   seqinfo: no sequences
#> slot style: try object$style to see details.
#> 
#> $`79827`
#> This is an object of track
#>  slot name: CLMP 
#>  slot type: gene 
#>  slot format:  
#> slot dat:
#> GRanges object with 9 ranges and 5 metadata columns:
#>        seqnames              ranges strand |     feature          id
#>           <Rle>           <IRanges>  <Rle> | <character> <character>
#>   CLMP    chr11 122943033-122944181      - |        utr3       79827
#>   CLMP    chr11 122944182-122944482      - |         CDS       79827
#>   CLMP    chr11 122945410-122945551      - |         CDS       79827
#>   CLMP    chr11 122953793-122953915      - |         CDS       79827
#>   CLMP    chr11 122954388-122954555      - |         CDS       79827
#>   CLMP    chr11 122955220-122955421      - |         CDS       79827
#>   CLMP    chr11 122968503-122968660      - |         CDS       79827
#>   CLMP    chr11 123065621-123065648      - |         CDS       79827
#>   CLMP    chr11 123065649-123066007      - |        utr5       79827
#>               exon  transcript        gene
#>        <character> <character> <character>
#>   CLMP     79827_1     unknown        CLMP
#>   CLMP     79827_1     unknown        CLMP
#>   CLMP     79827_2     unknown        CLMP
#>   CLMP     79827_3     unknown        CLMP
#>   CLMP     79827_4     unknown        CLMP
#>   CLMP     79827_5     unknown        CLMP
#>   CLMP     79827_6     unknown        CLMP
#>   CLMP     79827_7     unknown        CLMP
#>   CLMP     79827_7     unknown        CLMP
#>   -------
#>   seqinfo: 1 sequence from an unspecified genome; no seqlengths
#> slot dat2:
#> GRanges object with 0 ranges and 0 metadata columns:
#>    seqnames    ranges strand
#>       <Rle> <IRanges>  <Rle>
#>   -------
#>   seqinfo: no sequences
#> slot style: try object$style to see details.
#>