Permalink
Browse files

freqs / seqs / entropy json exports are optional

  • Loading branch information...
jameshadfield committed Dec 19, 2017
1 parent bf67f14 commit 46a742c5172c20e97b4b7e7646aaf7b87d0d7089
Showing with 17 additions and 9 deletions.
  1. +2 −1 base/config.py
  2. +11 −5 base/process.py
  3. +3 −3 base/tree.py
  4. +1 −0 builds/zika/zika.process.py
View
@@ -50,7 +50,8 @@
"num_date":{"key":"num_date", "legendTitle":"Sampling date", "menuItem":"date", "type":"continuous"},
"gt":{"key":"genotype", "legendTitle":"Genotype", "menuItem":"genotype", "type":"discrete"}
},
"controls": {}
"controls": {},
"extra_jsons": ["frequencies", "sequences", "entropy"]
},
"clock_filter": {
"n_iqd": 3,
View
@@ -647,15 +647,21 @@ def auspice_export(self):
indent = 2
## ENTROPY (alignment diversity) ##
self.seqs.export_diversity(fname=prefix+'_entropy.json', indent=indent)
if "entropy" in self.config["auspice"]["extra_jsons"]:
self.seqs.export_diversity(fname=prefix+'_entropy.json', indent=indent)
## TREE (includes inferred states, mutations etc) ##
## TREE & SEQUENCES ##
if hasattr(self, 'tree') and self.tree is not None:
self.tree.export(path=prefix, extra_attr = self.config["auspice"]["extra_attr"]
+ ["muts", "aa_muts","attr", "clade"], indent = indent)
self.tree.export(
path = prefix,
extra_attr = self.config["auspice"]["extra_attr"] + ["muts", "aa_muts","attr", "clade"],
indent = indent,
write_seqs_json = "sequences" in self.config["auspice"]["extra_jsons"]
)
## FREQUENCIES ##
export_frequency_json(self, prefix=prefix, indent=indent)
if "frequencies" in self.config["auspice"]["extra_jsons"]:
export_frequency_json(self, prefix=prefix, indent=indent)
## METADATA ##
export_metadata_json(self, prefix=prefix, indent=indent)
View
@@ -484,7 +484,7 @@ def layout(self):
self.dump_attr.extend(['tvalue'])
def export(self, path = '', extra_attr = ['aa_muts', 'clade'], plain_export = 10, indent=None):
def export(self, path = '', extra_attr = ['aa_muts', 'clade'], plain_export = 10, indent=None, write_seqs_json=True):
'''
export the tree data structure along with the sequence information as
json files for display in web browsers.
@@ -525,8 +525,8 @@ def export(self, path = '', extra_attr = ['aa_muts', 'clade'], plain_export = 10
elems[node.clade][prot] = differences
else:
elems[node.clade][prot] = seq
write_json(elems, sequence_fname, indent=indent)
if write_seqs_json:
write_json(elems, sequence_fname, indent=indent)
# if __name__=="__main__":
@@ -37,6 +37,7 @@ def collect_args():
},
"controls": {'authors':['authors']},
"defaults": {'mapTriplicate': True},
"extra_jsons": []
},
"timetree_options": {
"Tc": 'opt',

0 comments on commit 46a742c

Please sign in to comment.