Skip to content
Permalink
Browse files

Merge branch 'docs'

  • Loading branch information...
tsibley committed May 29, 2019
2 parents 801b3a9 + a879122 commit 473396140868aee2093c553dcee7ebacc9e4a41d
@@ -14,6 +14,7 @@ build/
dist/
.snakemake
*stderr
/docs/_build/

# For Python #
##############
@@ -0,0 +1,22 @@
Alli Black <black.alli@gmail.com>
Barney Potter <barney.potter.24@gmail.com>
Emma Hodcroft <emmahodcroft@gmail.com>
Emma Hodcroft <freezefire666@yahoo.com>
Gytis Dudas <gytisdudas@gmail.com>
James Hadfield <jameshadfield@users.noreply.github.com>
James Hadfield <jh22@sanger.ac.uk>
James Hadfield <jh22@sanger.ac.uk>
John Huddleston <huddlej@gmail.com>
Louise Moncla <lhmoncla@gmail.com>
Richard Neher <neher@login10.cluster.bc2.ch>
Richard Neher <neher@login11.cluster.bc2.ch>
Richard Neher <neher@login20.cluster.bc2.ch>
Richard Neher <richard.neher@tuebingen.mpg.de>
Richard Neher <richard.neher@tuebingen.mpg.de>
Richard Neher <richard.neher@unibas.ch>
Sarah Murata <sarah.d.murata@gmail.com>
Sidney Bell <sidneymb@uw.edu>
Sidney Bell <sidneymbell@users.noreply.github.com>
Thomas Sibley <tsibley@fredhutch.org>
Trevor Bedford <trevor@bedford.io>
Trevor Bedford <trvrb@trevorbedford.com>
@@ -0,0 +1,9 @@
---
version: 2
python:
version: 3.6
install:
- method: pip
path: .
extra_requirements:
- dev
@@ -151,6 +151,34 @@ build to keep the Docker image up-to-date.

[docker-base]: https://github.com/nextstrain/docker-base

### Building documentation

[Documentation](https://nextstrain-augur.readthedocs.io) is built using [Sphinx](http://sphinx-doc.org/) and hosted on [Read The Docs](https://readthedocs.org/).
Versions of the documentation for each augur release and git branch are available and preserved.

Building the documentation locally is useful to test changes.
First, make sure you have the development dependencies of augur installed:

pip install '.[dev]'

This installs packages listed in the `dev` section of `extras_require` in _setup.py_ (in addition to any normal augur dependencies if necessary).

Then build the HTML output format by running:

make -C docs html

You can see other available formats by running:

make -C docs help

To update the API documentation after adding or removing an augur submodule, autogenerate a new API file as follows.

sphinx-apidoc -T -f -MeT -o docs augur

Sphinx caches built documentation by default, which is generally great, but can cause the sidebar of pages to be stale. You can clean out the cache with:

make -C docs clean

## License and copyright

Copyright 2014-2019 Trevor Bedford and Richard Neher.
@@ -36,7 +36,7 @@
]


def run(argv):
def make_parser():
parser = argparse.ArgumentParser(
prog = "augur",
description = "Augur: A bioinformatics toolkit for phylogenetic analysis.")
@@ -62,7 +62,11 @@ def run(argv):
# Set here to avoid repeating it in every command's register_parser().
subparser.formatter_class = argparse.ArgumentDefaultsHelpFormatter

args = parser.parse_args(argv)
return parser


def run(argv):
args = make_parser().parse_args(argv)
return args.__command__.run(args)


@@ -15,6 +15,7 @@ def convert_tree_to_json_structure(node, metadata, div=0, nextflu_schema=False,
converts the Biopython tree structure to a dictionary that can
be written to file as a json. This is called recursively.
Creates the strain property & divergence on each node
input
node -- node for which top level dict is produced.
div -- cumulative divergence (root = 0)
@@ -98,40 +98,52 @@ def mutation_struct():
def read_in_features(drm_file):
'''
Reads in and stores position, alt base/AA, feature, gene,
and 'display name' (optional) of mutations such
and 'display name' (optional) of mutations such
as drug-resistance mutations
Format to map by both nucleotide and AA sites:
----------------------------------------------
GENE SITE ALT DISPLAY_NAME FEATURE
gyrB 461 N Fluoroquinolones
nuc 1472358 T rrs: C513T Streptomycin
nuc 1673425 T fabG1: C-15T Isoniazid Ethionamide
ethA 175 T Ethionamide
==== ======= === ============ =====================
GENE SITE ALT DISPLAY_NAME FEATURE
==== ======= === ============ =====================
gyrB 461 N Fluoroquinolones
nuc 1472358 T rrs: C513T Streptomycin
nuc 1673425 T fabG1: C-15T Isoniazid Ethionamide
ethA 175 T Ethionamide
==== ======= === ============ =====================
Format to map by AA site:
-------------------------
GENE SITE ALT FEATURE
gyrB 461 N Fluoroquinolones
gyrB 499 D Fluoroquinolones
rpoB 170 F Rifampicin
rpoB 359 A Rifampicin
==== ==== === ================
GENE SITE ALT FEATURE
==== ==== === ================
gyrB 461 N Fluoroquinolones
gyrB 499 D Fluoroquinolones
rpoB 170 F Rifampicin
rpoB 359 A Rifampicin
==== ==== === ================
Format to map by nucleotide site:
-----------------------------------
SITE ALT DISPLAY_NAME FEATURE
6505 T D461N Fluoroquinolones
6505 C D461N Fluoroquinolones
760314 T V170F Rifampicin
760882 C V359A Rifampicin
or to map by nucleotide site and display mutations:
---------------------------------------------------
SITE ALT FEATURE
====== === ============ ================
SITE ALT DISPLAY_NAME FEATURE
====== === ============ ================
6505 T D461N Fluoroquinolones
6505 C D461N Fluoroquinolones
760314 T V170F Rifampicin
760882 C V359A Rifampicin
====== === ============ ================
Or to map by nucleotide site and display mutations:
====== === ================
SITE ALT FEATURE
====== === ================
6505 T Fluoroquinolones
6505 C Fluoroquinolones
760314 T Rifampicin
760882 C Rifampicin
760314 T Rifampicin
760882 C Rifampicin
====== === ================
Parameters
----------
@@ -235,8 +247,8 @@ def annotate_strains(all_features, all_sequences):
def attach_features(annotations, label, count):
'''
'Attaches' features to nodes and lists the corresponding mutations
as values, that is
>>>
as values, that is:
{nodename:{"Resistance 1":"mut1,mut2", "Resistance 2":"mut1"}}
Parameters
@@ -80,12 +80,21 @@ def safe_translate(sequence, report_exceptions=False):

def translate_feature(aln, feature):
'''
translates a subsequence of input nucleotide sequences
input:
aln -- dictionary of sequences indexed by node name
feature -- Biopython sequence feature
returns:
dictionary of translated sequences indexed by node name
Translates a subsequence of input nucleotide sequences.
Parameters
----------
aln : dict
sequences indexed by node name
feature : Bio.Seq.Seq
BioPython sequence feature
Returns
-------
dict :
translated sequences indexed by node name
'''
translations = {}
for sname, seq in aln.items():
@@ -96,16 +105,25 @@ def translate_feature(aln, feature):


def translate_vcf_feature(sequences, ref, feature):
'''
translates a subsequence of input nucleotide sequences
input:
sequences -- TreeTime format dictionary from VCF-input of sequences
indexed by node name
ref -- reference alignment the VCF was mapped to
feature -- Biopython sequence feature
returns:
dictionary giving the translated reference gene, positions of AA differences,
and AA differences indexed by node name
'''Translates a subsequence of input nucleotide sequences.
Parameters
----------
sequences : dict
TreeTime format dictionary from VCF-input of sequences indexed by node name
ref :
reference alignment the VCF was mapped to
feature : Bio.Seq.Seq
BioPython sequence feature
Returns
-------
dict :
translated reference gene, positions of AA differences, and AA
differences indexed by node name
'''
def str_reverse_comp(str_seq):
#gets reverse-compliment of a string and returns it as a string
@@ -0,0 +1,19 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
No changes.
@@ -0,0 +1,8 @@
==========
Python API
==========

.. toctree::
:maxdepth: 4

augur
@@ -0,0 +1,7 @@
augur.align module
==================

.. automodule:: augur.align
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
augur.ancestral module
======================

.. automodule:: augur.ancestral
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
augur.clades module
===================

.. automodule:: augur.clades
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
augur.distance module
=====================

.. automodule:: augur.distance
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
augur.export module
===================

.. automodule:: augur.export
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
augur.filenames module
======================

.. automodule:: augur.filenames
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
augur.filter module
===================

.. automodule:: augur.filter
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
augur.frequencies module
========================

.. automodule:: augur.frequencies
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
augur.frequency\_estimators module
==================================

.. automodule:: augur.frequency_estimators
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
augur.lbi module
================

.. automodule:: augur.lbi
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
augur.mask module
=================

.. automodule:: augur.mask
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
augur.parse module
==================

.. automodule:: augur.parse
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
augur.reconstruct\_sequences module
===================================

.. automodule:: augur.reconstruct_sequences
:members:
:undoc-members:
:show-inheritance:

0 comments on commit 4733961

Please sign in to comment.
You can’t perform that action at this time.