Skip to content

Commit

Permalink
checkpoint before notebook overhaul
Browse files Browse the repository at this point in the history
  • Loading branch information
ktmeaton committed Feb 23, 2021
1 parent 541b953 commit 0b2c710
Show file tree
Hide file tree
Showing 43 changed files with 8,905 additions and 168,253 deletions.
9,214 changes: 56 additions & 9,158 deletions auspice/plague-phylogeography_parse-tree.json

Large diffs are not rendered by default.

File renamed without changes.
8 changes: 8 additions & 0 deletions docs/results/latest/timetree/old/timetree.nexus

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/results/latest/timetree/old/timetree.nwk

Large diffs are not rendered by default.

1,262 changes: 1,262 additions & 0 deletions docs/results/latest/timetree/old/timetree.tsv

Large diffs are not rendered by default.

3,940 changes: 3,940 additions & 0 deletions docs/results/latest/timetree/old/timetree.xml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/results/latest/timetree/timetree.nexus

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/results/latest/timetree/timetree.nwk

Large diffs are not rendered by default.

2,524 changes: 1,262 additions & 1,262 deletions docs/results/latest/timetree/timetree.tsv

Large diffs are not rendered by default.

3,426 changes: 1,713 additions & 1,713 deletions docs/results/latest/timetree/timetree.xml

Large diffs are not rendered by default.

76 changes: 76 additions & 0 deletions workflow/notebooks/2_clock_model.py.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "growing-level",
"metadata": {},
"source": [
"# Objectives\n",
"\n",
"1. Filter Outlier Tips\n",
"1. Estimate a Clock Model"
]
},
{
"cell_type": "markdown",
"id": "senior-russell",
"metadata": {},
"source": [
"# 1. Filter Outlier Tips"
]
},
{
"cell_type": "markdown",
"id": "unavailable-concentrate",
"metadata": {},
"source": [
"## Parse Tip Dates"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "appointed-singer",
"metadata": {},
"outputs": [],
"source": [
"# Use the utils function to parse the metadata dates\n",
"dates_raw = treetime.utils.parse_dates(metadata_path, \n",
" date_col=DATE_COL, \n",
" name_col = NAME_COL)\n",
"\n",
"# Remove nan elements (internal nodes)\n",
"dates = {}\n",
"for k,v in dates_raw.items():\n",
" if type(v) == list:\n",
" dates[k] = v\n",
" elif not pd.isnull(v):\n",
" dates[k] = v\n",
" \n",
"# Add Reference\n",
"dates[\"Reference\"] = REF_DATE"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
17 changes: 15 additions & 2 deletions workflow/notebooks/3_mugration.py.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@
"\n",
"import matplotlib.pyplot as plt\n",
"from matplotlib import colors, lines, patches, gridspec\n",
"import seaborn as sns"
"import seaborn as sns\n",
"\n",
"import pickle"
]
},
{
Expand Down Expand Up @@ -1659,6 +1661,13 @@
" # Export\n",
" out_path = os.path.join(outdir, SCRIPT_NAME + \"_tree_{}.{}\".format(attr.lower(), FMT)) \n",
" plt.savefig(out_path, dpi=dpi, bbox_inches = \"tight\")\n",
" \n",
" # Save Tree!\n",
" out_path_pickle_tree = os.path.join(outdir, SCRIPT_NAME + \"_{}.phylo.obj\".format(attr.lower()))\n",
" with open(out_path_pickle_tree,\"wb\") as outfile:\n",
" dill.dump(tree_div, outfile)\n",
" \n",
" \n",
"\n",
"file_colors.close()"
]
Expand Down Expand Up @@ -1686,7 +1695,11 @@
"source": [
"# Save tree dataframe with mugration info\n",
"out_path_df = os.path.join(outdir, SCRIPT_NAME + \".tsv\" )\n",
"tree_df.to_csv(out_path_df, sep=\"\\t\")"
"out_path_pickle_df = os.path.join(outdir, SCRIPT_NAME + \".df.obj\" )\n",
"\n",
"tree_df.to_csv(out_path_df, sep=\"\\t\")\n",
"with open(out_path_pickle_df,\"wb\") as outfile:\n",
" dill.dump(tree_df, outfile)"
]
},
{
Expand Down
Loading

0 comments on commit 0b2c710

Please sign in to comment.