[med-svn] [Git][med-team/python-treetime][upstream] New upstream version 0.9.2
Andreas Tille (@tille)
gitlab at salsa.debian.org
Thu Aug 25 16:51:10 BST 2022
Andreas Tille pushed to branch upstream at Debian Med / python-treetime
Commits:
e36c5bd1 by Andreas Tille at 2022-08-25T17:46:58+02:00
New upstream version 0.9.2
- - - - -
8 changed files:
- changelog.md
- setup.py
- treetime/__init__.py
- bin/treetime → treetime/__main__.py
- treetime/argument_parser.py
- treetime/sequence_data.py
- treetime/vcf_utils.py
- treetime/wrappers.py
Changes:
=====================================
changelog.md
=====================================
@@ -1,3 +1,9 @@
+# 0.9.2
+bug fix release:
+ * CLI now works for windows (thanks @corneliusroemer for the fix)
+ * fixes vcf parsing. haploid no-calls were not properly parsed and treated as reference (thanks @jodyphelan for the issue).
+ * fix file names in CLI output. (thanks @gtonkinhill)
+
# 0.9.1
This release is mostly a bug-fix release and contains some additional safeguards against unwanted side-effects of greedy polytomy resolution.
=====================================
setup.py
=====================================
@@ -36,13 +36,19 @@ setup(
':python_version >= "3.6"':['matplotlib>=2.0'],
},
classifiers=[
- "Development Status :: 3 - Alpha",
+ "Development Status :: 5 - Production/Stable",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"License :: OSI Approved :: MIT License",
- "Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
- "Programming Language :: Python :: 3.8"
+ "Programming Language :: Python :: 3.8",
+ "Programming Language :: Python :: 3.9",
+ "Programming Language :: Python :: 3.10",
],
- scripts=['bin/treetime']
+ entry_points = {
+ "console_scripts": [
+ "treetime = treetime.__main__:main",
+ ]
+ }
)
+
=====================================
treetime/__init__.py
=====================================
@@ -1,4 +1,4 @@
-version="0.9.1"
+version="0.9.2"
class TreeTimeError(Exception):
"""TreeTimeError class"""
=====================================
bin/treetime → treetime/__main__.py
=====================================
@@ -1,14 +1,30 @@
#!/usr/bin/env python
+"""
+Stub function and module used as a setuptools entry point.
+Based on augur's __main__.py and setup.py
+"""
+
from __future__ import print_function, division, absolute_import
import sys
from treetime import version, make_parser
-import matplotlib
-matplotlib.use('AGG')
-if __name__ == '__main__':
+
+# Entry point for setuptools-installed script and bin/augur dev wrapper.
+def main():
parser = make_parser()
params = parser.parse_args()
+
+ # Import matplotlib after parsing cli args
+ # to speed up time till error if there's an arg error
+ import matplotlib
+ matplotlib.use("AGG")
+
return_code = params.func(params)
sys.exit(return_code)
+
+
+# Run when called as `python -m treetime`, here for good measure.
+if __name__ == "__main__":
+ main()
=====================================
treetime/argument_parser.py
=====================================
@@ -135,7 +135,7 @@ def add_reroot_group(parser):
"the residual of the regression of root-to-tip distance and sampling time")
parser.add_argument('--tip-slack', type=float, default=3,
help="excess variance associated with terminal nodes accounting for "
- " overdisperion of the molecular clock")
+ " overdispersion of the molecular clock")
parser.add_argument('--covariation', action='store_true', help="Account for covariation when estimating rates "
"or rerooting using root-to-tip regression, default False.")
@@ -155,7 +155,7 @@ def add_anc_arguments(parser):
parser.add_argument('--reconstruct-tip-states', default = False, action='store_true', help='overwrite ambiguous states on tips with the most likely inferred state')
parser.add_argument('--report-ambiguous', default=False, action="store_true", help='include transitions involving ambiguous states')
parser.add_argument('--method-anc', default='probabilistic', type=str, choices = ['parsimony', 'fitch', 'probabilistic', 'ml'],
- help="method uesed for reconstructing ancestral sequences, default is 'probabilistic'")
+ help="method used for reconstructing ancestral sequences, default is 'probabilistic'")
def add_common_args(parser):
=====================================
treetime/sequence_data.py
=====================================
@@ -467,7 +467,6 @@ class SequenceData(object):
"""
if self.ref is None:
raise TypeError("SequenceData: sparse sequences can only be constructed when a reference sequence is defined")
- sparse_seq = {}
compressed_nonref_positions = self.full_to_compressed_sequence_map[self.nonref_positions]
compressed_nonref_values = sequence[compressed_nonref_positions]
=====================================
treetime/vcf_utils.py
=====================================
@@ -105,7 +105,6 @@ def read_vcf(vcf_file, ref_file=None):
#Parses a 'normal' (not hetero or no-call) call depending if insertion+deletion, insertion,
#deletion, or single bp subsitution
def parseCall(snps, ins, pos, ref, alt):
-
#Insertion where there are also deletions (special handling)
if len(ref) > 1 and len(alt)>len(ref):
for i in range(len(ref)):
@@ -209,8 +208,14 @@ def read_vcf(vcf_file, ref_file=None):
gt = sa.split(':')[0]
else: #if 'pseudo' VCF file (nextstrain output, or otherwise stripped)
gt = sa
- if gt == '0' or gt == '1': #for haploid calls in VCF
- gt = '0/0' if gt == '0' else '1/1'
+
+ # convert haploid calls to pseudo diploid
+ if gt == '0':
+ gt = '0/0'
+ elif gt == '1':
+ gt = '1/1'
+ elif gt == '.':
+ gt = './.'
#ignore if ref call: '.' or '0/0', depending on VCF
if ('/' in gt and gt != '0/0') or ('|' in gt and gt != '0|0'):
=====================================
treetime/wrappers.py
=====================================
@@ -162,7 +162,7 @@ def plot_rtt(tt, fname):
def export_sequences_and_tree(tt, basename, is_vcf=False, zero_based=False,
report_ambiguous=False, timetree=False, confidence=False,
- reconstruct_tip_states=False, tree_suffix={}):
+ reconstruct_tip_states=False, tree_suffix=''):
seq_info = is_vcf or tt.aln
if is_vcf:
outaln_name = basename + f'ancestral_sequences{tree_suffix}.vcf'
View it on GitLab: https://salsa.debian.org/med-team/python-treetime/-/commit/e36c5bd12934949fd1913d60703d12639e8d8d60
--
View it on GitLab: https://salsa.debian.org/med-team/python-treetime/-/commit/e36c5bd12934949fd1913d60703d12639e8d8d60
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/20220825/c62d34e9/attachment-0001.htm>
More information about the debian-med-commit
mailing list