[med-svn] [Git][med-team/python-treetime][upstream] New upstream version 0.8.5

Andreas Tille (@tille) gitlab at salsa.debian.org
Mon Jan 24 19:11:40 GMT 2022



Andreas Tille pushed to branch upstream at Debian Med / python-treetime


Commits:
1cd12a8d by Andreas Tille at 2022-01-24T20:04:39+01:00
New upstream version 0.8.5
- - - - -


22 changed files:

- .readthedocs.yml
- + Makefile
- README.md
- changelog.md
- + docs/.dockerignore
- + docs/Dockerfile
- docs/Makefile
- + docs/environment.yml
- − docs/requirements.txt
- docs/source/conf.py
- docs/source/gtr.rst
- docs/source/treeanc.rst
- docs/source/tutorials/ancestral.rst
- docs/source/tutorials/clock.rst
- docs/source/tutorials/homoplasy.rst
- docs/source/tutorials/mugration.rst
- docs/source/tutorials/timetree.rst
- treetime/__init__.py
- treetime/seq_utils.py
- treetime/sequence_data.py
- treetime/treeanc.py
- treetime/treetime.py


Changes:

=====================================
.readthedocs.yml
=====================================
@@ -1,25 +1,8 @@
-# .readthedocs.yml
-# Read the Docs configuration file
-# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
-
-# Required
+---
 version: 2
 
-# Build documentation in the docs/ directory with Sphinx
+conda:
+  environment: docs/environment.yml
+
 sphinx:
   configuration: docs/source/conf.py
-
-# Build documentation with MkDocs
-#mkdocs:
-#  configuration: mkdocs.yml
-
-# Optionally build your docs in additional formats such as PDF and ePub
-formats: all
-
-# Optionally set the version of Python and requirements required to build your docs
-python:
-  version: 3.7
-  install:
-    - requirements: docs/requirements.txt
-    - method: pip
-      path: .


=====================================
Makefile
=====================================
@@ -0,0 +1,37 @@
+-include .env.example
+-include .env
+
+export UID=$(shell id -u)
+export GID=$(shell id -g)
+
+export DOCS_CONTAINER_NAME=treetime-docs
+
+SHELL := bash
+.ONESHELL:
+
+.PHONY: docs docker-docs
+
+docs:
+	@$(MAKE) --no-print-directory -C docs/ html
+
+docs-clean:
+	rm -rf docs/build
+
+docker-docs:
+	set -euox
+
+	docker build -t $${DOCS_CONTAINER_NAME} \
+	--network=host \
+	--build-arg UID=$(shell id -u) \
+	--build-arg GID=$(shell id -g) \
+	docs/
+
+	docker run -it --rm \
+	--name=$${DOCS_CONTAINER_NAME}-$(shell date +%s) \
+	--init \
+	--user=$(shell id -u):$(shell id -g) \
+	--volume=$(shell pwd):/home/user/src \
+	--publish=8000:8000 \
+	--workdir=/home/user/src \
+	--env 'TERM=xterm-256colors' \
+	$${DOCS_CONTAINER_NAME}


=====================================
README.md
=====================================
@@ -47,7 +47,7 @@ Have a look at our repository with [example data](https://github.com/neherlab/tr
 
 ### Installation and prerequisites
 
-TreeTime is compatible with Python 3.5 upwards and is tested on 3.5, 3.6, 3.7, and 3.8.  It depends on several Python libraries:
+TreeTime is compatible with Python 3.6 upwards and is tested on 3.6, 3.7, and 3.8.  It depends on several Python libraries:
 
 * numpy, scipy, pandas: for all kind of mathematical operations as matrix
   operations, numerical integration, interpolation, minimization, etc.


=====================================
changelog.md
=====================================
@@ -1,3 +1,9 @@
+# 0.8.5
+ * bug fixes related to edge cases were sequences consist only of missing data
+ * bug fix when the CLI command `treetime` is run without alignment
+ * more robust behavior when parsing biopython alignments (id vs name of sequence records)
+ * drop python 3.5 support
+
 # 0.8.4 -- re-release of 0.8.3.1
 
 # 0.8.3.1 -- bug fix related to Bio.Seq.Seq now bytearray


=====================================
docs/.dockerignore
=====================================
@@ -0,0 +1,2 @@
+*
+!environment.yml


=====================================
docs/Dockerfile
=====================================
@@ -0,0 +1,54 @@
+FROM continuumio/miniconda3:4.10.3
+
+ARG DEBIAN_FRONTEND=noninteractive
+ARG USER=user
+ARG GROUP=user
+ARG UID
+ARG GID
+
+ENV TERM="xterm-256color"
+ENV HOME="/home/user"
+
+RUN set -x \
+  && mkdir -p ${HOME}/src \
+  && \
+    if [ -z "$(getent group ${GID})" ]; then \
+      addgroup --system --gid ${GID} ${GROUP}; \
+    else \
+      groupmod -n ${GROUP} $(getent group ${GID} | cut -d: -f1); \
+    fi \
+  && \
+    if [ -z "$(getent passwd ${UID})" ]; then \
+      useradd \
+        --system \
+        --create-home --home-dir ${HOME} \
+        --shell /bin/bash \
+        --gid ${GROUP} \
+        --groups sudo \
+        --uid ${UID} \
+        ${USER}; \
+    fi \
+  && touch ${HOME}/.hushlogin
+
+RUN set -x \
+  && chown -R ${USER}:${GROUP} ${HOME}
+
+COPY environment.yml ${HOME}/src/
+
+WORKDIR ${HOME}/src
+
+RUN set -x \
+  && conda env create docs
+
+USER ${USER}
+
+RUN set -x \
+  && conda init bash \
+  && echo "conda activate docs" >> ${HOME}/.bashrc
+
+CMD bash -c "set -x \
+  && source ${HOME}/.bashrc \
+  && cd ${HOME}/src/docs \
+  && rm -rf build \
+  && make autobuild \
+  "


=====================================
docs/Makefile
=====================================
@@ -1,230 +1,23 @@
-# Makefile for Sphinx documentation
+# Minimal makefile for Sphinx documentation
 #
 
-# You can set these variables from the command line.
-SPHINXOPTS    =
-SPHINXBUILD   = sphinx-build
-PAPER         =
+# You can set these variables from the command line, and also
+# from the environment for the first two.
+SPHINXOPTS    ?=
+SPHINXBUILD   ?= sphinx-build
+SOURCEDIR     = source
 BUILDDIR      = build
 
-# User-friendly check for sphinx-build
-ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
-	$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don\'t have Sphinx installed, grab it from http://sphinx-doc.org/)
-endif
-
-# Internal variables.
-PAPEROPT_a4     = -D latex_paper_size=a4
-PAPEROPT_letter = -D latex_paper_size=letter
-ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
-# the i18n builder cannot share the environment and doctrees with the others
-I18NSPHINXOPTS  = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
-
-.PHONY: help
+# Put it first so that "make" without argument is like "make help".
 help:
-	@echo "Please use \`make <target>' where <target> is one of"
-	@echo "  html       to make standalone HTML files"
-	@echo "  dirhtml    to make HTML files named index.html in directories"
-	@echo "  singlehtml to make a single large HTML file"
-	@echo "  pickle     to make pickle files"
-	@echo "  json       to make JSON files"
-	@echo "  htmlhelp   to make HTML files and a HTML help project"
-	@echo "  qthelp     to make HTML files and a qthelp project"
-	@echo "  applehelp  to make an Apple Help Book"
-	@echo "  devhelp    to make HTML files and a Devhelp project"
-	@echo "  epub       to make an epub"
-	@echo "  epub3      to make an epub3"
-	@echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
-	@echo "  latexpdf   to make LaTeX files and run them through pdflatex"
-	@echo "  latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
-	@echo "  text       to make text files"
-	@echo "  man        to make manual pages"
-	@echo "  texinfo    to make Texinfo files"
-	@echo "  info       to make Texinfo files and run them through makeinfo"
-	@echo "  gettext    to make PO message catalogs"
-	@echo "  changes    to make an overview of all changed/added/deprecated items"
-	@echo "  xml        to make Docutils-native XML files"
-	@echo "  pseudoxml  to make pseudoxml-XML files for display purposes"
-	@echo "  linkcheck  to check all external links for integrity"
-	@echo "  doctest    to run all doctests embedded in the documentation (if enabled)"
-	@echo "  coverage   to run coverage check of the documentation (if enabled)"
-	@echo "  dummy      to check syntax errors of document sources"
-
-.PHONY: clean
-clean:
-	rm -rf $(BUILDDIR)/*
-
-.PHONY: html
-html:
-	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
-	@echo
-	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
-
-.PHONY: dirhtml
-dirhtml:
-	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
-	@echo
-	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
-
-.PHONY: singlehtml
-singlehtml:
-	$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
-	@echo
-	@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
-
-.PHONY: pickle
-pickle:
-	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
-	@echo
-	@echo "Build finished; now you can process the pickle files."
-
-.PHONY: json
-json:
-	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
-	@echo
-	@echo "Build finished; now you can process the JSON files."
-
-.PHONY: htmlhelp
-htmlhelp:
-	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
-	@echo
-	@echo "Build finished; now you can run HTML Help Workshop with the" \
-	      ".hhp project file in $(BUILDDIR)/htmlhelp."
-
-.PHONY: qthelp
-qthelp:
-	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
-	@echo
-	@echo "Build finished; now you can run "qcollectiongenerator" with the" \
-	      ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
-	@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/TreeTime.qhcp"
-	@echo "To view the help file:"
-	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/TreeTime.qhc"
-
-.PHONY: applehelp
-applehelp:
-	$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
-	@echo
-	@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
-	@echo "N.B. You won't be able to view it unless you put it in" \
-	      "~/Library/Documentation/Help or install it in your application" \
-	      "bundle."
-
-.PHONY: devhelp
-devhelp:
-	$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
-	@echo
-	@echo "Build finished."
-	@echo "To view the help file:"
-	@echo "# mkdir -p $$HOME/.local/share/devhelp/TreeTime"
-	@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/TreeTime"
-	@echo "# devhelp"
-
-.PHONY: epub
-epub:
-	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
-	@echo
-	@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
-
-.PHONY: epub3
-epub3:
-	$(SPHINXBUILD) -b epub3 $(ALLSPHINXOPTS) $(BUILDDIR)/epub3
-	@echo
-	@echo "Build finished. The epub3 file is in $(BUILDDIR)/epub3."
-
-.PHONY: latex
-latex:
-	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
-	@echo
-	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
-	@echo "Run \`make' in that directory to run these through (pdf)latex" \
-	      "(use \`make latexpdf' here to do that automatically)."
-
-.PHONY: latexpdf
-latexpdf:
-	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
-	@echo "Running LaTeX files through pdflatex..."
-	$(MAKE) -C $(BUILDDIR)/latex all-pdf
-	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
-
-.PHONY: latexpdfja
-latexpdfja:
-	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
-	@echo "Running LaTeX files through platex and dvipdfmx..."
-	$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
-	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
-
-.PHONY: text
-text:
-	$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
-	@echo
-	@echo "Build finished. The text files are in $(BUILDDIR)/text."
-
-.PHONY: man
-man:
-	$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
-	@echo
-	@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
-
-.PHONY: texinfo
-texinfo:
-	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
-	@echo
-	@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
-	@echo "Run \`make' in that directory to run these through makeinfo" \
-	      "(use \`make info' here to do that automatically)."
-
-.PHONY: info
-info:
-	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
-	@echo "Running Texinfo files through makeinfo..."
-	make -C $(BUILDDIR)/texinfo info
-	@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
-
-.PHONY: gettext
-gettext:
-	$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
-	@echo
-	@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
-
-.PHONY: changes
-changes:
-	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
-	@echo
-	@echo "The overview file is in $(BUILDDIR)/changes."
-
-.PHONY: linkcheck
-linkcheck:
-	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
-	@echo
-	@echo "Link check complete; look for any errors in the above output " \
-	      "or in $(BUILDDIR)/linkcheck/output.txt."
-
-.PHONY: doctest
-doctest:
-	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
-	@echo "Testing of doctests in the sources finished, look at the " \
-	      "results in $(BUILDDIR)/doctest/output.txt."
-
-.PHONY: coverage
-coverage:
-	$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
-	@echo "Testing of coverage in the sources finished, look at the " \
-	      "results in $(BUILDDIR)/coverage/python.txt."
+	@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
 
-.PHONY: xml
-xml:
-	$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
-	@echo
-	@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
+.PHONY: help Makefile
 
-.PHONY: pseudoxml
-pseudoxml:
-	$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
-	@echo
-	@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
+# 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)
 
-.PHONY: dummy
-dummy:
-	$(SPHINXBUILD) -b dummy $(ALLSPHINXOPTS) $(BUILDDIR)/dummy
-	@echo
-	@echo "Build finished. Dummy builder generates no files."
+autobuild:
+	sphinx-autobuild --host=0.0.0.0 --port=8000 "$(SOURCEDIR)" "$(BUILDDIR)/html"


=====================================
docs/environment.yml
=====================================
@@ -0,0 +1,18 @@
+name: docs
+channels:
+  - defaults
+dependencies:
+  - make
+  - sphinx
+  - pip
+  - pip:
+    - biopython>=1.67,!=1.77,!=1.78
+    - numpy>=1.10.4
+    - pandas>=0.17.1
+    - scipy>=0.16.1
+    - recommonmark>=0.5.0
+    - sphinx-argparse>=0.2.5
+    - sphinx-autobuild
+    - sphinx-markdown-tables
+    - sphinx-rtd-theme
+    - sphinx-tabs


=====================================
docs/requirements.txt deleted
=====================================
@@ -1,2 +0,0 @@
-recommonmark>=0.5.0
-sphinx-argparse>=0.2.5


=====================================
docs/source/conf.py
=====================================
@@ -14,11 +14,13 @@
 
 import sys
 import os
-from treetime import version
+
 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the
 # documentation root, use os.path.abspath to make it absolute, like shown here.
-#sys.path.insert(0, os.path.abspath('.'))
+sys.path.insert(0, os.path.abspath('../..'))
+
+from treetime import version
 
 # -- General configuration ------------------------------------------------
 
@@ -70,7 +72,7 @@ master_doc = 'index'
 
 # General information about the project.
 project = u'TreeTime'
-copyright = u'2017-2019, Pavel Sagulenko and Richard Neher'
+copyright = u'2017-2021, Pavel Sagulenko and Richard Neher'
 author = u'Pavel Sagulenko and Richard Neher'
 
 # The version info for the project you're documenting, acts as replacement for
@@ -130,7 +132,7 @@ todo_include_todos = True
 
 # The theme to use for HTML and HTML Help pages.  See the documentation for
 # a list of builtin themes.
-#html_theme = 'alabaster'
+# html_theme = 'alabaster'
 
 html_theme = 'sphinx_rtd_theme'
 


=====================================
docs/source/gtr.rst
=====================================
@@ -23,7 +23,7 @@ GTR class documentation
 Sequence manipulation
 ---------------------
 
-.. automethod:: treetime.GTR.compress_sequence_pair
+.. automethod:: treetime.GTR.state_pair
 
 Distance and probability computations
 -------------------------------------


=====================================
docs/source/treeanc.rst
=====================================
@@ -42,20 +42,6 @@ Basic functions, utilities, properties
 .. automethod:: treetime.TreeAnc.leaves_lookup()
 
 
-Sequence and profile manipulation
----------------------------------
-
-.. automethod:: treetime.TreeAnc.get_mutations
-
-.. automethod:: treetime.TreeAnc.get_reconstructed_alignment
-
-.. automethod:: treetime.TreeAnc.make_reduced_alignment
-
-.. automethod:: treetime.TreeAnc.expanded_sequence
-
-.. automethod:: treetime.TreeAnc.dict_sequence
-
-
 Ancestral reconstruction and tree optimization
 ----------------------------------------------
 
@@ -67,8 +53,6 @@ Ancestral reconstruction and tree optimization
 
 .. automethod:: treetime.TreeAnc.infer_gtr
 
-.. automethod:: treetime.TreeAnc.get_reconstructed_alignment
-
 .. automethod:: treetime.TreeAnc.get_tree_dict
 
 


=====================================
docs/source/tutorials/ancestral.rst
=====================================
@@ -12,7 +12,7 @@ On the command-line, ancestral reconstruction can be done via the command
 
 This command will save a number of files into the directory `ancestral_results` and generate the output
 
-.. code-block::
+.. code-block:: bash
 
    Inferred GTR model:
    Substitution rate (mu): 1.0


=====================================
docs/source/tutorials/clock.rst
=====================================
@@ -11,7 +11,7 @@ This functionality is implemented as subcommand ``clock``\ :
 
 This command will print the following output:
 
-.. code-block::
+.. code-block:: bash
 
    Root-Tip-Regression:
    --rate:  2.826e-03
@@ -63,7 +63,7 @@ However, these root-to-tip distances are correlated due to shared ancestry no va
 This covariation can be efficiently accounted if the sequence data set is consistent with a simple strict molecular clock model, but can give misleading results when the molecular clock model is violated.
 This feature is hence off by default and can be switched on using the flag
 
-.. code-block::
+.. code-block:: bash
 
    --covariation
 


=====================================
docs/source/tutorials/homoplasy.rst
=====================================
@@ -18,7 +18,7 @@ This command will reconstruct ancestral sequences and count how many time a part
 
 The basic output looks like this:
 
-.. code-block::
+.. code-block:: bash
 
    The TOTAL tree length is 6.617e-02 and 674 mutations were observed.
    Of these 674 mutations,
@@ -31,7 +31,7 @@ This block reports how many times specific mutations, e.g. ``G27A``\ , were obse
 The next output block summarizes how often sites in the sequence are hit by mutations.
 This can be compared to a null expectation that mutations are uniformly and independently distributed along the sequence according to a Poisson distribution with the same number of mutations.
 
-.. code-block::
+.. code-block:: bash
 
    Of the 10807 positions in the genome,
       - 10175 were hit 0 times (expected 10153.59)
@@ -46,7 +46,7 @@ Nonetheless, this can be a useful comparison.
 Lastly, there is a block that highlights mutations that are most homoplasic.
 By default, ``treetime homoplasy`` will list the first 10 mutations -- this behavior can be adjusted using the option ``-n``.
 
-.. code-block::
+.. code-block:: bash
 
    The ten most homoplasic mutations are:
      mut multiplicity
@@ -67,7 +67,7 @@ Additional output
 ``treetime homoplasy`` can be run with the flag ``--detailed`` which will print additional statistics, mostly concerning terminal branches.
 The first extra outputs are on the mutation statistics on terminal branch in analogy to the statistics for the total tree above.
 
-.. code-block::
+.. code-block:: bash
 
    The TERMINAL branch length is 3.962e-02 and 408 mutations were observed.
    Of these 408 mutations,
@@ -86,7 +86,7 @@ The first extra outputs are on the mutation statistics on terminal branch in ana
 Lastly, the script outputs a list of sequences that have many mutations on the terminal branches leading up to them that also occur elsewhere in the tree.
 This is can often be a sign of contamination or other problematic sequence.
 
-.. code-block::
+.. code-block:: bash
 
    Taxons that carry positions that mutated elsewhere in the tree:
      taxon name  #of homoplasic mutations


=====================================
docs/source/tutorials/mugration.rst
=====================================
@@ -24,7 +24,7 @@ Marginal distributions of ancestral states
 If the additional flag ``--confidence`` is added to the command, TreeTime will output a file with the inferred probability of finding an internal node in a particular discrete state.
 A typical output would be
 
-.. code-block::
+.. code-block:: bash
 
    #name     american_samoa  brazil  china   colombia ...
    NODE_00   0.0001          0.0003  0.0002  0        ...
@@ -41,7 +41,7 @@ This results in an underestimate of the transition rates and consequently over-c
 To some extend, this effect can be mitigated in an ad-hoc fashion by manually increasing the transition rate.
 The `mugration` command provides a flag to specify the factor, by which the mugration rate is expected to be underestimated:
 
-.. code-block::
+.. code-block:: bash
 
 	--sampling-bias-correction <float>
 


=====================================
docs/source/tutorials/timetree.rst
=====================================
@@ -14,7 +14,7 @@ TreeTime will attempt to parse dates, preferred formats are are "%Y-%m-%d" or nu
 This command will estimate an GTR model, a molecular clock model, and a time-stamped phylogeny.
 The results are saved to several files in the directory specified as `outdir` and printed to standard out:
 
-.. code-block::
+.. code-block:: bash
 
    Inferred GTR model:
    Substitution rate (mu): 1.0
@@ -80,7 +80,7 @@ However, these root-to-tip distances are correlated due to shared ancestry.
 This can be efficiently accounted if the sequence data set is consistent with a simple strict molecular clock model, but can give misleading results when the molecular clock model is violated.
 This feature is hence off by default and can be switched on using the flag
 
-.. code-block::
+.. code-block:: bash
 
    --covariation
 
@@ -91,7 +91,7 @@ Fixed evolutionary rate
 If the temporal signal in the data is weak and the clock rate can't be estimated confidently from the data, it is advisable to specify the rate explicitly.
 This can be done using the argument
 
-.. code-block::
+.. code-block:: bash
 
    --clock-rate <rate>
 
@@ -104,7 +104,7 @@ The later is parameterized by a time scale 'Tc' which can vary in time.
 This time scale is often called 'effective population size' Ne, but the appropriate Tc has very little to do with census population sizes.
 To activate the Kingman Coalescent model in TreeTime, you need to add the flag
 
-.. code-block::
+.. code-block:: bash
 
     --coalescent <arg>
 


=====================================
treetime/__init__.py
=====================================
@@ -1,5 +1,5 @@
 from __future__ import print_function, division, absolute_import
-version="0.8.4"
+version="0.8.5"
 
 class TreeTimeError(Exception):
     """TreeTimeError class"""


=====================================
treetime/seq_utils.py
=====================================
@@ -189,8 +189,11 @@ def seq2array(seq, word_length=1, convert_upper=False, fill_overhangs=False, amb
     # substitute overhanging unsequenced tails
     if fill_overhangs:
         gaps = np.where(seq_array != '-')[0]
-        seq_array[:gaps[0]] = ambiguous
-        seq_array[gaps[-1]+1:] = ambiguous
+        if len(gaps):
+            seq_array[:gaps[0]] = ambiguous
+            seq_array[gaps[-1]+1:] = ambiguous
+        else:
+            seq_array[:] = ambiguous
 
     return seq_array
 


=====================================
treetime/sequence_data.py
=====================================
@@ -161,9 +161,20 @@ class SequenceData(object):
 
         if type(in_aln) is MultipleSeqAlignment:
             # check whether the alignment is consistent with a nucleotide alignment.
-            self._aln = {s.name: seq2array(s, convert_upper=self.convert_upper,
-                                           fill_overhangs=self.fill_overhangs, ambiguous=self.ambiguous)
-                         for s in in_aln}
+            self._aln = {}
+            for s in in_aln:
+                if s.id==s.name:
+                    tmp_name  = s.id
+                elif '<unknown' in s.id:  # use s.name if id is BioPython default (previous behavior)
+                    tmp_name = s.name
+                elif '<unknown' in s.name:  # use s.id if s.name is BioPython default (change relative to previous, but what we want)
+                    tmp_name = s.id
+                else:
+                    tmp_name = s.name  # otherwise use s.name (previous behavior)
+
+                self._aln[tmp_name] = seq2array(s, convert_upper=self.convert_upper,
+                                               fill_overhangs=self.fill_overhangs, ambiguous=self.ambiguous)
+
             self.check_alphabet(list(self._aln.values()))
             self.is_sparse = False
             self.logger("SequenceData: loaded alignment.",1)


=====================================
treetime/treeanc.py
=====================================
@@ -360,7 +360,7 @@ class TreeAnc(object):
         in the alignment and assign this sequence as a character array
         '''
         if len(self.tree.get_terminals()) != len(self.data.aln):
-            self.logger("**WARNING: Number of tips in tree differs from number of sequences in alignment!**", 3, warn=True)
+            self.logger(f"**WARNING: Number of tips in tree ({len(self.tree.get_terminals())}) differs from number of sequences in alignment ({len(self.data.aln)})**", 3, warn=True)
         failed_leaves= 0
 
         # loop over leaves and assign multiplicities of leaves (e.g. number of identical reads)


=====================================
treetime/treetime.py
=====================================
@@ -824,8 +824,8 @@ class TreeTime(ClockTree):
             'Sample'     : niter,
             'ndiff'      : ndiff,
             'n_resolved' : n_resolved,
-            'seq_mode'   : 'marginal' if sequence_marginal else 'joint',
-            'seq_LH'     : self.tree.sequence_marginal_LH if sequence_marginal else self.tree.sequence_joint_LH,
+            'seq_mode'   : ('marginal' if sequence_marginal else 'joint') if self.aln else 'no sequences given',
+            'seq_LH'     : (self.tree.sequence_marginal_LH if sequence_marginal else self.tree.sequence_joint_LH) if self.aln else 0,
             'pos_mode'   : 'marginal' if time_marginal else 'joint',
             'pos_LH'     : self.tree.positional_marginal_LH if time_marginal else self.tree.positional_joint_LH,
             'coal_mode'  : Tc,
@@ -982,8 +982,9 @@ def plot_vs_years(tt, step = None, ax=None, confidence=None, ticks=True, **kwarg
             raise NotReadyError("confidence needs to be either a float (for max posterior region) or a two numbers specifying lower and upper bounds")
 
         for n in tt.tree.find_clades():
-            pos = cfunc(n, confidence)
-            ax.plot(pos-offset, np.ones(len(pos))*n.ypos, lw=3, c=(0.5,0.5,0.5))
+            if not n.bad_branch:
+                pos = cfunc(n, confidence)
+                ax.plot(pos-offset, np.ones(len(pos))*n.ypos, lw=3, c=(0.5,0.5,0.5))
     return fig, ax
 
 def treetime_to_newick(tt, outf):



View it on GitLab: https://salsa.debian.org/med-team/python-treetime/-/commit/1cd12a8d3f5353000dfe384f7f3a9ee984632181

-- 
View it on GitLab: https://salsa.debian.org/med-team/python-treetime/-/commit/1cd12a8d3f5353000dfe384f7f3a9ee984632181
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20220124/4ef39bde/attachment-0001.htm>


More information about the debian-med-commit mailing list