Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…raphy into master
  • Loading branch information
ktmeaton committed Nov 4, 2020
2 parents 128afeb + 8b54744 commit 553e473
Show file tree
Hide file tree
Showing 13 changed files with 4,902 additions and 0 deletions.
Empty file.
6 changes: 6 additions & 0 deletions results/sqlite_db/yersinia_pestis_db_BioProject.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[2020-11-02 13:31:03.301334] New entry added with ID: 547510.
[2020-11-02 13:31:04.900331] New entry added with ID: 497483.
[2020-11-02 13:31:06.588614] New entry added with ID: 448821.
[2020-11-02 13:31:08.581222] New entry added with ID: 433754.
[2020-11-02 13:31:12.217099] New entry added with ID: 239147.
[2020-11-02 13:31:13.834515] New entry added with ID: 224737.
13 changes: 13 additions & 0 deletions results/sqlite_db/yersinia_pestis_db_BioSample.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[2020-11-02 13:30:40.357343] New entry added with ID: 8349184.
[2020-11-02 13:30:42.794579] New entry added with ID: 8349156.
[2020-11-02 13:30:44.500429] New entry added with ID: 8349060.
[2020-11-02 13:30:46.125036] New entry added with ID: 8349017.
[2020-11-02 13:30:47.684213] New entry added with ID: 8349003.
[2020-11-02 13:30:49.335590] New entry added with ID: 4008146.
[2020-11-02 13:30:50.939612] New entry added with ID: 4008145.
[2020-11-02 13:30:53.096438] New entry added with ID: 4008142.
[2020-11-02 13:30:54.623494] New entry added with ID: 4008141.
[2020-11-02 13:30:56.157898] New entry added with ID: 4008140.
[2020-11-02 13:30:57.711341] New entry added with ID: 4008135.
[2020-11-02 13:30:59.324008] New entry added with ID: 4008128.
[2020-11-02 13:31:01.021463] New entry added with ID: 2665899.
Empty file.
Empty file.
403 changes: 403 additions & 0 deletions results/sqlite_db/yersinia_pestis_db_SRA.log

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
2,916 changes: 2,916 additions & 0 deletions workflow/notebooks/old/treetime_mugration.ipynb

Large diffs are not rendered by default.

1,389 changes: 1,389 additions & 0 deletions workflow/notebooks/old/treetime_rtt.ipynb

Large diffs are not rendered by default.

175 changes: 175 additions & 0 deletions workflow/notebooks/treetime.py.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Treetime Analysis"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Module Imports"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
"from Bio import Phylo\n",
"from treetime.utils import parse_dates\n",
"import pandas"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Input File Paths"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"../../results/iqtree/assembly/iqtree.core-chromosome.filter0.treefile\n",
"../../results/treetime/assembly/metadata.tsv\n"
]
}
],
"source": [
"'''\n",
"tree_path = str(snakemake.input.tree)\n",
"aln_path = str(snakemake.input.snp_aln)\n",
"metadata_path = str(snakemake.input.metadata)\n",
"treetime_path = str(snakemake.output.treetime)\n",
"'''\n",
"\n",
"tree_path = \"../../results/iqtree/assembly/iqtree.core-chromosome.filter0.treefile\"\n",
"metadata_path = \"../../results/treetime/assembly/metadata.tsv\"\n",
"print(tree_path)\n",
"print(metadata_path)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Constants and Variables"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"name_column = \"Accession\"\n",
"dates_column = \"BioSampleCollectionDate\"\n",
"attribute = \"BioSampleBiovar\"\n",
"missing_data = \"?\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Parse Dates"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" Accession BioSampleGeographicLocation \\\n",
"0 GCA_009669545.1_ASM966954v1_genomic USA \n",
"1 GCA_009669555.1_ASM966955v1_genomic USA \n",
"2 GCA_009669565.1_ASM966956v1_genomic USA \n",
"3 Reference USA \n",
"\n",
" BioSampleCollectionDate \n",
"0 2000 \n",
"1 2000 \n",
"2 2000 \n",
"3 2000 \n"
]
}
],
"source": [
"states = pandas.read_csv(metadata_path, sep='\\t')\n",
"if name_column in states.columns:\n",
" taxon_name = name_column\n",
"if attribute in states.columns:\n",
" attr = attribute\n",
"\n",
"# Get tips names\n",
"tree = Phylo.read(tree_path, \"nexus\")\n",
"tree_tip_names = [t.name for t in tree.get_terminals()]"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'treetime_path' is not defined",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-12-3803fc66c3c7>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mwith\u001b[0m \u001b[0mopen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtreetime_path\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"w\"\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mfile\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0;34m...\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mNameError\u001b[0m: name 'treetime_path' is not defined"
]
}
],
"source": [
"with open(treetime_path, \"w\") as file:\n",
" ..."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"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": 4
}

0 comments on commit 553e473

Please sign in to comment.