trackViewer icon indicating copy to clipboard operation
trackViewer copied to clipboard

geneModelFromTxdb makes chromosome names into the lowercase format

Open ifantasy opened this issue 1 year ago • 6 comments

Hi,

I tried to use trackViewer in Arabidopsis thaliana. The chromosome names are the formats like "Chr1", "Chr2", etc. The BigWig files can be visualized normally. However, the gene modes can not be shown. I looked into the trs variable and found that the chromosome names were converted into the lowercase format, i.e., "chr1", "chr2". I can fix it by manually modifying the values of trs$AT1G09570.1@dat@seqnames@values and trs$AT1G09570.1@dat@seqinfo@seqnames. It will be great if the chromosome names can remain unchanged when gene modes were imported by the function geneModelFromTxdb.

gr <- GRanges("Chr1",IRanges(3095160,3100819))
trs <- geneModelFromTxdb(araport11.txdb,org.Athaliana.eg.db,gr=gr)
optSty <- optimizeStyle(trackList(sample1.bw,sample2.bw, trs))
trackList <- optSty$tracks
viewerStyle <- optSty$style
viewTracks(trackList=trackList,gr=gr)

ifantasy avatar Aug 06 '23 19:08 ifantasy

Hi @ifantasy,

Thank you for your comments. Could you please send the output of the following codes:

seqlevels(araport11.txdb)
seqlevels(sample1.bw$dat)
seqlevels(sample2.bw$dat)

Jianhong.

jianhong avatar Aug 07 '23 13:08 jianhong

Hi @jianhong

Sure. The output of the three codes are the same:

[1] "Chr1" "Chr2" "Chr3" "Chr4" "Chr5" "ChrC" "ChrM"

I also check chromosome names of araport11.txdb and org.Athaliana.eg.db. They are in original format.

> select(araport11.txdb, head(keys(araport11.txdb, "GENEID")), columns=c("GENEID","TXNAME","TXCHROM"), keytype="GENEID")

'select()' returned 1:many mapping between keys and columns
      GENEID      TXNAME TXCHROM
1  AT1G01010 AT1G01010.1    Chr1
2  AT1G01020 AT1G01020.2    Chr1
3  AT1G01020 AT1G01020.6    Chr1
4  AT1G01020 AT1G01020.1    Chr1
5  AT1G01020 AT1G01020.3    Chr1
6  AT1G01020 AT1G01020.4    Chr1
7  AT1G01020 AT1G01020.5    Chr1
8  AT1G01030 AT1G01030.1    Chr1
9  AT1G01030 AT1G01030.2    Chr1
10 AT1G01040 AT1G01040.1    Chr1
> head(transcripts(araport11.txdb,columns=c("TXID","TXNAME")))

GRanges object with 6 ranges and 2 metadata columns:
      seqnames      ranges strand |      TXID      TXNAME
         <Rle>   <IRanges>  <Rle> | <integer> <character>
  [1]     Chr1   3631-5899      + |         1 AT1G01010.1
  [2]     Chr1 11101-11372      + |         2 AT1G03987.1
  [3]     Chr1 23121-31227      + |         3 AT1G01040.1
  [4]     Chr1 23416-31120      + |         4 AT1G01040.2
  [5]     Chr1 28500-28706      + |         5 AT1G01046.1
  [6]     Chr1 32727-33009      + |         6 AT1G03997.1
  -------
  seqinfo: 7 sequences (2 circular) from an unspecified genome; no seqlengths
> select(org.Athaliana.eg.db,keys="AT1G01010",columns=c("CHROMOSOME","GID"))

        GID CHROMOSOME
1 AT1G01010       Chr1

ifantasy avatar Aug 08 '23 04:08 ifantasy

interesting. Could you please share me the araport11.txdb and org.Athaliana.eg.db? I did not see the code changed the seqlevel styles.

jianhong avatar Aug 08 '23 19:08 jianhong

I made the toy db files.

araport11.txdb can be imported by the code:

library(GenomicFeatures)
araport11.txdb <- makeTxDbFromGFF("test.gtf",format="gtf",dataSource="Apraport11",organism="Arabidopsis thaliana")

org.Athaliana.eg.db (decompress the file test.org.db.tar.gz first) can be installed by the code:

install.packages("org.Athaliana.eg.db",repos=NULL)

test.org.db.tar.gz test.gtf.gz

ifantasy avatar Aug 09 '23 04:08 ifantasy

The files are not available for downloading. Could you please send them to me directly by email?

jianhong avatar Aug 09 '23 12:08 jianhong

Got it. I have sent them to your email.

ifantasy avatar Aug 09 '23 18:08 ifantasy