Git Product home page Git Product logo

Comments (4)

thackl avatar thackl commented on September 26, 2024

You mean zoom in on the second genome so it becomes larger on the plot? Hm, I can't think of anything that would be very easy.

Of the top of my head I can think of two maybe options:

  1. What would be possible is to break up the long contig, i.e. only show the regions with some space around that actually align. focus() on links can do that automatically (let me know if you want try something like that but don't know how).
  2. Manually scale the coordinates of one of the genomes. Something like multiplying every length, start and end column in for Xtrop_Chr1 in gAll, sAll and tblastx_tibble by 10 or so.

from gggenomes.

tgodoy avatar tgodoy commented on September 26, 2024

Thanks, I think that I will probe the the second solution. But In case I need to do a zoom in some regions, How I can do it?

from gggenomes.

thackl avatar thackl commented on September 26, 2024

Here's a minimal example that you might be able to adapt for your case.

library(gggenomes)

g0 <- tribble(
  ~seq_id, ~start, ~end,
  "A", 100, 200,
  "A", 10000, 10100,
  "B", 100, 200,
  "B", 300, 500
)

# clusters are just a faster way for manually creating links
c0 <- tribble(
  ~cluster_id, ~feat_id,
  "cls1", "f1",
  "cls1", "f3",
  "cls2", "f2",
  "cls2", "f4")

p1 <- gggenomes(g0) %>%
  add_clusters(links=c0) +
  geom_seq() +
  geom_gene() +
  geom_link() +
  geom_gene_tag(aes(label=feat_id)) 
p1

image

# zoom in on loci with links, group links less than 200 apart, show 200 flank
# you may have to play with those values
p1 %>% 
  focus(.track_id=links, .max_dist = 200, .expand=200) + 
  geom_seq_label()

image

# and add nice locus labels that indicate start/end of regions
p1 %>% 
  focus(.track_id=links, .max_dist = 200, .expand=200,
    .locus_id=str_glue("{seq_id}:{start}-{end}")) + 
  geom_seq_label()

image

# scaling up B 25 times - not sure how much sense this representation makes, though...
g_scaled <- g0 %>%
  mutate(across(c(start, end), ~ifelse(str_detect(seq_id, "B"), .x * 25, .x)))

gggenomes(g_scaled) %>% add_clusters(c0) + geom_seq() + geom_gene() + geom_link()

image

from gggenomes.

tgodoy avatar tgodoy commented on September 26, 2024

Thanks a lot!!!

from gggenomes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.