pangenome / odgi

Optimized Dynamic Genome/Graph Implementation: understanding pangenome graphs
https://doi.org/10.1093/bioinformatics/btac308
MIT License
191 stars 39 forks source link

Issue with compacting path names using odgi -viz #527

Closed gavinieong closed 1 year ago

gavinieong commented 1 year ago

Hello,

I am currently using odgi -viz to produce graphs and I don't understand how to compact my graph path names.

Currently when I run it through cactus-pangenome, the graph only has the names of the supplied input file. However, when I run an odgi file without using cactus-pangenome, and using odgi -viz directly (as I want to use different options), there are many more path names within the graph, making my graph really big on the vertical scale. I tried to use -M option to see if it was the correct option to compact the graph, however, the graph was not changed.

I was wondering if there was a tutorial or example of how to compact the graph to only those of the input file.

Thank you for any help!

subwaystation commented 1 year ago

Hi @Gavin-I,

could you please be more specific? Do you have some example command lines? What do you mean with "odgi file without cactus-pangenome"?

AndreaGuarracino commented 1 year ago

It depends on the prefixes that you give in input to -M. We follow the PanSN-spec for the path names (SAMPLE#HAPLOTYPE#CONTIG), so to get the prefixes for each haplotype we run something like

odgi paths -i graph.og -L | cut -f 1,2 -d '#' | sort | uniq > prefixes_by_haplotype.txt

To compress further by sample, you can run

odgi paths -i graph.og -L | cut -f 1 -d '#' | sort | uniq > prefixes_by_sample.txt

Using those files as input for -M, you would get less paths in your plots:

odgi viz -i graph.og -o graph.haplotypes.viz.ong -M prefixes_by_haplotype.txt odgi viz -i graph.og -o graph.samples.viz.ong -M prefixes_by_sample.txt


From: Simon Heumos @.> Sent: 07 September 2023 08:34 To: pangenome/odgi @.> Cc: Subscribed @.***> Subject: Re: [pangenome/odgi] Issue with compacting path names using odgi -viz (Issue #527)

Hi @Gavin-Ihttps://github.com/Gavin-I,

could you please be more specific? Do you have some example command lines? What do you mean with "odgi file without cactus-pangenome"?

— Reply to this email directly, view it on GitHubhttps://github.com/pangenome/odgi/issues/527#issuecomment-1709556083, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AO26XHXBQJGVHNBL45WGBL3XZFTHPANCNFSM6AAAAAA4N2TA2I. You are receiving this because you are subscribed to this thread.Message ID: @.***>

gavinieong commented 1 year ago

Hello, thank you both for the help.

To be more specific, currently I am creating graphs of my data by using cactus-pangenome. The command looks something like this (From their basic example):

cactus-pangenome ./js ./examples/evolverPrimates.txt --outDir primates-pg --outName primates-pg --reference simChimp --viz

In which the option --viz generates a graph for me.

I wanted to recreate the graph directly using ODGI and I used the command: odgi viz -i example.og -o example.png -x 500

I couldn't get the graphs to look similar, as I could not get the graph to contain less path names.

However, thank you @AndreaGuarracino , afterwards I tried using your command and it seems to be doing what I wanted.

The graphs look very similar although, with some minor differences which might be because of some additional options I left out.

Once again, thank you both for the help!

subwaystation commented 1 year ago

Happy to hear you worked it out @Gavin-I! @AndreaGuarracino :+1: