vgteam / vg

tools for working with genome variation graphs
https://biostars.org/tag/vg/
Other
1.1k stars 194 forks source link

graph visualization error #3340

Open userzxyz opened 3 years ago

userzxyz commented 3 years ago

Hi,

I am trying to visualize graph to a base level using vg viz: vg viz -x seqwish.xg -o test.svg

But it gets Killed without any error. Thank you for the help!

jeizenga commented 3 years ago

Can you share the inputs to recreate this crash? Otherwise, there's not a lot for us to go on.

The primary maintainer of this subcommand is @ekg, but I suspect he might direct you to https://github.com/pangenome/odgi instead of vg viz. There's a similar visualization tool in odgi that seems to be a lot more mature than vg viz.

userzxyz commented 3 years ago

Thank you @jeizenga! I checked odgi viz command. It only displays 1D graph, right? I already have the 1D graph using pggb. I want to visualize the base level for certain region. Can odgi viz be used for that?

userzxyz commented 3 years ago

@jeizenga, can you share your email so that I can send you the input file that I am using. Thank you!

ekg commented 3 years ago

You'll want to use odgi extract or VG chunk to extract the region. Then you can use VG viz.

On Tue, Jul 13, 2021, 16:12 userzxyz @.***> wrote:

Thank you @jeizenga https://github.com/jeizenga! I checked odgi viz command. It only displays 1D graph, right? I already have the 1D graph using pggb. I want to visualize the base level for certain region. Can odgi viz be used for that?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/vgteam/vg/issues/3340#issuecomment-879124213, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABDQEPC2UKJBQGLZETP3Q3TXRCULANCNFSM5ADLQMHA .

userzxyz commented 3 years ago

Thank you @ekg! Based on the graph genome for any insertion or deletion, how to get the coordinates for that insertion/deletion to extract using VG chunk.

ekg commented 3 years ago

odgi position will do this. Check the documentation here: https://odgi.readthedocs.io/en/latest/

On Wed, Jul 14, 2021, 16:35 userzxyz @.***> wrote:

Thank you @ekg https://github.com/ekg! Based on the graph genome for any insertion or deletion, how to get the coordinates for that insertion/deletion to extract using VG chunk.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/vgteam/vg/issues/3340#issuecomment-879947361, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABDQEMUSKIHJ7IQSXYKGXDTXWOEFANCNFSM5ADLQMHA .

userzxyz commented 3 years ago

Thank you @ekg! I am not able to use odgi position so I tried usingodgi subset: odgi subset -i seqwish.xg -n 21 -c 1 -t 8 -o sample.xg

But it gives error:

warning [libhandlegraph]: Serialized handle graph does not appear to match deserialzation type.
warning [libhandlegraph]: It is either an old version or in the wrong format.
warning [libhandlegraph]: Attempting to load it anyway. Future releases will reject it!
terminate called after throwing an instance of 'std::length_error'
  what():  cannot create std::vector larger than max_size()
Aborted
ekg commented 3 years ago

odgi uses a different graph format. Use odgi build to make it from a GFA. It should be covered in the tutorials.

On Wed, Jul 14, 2021, 20:10 userzxyz @.***> wrote:

Thank you @ekg https://github.com/ekg! I am not able to use odgi position so I tried using odgi subset: odgi subset -i seqwish.xg -n 21 -c 1 -t 8 -o sample.xg

But it gives error:

warning [libhandlegraph]: Serialized handle graph does not appear to match deserialzation type. warning [libhandlegraph]: It is either an old version or in the wrong format. warning [libhandlegraph]: Attempting to load it anyway. Future releases will reject it! terminate called after throwing an instance of 'std::length_error' what(): cannot create std::vector larger than max_size() Aborted

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/vgteam/vg/issues/3340#issuecomment-880104275, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABDQEJSBUQVT7YNRJ3FFB3TXXHKBANCNFSM5ADLQMHA .

userzxyz commented 3 years ago

Thank you @ekg1! I have used:

odgi build -g sample.gfa -o sample.og
odgi subset -i sample.og -n 21 -c 1 -o sample.og
odgi view -i sample.og -g > sample.gfa
vg convert -x -g sample.gfa  > sample.xg 
vg viz -x sample.xg -o sample.svg

But it only shows reference sequence and no input samples for the location.

ekg commented 3 years ago

I think you want odgi extract. Maybe odgi subset should be removed (i forgot we even had that!)

On Wed, Jul 14, 2021, 22:04 userzxyz @.***> wrote:

Thank you @ekg1! I have used:

odgi build -g sample.gfa -o sample.og odgi subset -i sample.og -n 21 -c 1 -o sample.og odgi view -i sample.og -g > sample.gfa vg convert -x -g sample.gfa > sample.xg vg viz -x sample.xg -o sample.svg

But it only shows reference sequence and no input samples for the location.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/vgteam/vg/issues/3340#issuecomment-880172364, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABDQEJJYIPLESAV62MOOXDTXXUT5ANCNFSM5ADLQMHA .

subwaystation commented 3 years ago

In the current release, there is no odgi subset. Which version are you using @userzxyz ? I would recommend to build the latest one from master https://odgi.readthedocs.io/en/latest/rst/installation.html#building-from-source.

subwaystation commented 3 years ago

You can find a tutorial of odgi extract at https://odgi.readthedocs.io/en/latest/rst/tutorials/extract_selected_loci.html.

userzxyz commented 3 years ago

Thank you @ekg @subwaystation! I have updated the module and used odgi extract:

odgi build -g sample.fixed.gfa -o sample.og
odgi paths -i sample.og -L
odgi extract -i sample.og -n 21 -c 1 -o sample_21.og
odgi stats -I sample_21.og -S
odgi paths -i sample_21.og -L
odgi view -i sample_21.og -g > sample_21.gfa
vg convert -x -g sample_21.gfa > sample_21.xg
vg viz -x sample_21.xg -o sample_21.svg

I wanted to extract a variant based on the node ID (>19>21) from vcffile. The variant position in vcf file shows that all the samples have different ALT alleles for the variant. Based on the attached vg viz graph (the third last sample) seems to have a piece missing in first, followed by only first sample and then only two samples.

test

Based on vcf file, all the samples have different ALT alleles so I am not sure why I am seeing the vg vizgraph like this. Is there something wrong that I am seeing this discrepancy? Thank you!

ekg commented 3 years ago

I would expand your context size. Right now it's just one step. You could use -c 10 and get a bigger area around the selected nodes. It's also possible to add -L and then -c represents the number of bp. FWIW, we will probably change the semantics in the future, so that -L takes the length.

On Thu, Jul 15, 2021, 16:54 userzxyz @.***> wrote:

Thank you @ekg https://github.com/ekg @subwaystation https://github.com/subwaystation! I have updated the module and used odgi extract:

odgi build -g sample.fixed.gfa -o sample.og odgi paths -i sample.og -L odgi extract -i sample.og -n 21 -c 1 -o sample_21.og odgi stats -I sample_21.og -S odgi paths -i sample_21.og -L odgi view -i sample_21.og -g > sample_21.gfa vg convert -x -g sample_21.gfa > sample_21.xg vg viz -x sample_21.xg -o sample_21.svg

I wanted to extract a variant based on the node ID (>19>21) from vcf file. The variant position in vcf file shows that all the samples have different ALT alleles for the variant. Based on the attached vg viz graph (the third last sample) seems to have a piece missing in first, followed by only first sample and then only two samples. [image: test] https://user-images.githubusercontent.com/83034841/125808907-6e5f4530-3887-4faf-9a86-ccf4ee66a199.png

Based on vcf file, all the samples have different ALT alleles so I am not sure why I am seeing the vg viz graph like this. Is there something wrong that I am seeing this discrepancy? Thank you!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/vgteam/vg/issues/3340#issuecomment-880761927, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABDQEKM2JYKN55OOJHFLTTTX3ZDNANCNFSM5ADLQMHA .

userzxyz commented 3 years ago

Thank you @ekg! I also see an inconsistency in variant POS and ID. For example,

POS ID
6464 >19>21

When I extract based on ID 19 or 21, the path shows positions: 5184-5267. Why is this inconsistency? Shouldn't it include POS 6464?

All the samples have different paths for this node.

Sample1:5184-5267
Sample2:31075-31250
Sample3:5993-6168
Sample4:4413-4588
Sample5:5310-5485
Sample6:21250-21425
Sample7:4449-4624

Is there a way to extract for same position for all the samples? Thank you!