Skip to content

Commit

Permalink
Merge branch 'titered-strains-only'
Browse files Browse the repository at this point in the history
  • Loading branch information
sidneymbell committed Jan 5, 2019
1 parent 803f3a6 commit af3367f
Show file tree
Hide file tree
Showing 19 changed files with 6,080 additions and 499,891 deletions.
47 changes: 47 additions & 0 deletions data/sequences/titered_strains.txt
@@ -0,0 +1,47 @@
DENV4/PUERTO_RICO/BIDV2446/1999
DENV3/NICARAGUA/BIDV4753/2009
DENV2/BRAZIL/BR161/2004
DENV4/BRAZIL/NA/2012
DENV4/MALAYSIA/P731120/1973
DENV4/PUERTO_RICO/347751/1998
DENV4/THAILAND/D85052/1985
DENV4/MYANMAR/81087/2008
DENV2/INDIA/742295/1974
DENV3/CAMBODIA/AC23/2011
DENV2/VIETNAM/AC20/2003
DENV1/MYANMAR/61117/2005
DENV1/PERU/IQT6152/2000
DENV2/PAPUANEWGUINEA/NEWGUINEAC/1944
DENV3/VIETNAM/BIDV1329/2006
DENV3/MYANMAR/80931/2008
DENV1/PUERTO_RICO/BIDV852/2006
DENV3/PUERTO_RICO/429965/2006
DENV2/NICARAGUA/BIDV571/2006
DENV3/FIJI/29472/1992
DENV1/BOLIVIA/FSB3363/2010
DENV2/VIETNAM/AC21/2003
DENV2/GUYANA/08221/2000
DENV2/MALAYSIA/DKD811/2008
DENV1/THAILAND/16007/1964
DENV3/VIETNAM/BIDV1817/2007
DENV1/VENEZUELA/OBT1298/2000
DENV2/CAMBODIA/BIDV4265/2007
DENV1/CAMBODIA/BIDV1995/2003
DENV3/INDONESIA/SLEMANDELTA30/1978
DENV2/CAMBODIA/D2T0601085/2009
DENV3/PUERTO_RICO/S228762/1963
DENV2/SENEGAL/0674/1970
DENV4/DOMINICA/814669DELTA30/1981
DENV2/PERU/IQT2913/1996
DENV2/NICARAGUA/BIDV533/2005
DENV4/CAMBODIA/AC33/2011
DENV1/CAMBODIA/BIDV1991/2003
DENV1/NAURU/WESTERNPACIFICDELTA30/1974
DENV2/CAMBODIA/BIDV3924/2008
DENV4/INDONESIA/AC36/1973
DENV1/VIETNAM/BIDV1937/2008
DENV4/NICARAGUA/703/1999
DENV2/VIETNAM/BIDV735/2006
DENV4/CAMBODIA/NA/2010
DENV2/TONGA/DELTA30/1974
DENV4/INDONESIA/S1228/1978
88 changes: 0 additions & 88 deletions data/trees/collapsed_antigenic_tree_figtree.nexus

This file was deleted.

1 change: 0 additions & 1 deletion data/trees/dengue.newick

This file was deleted.

4 changes: 0 additions & 4 deletions data/trees/full_titer_tree.nexus

This file was deleted.

4 changes: 0 additions & 4 deletions data/trees/genotype_tree.nexus

This file was deleted.

4 changes: 0 additions & 4 deletions data/trees/interserotype_titer_tree.nexus

This file was deleted.

215 changes: 215 additions & 0 deletions data/trees/root-to-tip.ipynb

Large diffs are not rendered by default.

233 changes: 0 additions & 233 deletions data/trees/subtree-rooting.ipynb

This file was deleted.

1,081 changes: 0 additions & 1,081 deletions data/trees/tip_distances.csv

This file was deleted.

86 changes: 70 additions & 16 deletions figures/substitution-model-performance.ipynb

Large diffs are not rendered by default.

Expand Up @@ -134,15 +134,15 @@ def export_metadata_json(process, prefix, indent):
if "defaults" in process.config["auspice"]:
meta_json["defaults"] = process.config["auspice"]["defaults"]

try:
from pygit2 import Repository, discover_repository
current_working_directory = os.getcwd()
repository_path = discover_repository(current_working_directory)
repo = Repository(repository_path)
commit_id = repo[repo.head.target].id
meta_json["commit"] = str(commit_id)
except ImportError:
meta_json["commit"] = "unknown"
# try:
# from pygit2 import Repository, discover_repository
# current_working_directory = os.getcwd()
# repository_path = discover_repository(current_working_directory)
# repo = Repository(repository_path)
# # commit_id = repo[repo.head.target].id
# # meta_json["commit"] = str(commit_id)
# except ImportError:
# meta_json["commit"] = "unknown"
if len(process.config["auspice"]["controls"]):
meta_json["controls"] = process.make_control_json(process.config["auspice"]["controls"])
meta_json["geo"] = process.lat_longs
Expand Down
Expand Up @@ -252,7 +252,7 @@ def write_json(self, fh, config, prefix):
data["info"] = {
"n(starting)": self.nstart,
"n(final)": len(self.seqs),
"commit": git.Repo(search_parent_directories=True).head.object.hexsha,
# "commit": git.Repo(search_parent_directories=True).head.object.hexsha,
"date_format": config["date_format"],
"subsampled": bool(config["subsample"]),
"traits_are_dates": [],
Expand Down
Expand Up @@ -80,7 +80,7 @@ def make_config(serotype, params):
file_prefix = "dengue_%s" % serotype

if params.sequences is not None:
input_paths = [params.sequences]
input_paths = params.sequences
elif os.path.isfile("../../../../data/sequences/dengue_%s.fasta"%serotype): #is file: # Look for a serotype-specific fasta
input_paths = ["../../../../data/sequences/dengue_%s.fasta"%serotype]
else: # If it doesn't exist, try to pull serotype-specific sequences out of the all-serotype fasta (warn the user of this behavior)
Expand Down Expand Up @@ -109,12 +109,12 @@ def make_config(serotype, params):
"input_paths": input_paths,
"header_fields": {0:'strain', 1:'accession', 2:'date', 3:'region', 4:'country',
5:'division', 6: 'location', 7: 'authors', 8: 'url'},
"filters": (("Dropped Strains", lambda s: s.id not in [fix_names(x) for x in dropped_strains]),
("Bad Region", lambda s: any([
s.attributes['region'] not in ['', ' ', '?'],
s.attributes['accession'] in force_include,
s.attributes['strain'] in force_include
]))),
"filters": (),#("Dropped Strains", lambda s: s.id not in [fix_names(x) for x in dropped_strains]),
# ("Bad Region", lambda s: any([
# s.attributes['region'] not in ['', ' ', '?'],
# s.attributes['accession'] in force_include,
# s.attributes['strain'] in force_include
# ]))),

"subsample": dengue_subsampling(params, years_back, titer_values,
force_include),
Expand Down
Expand Up @@ -123,10 +123,17 @@ def is_interserotype(node):
for sero, mrca in serotype_mrcas.items():
for k in mrca.find_clades(): # pull all descendants (nodes and tips) of the serotype mrca
k.sequence = mrca.sequence # set sequence of each descendant to the reconstructed ancestral sequence from the serotype mrca

k.translations = mrca.translations
k.aa_mutations = {}
runner.tree.add_translations() # translate and reassign mutations to each branch
runner.tree.refine()

for sero, mrca in serotype_mrcas.items():
for k in mrca.find_clades(): # pull all descendants (nodes and tips) of the serotype mrca
if k == mrca: continue
assert ''.join(k.sequence) == ''.join(mrca.sequence)
assert k.translations['E'] == mrca.translations['E']
assert len(k.aa_mutations['E']) == 0
titer_model(runner, ## Run 10x with a 90:10 training:test split to estimate model performance / error
lam_pot = runner.config['titers']['lam_pot'],
lam_avi = runner.config['titers']['lam_avi'],
Expand Down

0 comments on commit af3367f

Please sign in to comment.