You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a pretty basic file format to output, I have something that works for me but I don't know how to integrate it within tskit, and that'd be nice to do so noting it here for the future. (I'm also happy to do this, but with some direction).
This is what I'm doing for my personal use at the moment:
# the actual haplotype stringshaps= []
foriints.haplotypes():
haps.append(i)
# The ">ID" parts of the fasta format. Don't know what best info to include is, # I'm just using sample index and the population because that's relevant for me. # Possibly people could choose what to include for ID strings in a fasta output function callsequence_IDs= []
foriinrange(len(haps)):
sequence_IDs.append(f'sample_{ts.samples()[i]}_pop_{ts.node(i).population}')
# saving the filewithopen('Sim_fasta_file.txt', 'w') asf:
foriinrange(len(haps)):
f.write(f'>{sequence_IDs[i]}\n{haps[i]}\n')
Note - @petrelharp asked why we need a fasta file of variant sites. The response is that we're using some phylogeny inference software that needs fasta files as input. We're actually making a fasta file that included all the sites, not just the variant ones, since we're first making a table that includes the invariant sites as well (making a tree sequence from that table, ts, then doing this fasta output)
Activity
maz-mckellar commentedon Aug 23, 2019
Note - @petrelharp asked why we need a fasta file of variant sites. The response is that we're using some phylogeny inference software that needs fasta files as input. We're actually making a fasta file that included all the sites, not just the variant ones, since we're first making a table that includes the invariant sites as well (making a tree sequence from that table, ts, then doing this fasta output)
petrelharp commentedon Aug 23, 2019
If you'd like to contribute this, we could help walk you through; the place to start might be to look at how VCF output is done, and copy that?
jeromekelleher commentedon Aug 26, 2019
Thanks for this @marianne-aspbury, I'm happy to help you with the details here. Let's talk about it this week.
Note also we would like to close #50 as well by adding a CLI option (an easy addition).
jeromekelleher commentedon Sep 29, 2020
Closing in favour of #353