This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How should recombinant haplotypes from vg haplotypes personalized GBZ be exported as FASTA?

Hello I am using vg 1.74 to extract personalized haplotypes,

I first build the personalized indexes:

vg index -j graph.dist --no-nested-distance graph.gbz vg gbwt -p -r graph.ri -Z graph.gbz vg haplotypes -H graph.hapl graph.gbz

then I do build the personalized gbz graphs :

`vg haplotypes \
--include-reference \
--diploid-sampling \
-i graph.hapl \
-k sample.kff \
-g sample.gbz \
graph.gbz`

When I inspect the paths using vg paths -L -x personalized.gbz

I get outputs like so with different numbers for each chromosomes and varying by sample recombination#1#chr10#0 recombination#2#chr10#0 recombination#1#chr10#1 recombination#2#chr10#1 recombination#1#chr10#2 recombination#2#chr10#2 recombination#1#chr10#3 recombination#1#chr10#4 recombination#2#chr10#3 recombination#1#chr10#5 recombination#2#chr10#4 recombination#1#chr10#6 recombination#2#chr10#5 recombination#1#chr10#7 recombination#1#chr10#8 recombination#2#chr10#6 recombination#2#chr10#7 recombination#1#chr10#9 recombination#2#chr10#8

I wanted to ask 1) what is the recommended ways to reconstruct the recombinant haplotypes into chr length fasta sequences, and 2) are the recombination#1#chr1#N intended to be in concatenated order?

vg

1 answer

You cannot get chromosome-length haplotypes, because you are sampling from a graph with fragmented haplotypes. There are gaps of unknown length between the fragments.

The naming scheme is a generalization of PanSN, with four fields in each name:

  • Sample name
  • Haplotype number
  • Contig name
  • Fragment number

The first three fields define a haplotype, and the fragments of each haplotype should be ordered by the last field. But because there are gaps between the fragments, you cannot simply concatenate them.

To get the sequences for each individual fragment in fasta format, you can use:

vg paths -F -x graph.gbz > out.fa

Log in to answer this question.