thackl / gggenomes

A grammar of graphics for comparative genomics
https://thackl.github.io/gggenomes/
Other
579 stars 64 forks source link

Genes do not start and end at the expected positions #145

Closed pendy05 closed 1 year ago

pendy05 commented 1 year ago

Dear gggenomes developers,

I encountered an issue where the genes do not start and end at the provided positions (please refer to the attached image). By taking the protein NS1 as an example, NS1 should starts from position 616 and ends at 2631, but in the plot, it appears to start from position 0 to somewhere around 2000.

Any idea on this?

A reprex is provided below.

library(gggenomes)

data<-tibble(
    file_id=rep('file', 6),
    seq_id =rep('BVI',6),
    start = c(616,2084,2624,2874, 3305, 4890),
    end=c(2631,2308,4969,3119, 4969, 5174),
    type=rep('CDS',6),
    name=c('NS1','7.5kDa','VP1','X','VP2', '11kDa'))

gggenomes(data) +
    geom_gene(aes(fill=name), position="pile")+ 
    geom_seq() +
    labs(fill = 'Protein')

Rplot

Thank you for your help and for introducing this wonderful package.

Regards, Pendy.

thackl commented 1 year ago

If you don't provide seq info explicitly, gggenomes zooms in on the provided genes (see https://thackl.github.io/gggenomes/articles/gggenomes.html#plotting-from-scratch for some more info on why). Use gggenomes(data, infer_start=1) to show everything from the first base on.

pendy05 commented 1 year ago

Thanks for the further clarification! Appreciate it :D