Skip to content

Commit

Permalink
doc update for new geocode
Browse files Browse the repository at this point in the history
  • Loading branch information
ktmeaton committed Jul 5, 2020
1 parent 34f4953 commit 407d607
Showing 1 changed file with 69 additions and 33 deletions.
102 changes: 69 additions & 33 deletions docs/exhibit/exhibit_main.rst
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,27 @@ Extract metadata from the SQLite database.
$sqliteDB \
$scriptsDir

Geocode
^^^^^^^

Use the GeoPy module with Nominatim to geocode global addresses.

**Shell Scripts**::

$scriptsDir/geocode_NextStrain.py \
--in-tsv Assembly_Modern/nextstrain/metadata_nextstrain.tsv \
--loc-col BioSampleGeographicLocation \
--out-tsv Assembly_Modern/nextstrain/metadata_nextstrain_geocode_state.tsv\
--out-lat-lon Assembly_Modern/nextstrain/lat_longs_state.tsv \
--div state

$scriptsDir/geocode_NextStrain.py \
--in-tsv Assembly_Modern/nextstrain/metadata_nextstrain.tsv \
--loc-col BioSampleGeographicLocation \
--out-tsv Assembly_Modern/nextstrain/metadata_nextstrain_geocode_state.tsv\
--out-lat-lon Assembly_Modern/nextstrain/lat_longs_state.tsv \
--div state

Combine treetime and augur
^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand All @@ -229,19 +250,16 @@ Activate the nextstrain/treetime environment.
::

conda activate nextstrain-8.0.0
pip install git+git://github.com/ktmeaton/biopython@newickio-comment
pip install git+git://github.com/ktmeaton/treetime@comment-concat

::
Create a time-calibrated phylogeny.

#conda activate nextstrain-8.0.0
conda activate treetime-env
::

# What about mods to biopython and treetime?
mkdir -p $project/nextstrain/treetime_clock/

treetime \
--aln $project/snippy_multi/snippy-core.full_CHROM.filter0.fasta \
--tree $project/iqtree/iqtree.core-filter0.treefile \
--tree $project/iqtree/iqtree.core-filter0_bootstrap.treefile \
--dates $project/nextstrain/metadata_nextstrain.tsv \
--clock-filter 3 \
--keep-root \
Expand All @@ -253,43 +271,61 @@ Activate the nextstrain/treetime environment.
--coalescent skyline \
--covariation \
--outdir $project/nextstrain/treetime_clock \
--date-column BioSampleCollectionDate
--date-column BioSampleCollectionDate \
--verbose 6 2>&1 | tee $project/nextstrain/treetime_clock/treetime_clock.log

Run mugration analysis to estimate biovar variable.

::

mkdir -p $project/nextstrain/treetime_mugration_biovar/

treetime mugration \
--tree treetime_clock/timetree.nexus \
--attribute region \
--states ../data/metadata_treetime.tsv \
--tree $project/nextstrain/treetime_clock/timetree.nexus \
--attribute BioSampleBiovar \
--states $project/nextstrain/metadata_nextstrain.tsv \
--confidence \
--outdir treetime_mugration_region/
--outdir $project/nextstrain/treetime_mugration_biovar/ \
--verbose 6 2>&1 | tee $project/nextstrain/treetime_mugration_biovar/treetime_mugration_biovar.log

Use augur to create the needed json files for auspice.

mkdir -p augur/
mkdir -p auspice/
::

mkdir -p $project/nextstrain/augur/
mkdir -p $project/nextstrain/auspice/

augur refine \
--alignment ../results/aligned.fasta \
--tree treetime_clock/divergence_tree.nexus \
--metadata ../data/metadata_treetime.tsv \
--output-tree augur/augur-refine.nwk \
--output-node-data augur/mutation_length.json \
--alignment $project/snippy_multi/snippy-core.full_CHROM.filter0.fasta \
--tree $project/nextstrain/treetime_clock/divergence_tree.nexus \
--metadata $project/nextstrain/metadata_nextstrain.tsv \
--output-tree $project/nextstrain/augur/augur-refine.nwk \
--output-node-data $project/nextstrain/augur/mutation_lengths.json \
--keep-root

sed -i 's/branch_length/mutation_length/g' augur/mutation_length.json
sed -i 's/branch_length/mutation_length/g' $project/nextstrain/augur/mutation_lengths.json

augur ancestral \
--tree $project/nextstrain/treetime_clock/divergence_tree.nexus \
--alignment $project/snippy_multi/snippy-core.full_CHROM.filter0.fasta \
--output-node-data $project/nextstrain/augur/nt_muts.json

$scriptsDir/treetime_dates_json.py \
--time treetime_clock/timetree.nexus \
--dates treetime_clock/dates.tsv \
--json augur/branch_lengths.json
--time $project/nextstrain/treetime_clock/timetree.nexus \
--dates $project/nextstrain/treetime_clock/dates.tsv \
--json $project/nextstrain/augur/branch_lengths.json

$scriptsDir/treetime_mugration_json.py \
--tree treetime_mugration_region/annotated_tree.nexus \
--json augur/traits_region.json \
--conf treetime_mugration_region/confidence.csv \
--trait region
--tree $project/nextstrain/treetime_mugration_biovar/annotated_tree.nexus \
--json $project/nextstrain/augur/traits_biovar.json \
--conf $project/nextstrain/treetime_mugration_biovar/confidence.csv \
--trait biovar

mkdir -p $project/nextstrain/auspice/

augur export v2 \
--tree augur/augur-refine.nwk \
--metadata ../data/metadata_treetime.tsv \
--node-data augur/nt_muts.json augur/mutation_length.json augur/dates.json augur/traits_region.json \
--lat-longs ../config/lat_longs.tsv \
--auspice-config ../config/auspice_config.json \
--output auspice/auspice.json
--tree $project/nextstrain/augur/augur-refine.nwk \
--metadata $project/nextstrain/metadata_nextstrain_geocode_country.tsv \
--node-data $project/nextstrain/augur/mutation_lengths.json $project/nextstrain/augur/branch_lengths.json augur/traits_biovar.json \
--output $project/nextstrain/auspice/auspice.json \
--lat-long $project/nextstrain/lat_longs_country.tsv

0 comments on commit 407d607

Please sign in to comment.