This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Ideogram in Gviz without a valid UCSC genome

I would like to use the Gviz package but my I have a reference genome in FASTA format, not as a valid UCSC genome (it was not published yet).

It is possible to use this FASTA file instead?

Let´s say that I have one genome in FASTA format on disk:

library(Biostrings)
ncrna <- readDNAStringSet(file = "GTgenome.fa")

head(ncrna)
  A DNAStringSet instance of length 6
       width seq                                            names
[1] 20202851 CCCAGTTTTCCCCACTCTGTGA...AAAGATCTTACAACCGATTTT chr10 Major...
[2] 20315886 AGCCGACGAGACTCACAGAACC...TCACAAACCCCCTCGGGAGGG chr11 Major...
[3] 20466350 GATTAGACCTCCGAAAGGGGTA...ATTATTAATTATTAAATATTA chr12 Major...
[4] 16480340 GTCTCCACTTGCCCCACAACGG...AGATGACGATGATGAAGATGA chr13 Major...
[5] 16193477 CTCTGTGACATCACAGCCATGG...GGGTTACACACGTTGTTTTTT chr14 Major...

Using the object created to replace a UCSC genome:

ideoTrack <- IdeogramTrack(genome=ncrna, chromosome="chr10", fontsize=14)

Error in .Call2("new_XStringSet_from_CHARACTER", ans_class, ans_elementType,  :
  key 51 (char '3') not in lookup table
In addition: Warning message:
In if (!token %in% base::ls(env)) { :
  the condition has length > 1 and only the first element will be used

I am probably misunderstanding a very basic feature here, but I would be grateful for some help!

r biocondutor

1 answer

I am not sure if I fully understood the problem, but what you could try is to replace an UCSC Ideogram with your own data. This solution is certainly not the best way, but I'm not that familiar with the Gviz package.

Build a track from, for example the human genome chr22. Subsequently, replace the necessary slots (range, chromosome bands and names) with your own data.

library(Gviz)
ideoTrack <- IdeogramTrack(genome = "hg38",chromosome = "chr22")
plotTracks(ideoTrack,from = 1,to = 1000000)

# set your own
my_ideoTrack <- ideoTrack

# RANGE
START=seq(1,100,10)
END=seq(10,100,10)
RANGES <- GRanges(seqnames = c(letters[1:10]),IRanges(start =START ,end =END))

# arbitrary Giemsa staining
GS <- c("gneg", "gpos100",  "gpos25","acen",  "gpos50",  "gpos75",    "gvar",   "stalk" ,NA,NA)
bt <- data.frame(chrom="own1",chromStart= seq(1,100,10),chromEnd=seq(10,100,10),name=letters[1:10],gieStain=GS)

# chromosome name
CHR <- "own1"

# Replace with your own data
my_ideoTrack@range <- RANGES
my_ideoTrack@chromosome <- CHR
my_ideoTrack@name <- CHR
my_ideoTrack@bandTable <- bt

# set UCSC chromosome Names False
options(ucscChromosomeNames=FALSE)
gx <- GenomeAxisTrack()
# Plot
plotTracks(list(my_ideoTrack,gx),from = 1,to = 15)

Log in to answer this question.