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 strings
haps = []
for i in ts.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 call
sequence_IDs = []
for i in range(len(haps)):
sequence_IDs.append(f'sample_{ts.samples()[i]}_pop_{ts.node(i).population}')
# saving the file
with open('Sim_fasta_file.txt', 'w') as f:
for i in range(len(haps)):
f.write(f'>{sequence_IDs[i]}\n{haps[i]}\n')
Very nice. I'm curious, what do you need a fasta of just the variant sites for? We would like to add support for reference sequences but have not.
And, hm: this should really be over in tskit (which deals with tree sequence manipulations), not msprime (which simulates them). Mind moving this over there?
Oops! I meant to put this on tskit.... Thanks...
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 making a table that includes the invariant sites as well. @petrelharp I looked up moving issues but I don't have the admin privileges for the repos to do this - should I just copy there and then close this issue? - I have cloned and closed the issue
Activity
petrelharp commentedon Aug 23, 2019
Very nice. I'm curious, what do you need a fasta of just the variant sites for? We would like to add support for reference sequences but have not.
And, hm: this should really be over in tskit (which deals with tree sequence manipulations), not msprime (which simulates them). Mind moving this over there?
maz-mckellar commentedon Aug 23, 2019
Oops! I meant to put this on tskit.... Thanks...
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 making a table that includes the invariant sites as well.
@petrelharp I looked up moving issues but I don't have the admin privileges for the repos to do this -
should I just copy there and then close this issue?- I have cloned and closed the issuemaz-mckellar commentedon Aug 23, 2019
Kamino closed and cloned this issue to tskit-dev/tskit