Skip to content

Commit

Permalink
export reference annotations in meta json
Browse files Browse the repository at this point in the history
  • Loading branch information
jameshadfield committed Dec 19, 2017
1 parent 2cbe9af commit bf67f14
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions base/auspice_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,21 @@ def summarise_publications_from_tree(tree):
info[authors][attr] = clade.attr[attr]
return (info, mapping)

def extract_annotations(runner):
annotations = {}
for name, prot in runner.proteins.iteritems():
annotations[name] = {
"start": int(prot.start),
"end": int(prot.end),
"strand": prot.strand
}
# nucleotides:
annotations["nuc"] = {
"start": 1,
"end": len(str(runner.reference_seq.seq)) + 1
}
return annotations;

def export_metadata_json(process, prefix, indent):
process.log.notify("Writing out metaprocess")
meta_json = {}
Expand Down Expand Up @@ -92,6 +107,7 @@ def export_metadata_json(process, prefix, indent):
meta_json["title"] = process.info["title"]
meta_json["maintainer"] = process.info["maintainer"]
meta_json["filters"] = process.info["auspice_filters"]
meta_json["annotations"] = extract_annotations(process)

if "defaults" in process.config["auspice"]:
meta_json["defaults"] = process.config["auspice"]["defaults"]
Expand Down

0 comments on commit bf67f14

Please sign in to comment.