commonnexus 1.9.1__py2.py3-none-any.whl → 1.9.3__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
commonnexus/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  from .nexus import Nexus, Config # noqa: F401
2
2
  from commonnexus.blocks import Block # noqa: F401
3
3
 
4
- __version__ = '1.9.1'
4
+ __version__ = '1.9.3'
@@ -549,10 +549,15 @@ class Charstatelabels(Payload):
549
549
  if isinstance(w, Token) and w.text == '/':
550
550
  in_states = True
551
551
  continue
552
+ if name:
553
+ raise ValueError(
554
+ 'Illegal token in charstatelabel: "{}{}"'.format(name, w))
552
555
  name = w
553
556
  except StopIteration:
554
557
  break
555
558
  if num:
559
+ if name and name in names:
560
+ duplicate_charlabel(name, 'CHARSTATELABELS', nexus)
556
561
  self.characters.append(types.SimpleNamespace(number=num, name=name, states=states))
557
562
  elif comma: # There was a comma, but no new label.
558
563
  warnings.warn('Trailing comma in CHARSTATELABELS command')
@@ -127,6 +127,25 @@ class Tree(Payload):
127
127
  NEXUS comment commands. The NEXUS standard places no restrictions on the number of taxa
128
128
  contained in each tree.
129
129
 
130
+ Sometimes, trees are annotated with additional information in a NEXUS comment such as
131
+
132
+ .. code-block::
133
+
134
+ TREE tree1 = [&R] [&clockrate=9.118820e-04] ((beetle,fly),spider);
135
+
136
+ Since comments may appear anywhere in NEXUS, this is valid content. However, such comments have
137
+ no semantics whatsoever; in particular they do not "belong" to any object, be it the Newick
138
+ tree or the NEXUS TREE wrapper. Instead, they are just added to the global list of comments in
139
+ a NEXUS file by `commonnexus`. Thus, to retrieve such a comment, one would have to search
140
+ through `Nexus.comments`, picking one that appears immediately after a `"&R"` comment:
141
+
142
+ .. code-block::
143
+
144
+ >>> from commonnexus import Nexus
145
+ >>> nex = Nexus('#nexus begin trees; tree 1 = [&R] [&clockrate] ((a,b)c); end;')
146
+ >>> nex.comments
147
+ ['&R', '&clockrate']
148
+
130
149
  :ivar str name: The name of the tree.
131
150
  :ivar typing.Union[bool, None] rooted: Flag indicating whether the tree is rooted (or `None` \
132
151
  if no information is given)
@@ -172,8 +191,11 @@ class Tree(Payload):
172
191
 
173
192
  while not nwk:
174
193
  t = next(tokens)
175
- if t.type == TokenType.COMMENT and t.text.startswith('&'):
176
- self._rooted = t.text
194
+ if t.type == TokenType.COMMENT:
195
+ if t.text.startswith('&') and t.text[1:] in {'U', 'R'}:
196
+ self._rooted = t.text
197
+ else:
198
+ pass
177
199
  if t.type == TokenType.PUNCTUATION and t.text == '(':
178
200
  nwk = True
179
201
  assert nwk
commonnexus/tokenizer.py CHANGED
@@ -11,7 +11,7 @@ Punctuation
11
11
 
12
12
  The following punctuation marks have special properties: [ ] do not break a
13
13
  word; + and - are allowed as state symbols, but none of the rest are allowed; - is
14
- considered punctuation except were it is the minus sign in a negative number.
14
+ considered punctuation except where it is the minus sign in a negative number.
15
15
  """
16
16
  import enum
17
17
  import itertools
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: commonnexus
3
- Version: 1.9.1
3
+ Version: 1.9.3
4
4
  Summary: A nexus (phylogenetics) file reader and writer (.nex, .trees)
5
5
  Home-page: https://github.com/dlce-eva/commonnexus
6
6
  Author: Robert Forkel
@@ -25,31 +25,33 @@ Classifier: Programming Language :: Python :: 3.9
25
25
  Classifier: Programming Language :: Python :: 3.10
26
26
  Classifier: Programming Language :: Python :: 3.11
27
27
  Classifier: Programming Language :: Python :: 3.12
28
+ Classifier: Programming Language :: Python :: 3.13
29
+ Classifier: Programming Language :: Python :: 3.14
28
30
  Classifier: Programming Language :: Python :: Implementation :: CPython
29
31
  Classifier: Programming Language :: Python :: Implementation :: PyPy
30
32
  Classifier: License :: OSI Approved :: BSD License
31
33
  Requires-Python: >=3.8
32
34
  Description-Content-Type: text/markdown
33
35
  License-File: LICENSE
34
- Requires-Dist: newick (>=1.8.1)
36
+ Requires-Dist: newick>=1.8.1
35
37
  Provides-Extra: dev
36
- Requires-Dist: tox ; extra == 'dev'
37
- Requires-Dist: flake8 ; extra == 'dev'
38
- Requires-Dist: wheel (>=0.36) ; extra == 'dev'
39
- Requires-Dist: twine ; extra == 'dev'
40
- Requires-Dist: build ; extra == 'dev'
41
- Provides-Extra: docs
42
- Requires-Dist: sphinx (<7) ; extra == 'docs'
43
- Requires-Dist: sphinx-autodoc-typehints ; extra == 'docs'
44
- Requires-Dist: sphinx-rtd-theme ; extra == 'docs'
45
- Requires-Dist: sphinx-prompt ; extra == 'docs'
46
- Requires-Dist: sphinxcontrib-programoutput ; extra == 'docs'
47
- Requires-Dist: termgraph ; extra == 'docs'
38
+ Requires-Dist: tox; extra == "dev"
39
+ Requires-Dist: flake8; extra == "dev"
40
+ Requires-Dist: wheel>=0.36; extra == "dev"
41
+ Requires-Dist: twine; extra == "dev"
42
+ Requires-Dist: build; extra == "dev"
48
43
  Provides-Extra: test
49
- Requires-Dist: pytest (>=5) ; extra == 'test'
50
- Requires-Dist: pytest-mock ; extra == 'test'
51
- Requires-Dist: pytest-cov ; extra == 'test'
52
- Requires-Dist: coverage (>=4.2) ; extra == 'test'
44
+ Requires-Dist: pytest>=5; extra == "test"
45
+ Requires-Dist: pytest-mock; extra == "test"
46
+ Requires-Dist: pytest-cov; extra == "test"
47
+ Requires-Dist: coverage>=4.2; extra == "test"
48
+ Provides-Extra: docs
49
+ Requires-Dist: sphinx<7; extra == "docs"
50
+ Requires-Dist: sphinx-autodoc-typehints; extra == "docs"
51
+ Requires-Dist: sphinx-rtd-theme; extra == "docs"
52
+ Requires-Dist: sphinx-prompt; extra == "docs"
53
+ Requires-Dist: sphinxcontrib-programoutput; extra == "docs"
54
+ Requires-Dist: termgraph; extra == "docs"
53
55
 
54
56
  # commonnexus
55
57
 
@@ -1,20 +1,20 @@
1
- commonnexus/__init__.py,sha256=PjK3pLfL2O6-bT7dktuGDSQufBuU5J5VLsg9yRZVBPI,121
1
+ commonnexus/__init__.py,sha256=ioVKrxHKY4GKtzmrSBlCjpRvF-GQMMPxXZUNPIk5aeA,121
2
2
  commonnexus/__main__.py,sha256=k07DsoCHCRw2Wi0HzXCmvNCSt8cddDEGCBlnHZorm6k,4361
3
3
  commonnexus/cli_util.py,sha256=pmqd3Fs2Wef7hRf0Z6koZ1Bg6-16FZUMOYZ8cMTY5Ig,3710
4
4
  commonnexus/command.py,sha256=5ZbW3wQY1GO6fChK7aqOzwjKBRxkPlKdUf09JbYEy9c,4284
5
5
  commonnexus/nexus.py,sha256=rsfxX_cM4aOxS5p-lu39U2ZEcHswDoXPGGiVBiiVAMA,18380
6
- commonnexus/tokenizer.py,sha256=8G2nP-xNN1gBd2a_7qxGDhHloCzoH4YE063p01FLTuk,11459
6
+ commonnexus/tokenizer.py,sha256=a_zcTLhEc2KW2KCbVFXF-KoZlJg5TTfN9PIh7qnnIuk,11460
7
7
  commonnexus/util.py,sha256=WomyVUggYJON5T9uNuIZ_Bxm16UJHIhO737SjKcFYO0,168
8
8
  commonnexus/blocks/__init__.py,sha256=ehKEEc_E62zhlkvbp0p3asY56QkLuhqk7wYd1AqQuKI,602
9
9
  commonnexus/blocks/assumptions.py,sha256=SNURUIUNP86SgTTdfLVTnGQ0FJDnd3I6FTz3jT9A7aw,11215
10
10
  commonnexus/blocks/base.py,sha256=-sMfVczf7gWQ-hc9eV2pOgDgZUs9osrbDu_LbTPTgGM,8562
11
- commonnexus/blocks/characters.py,sha256=PvNHn11UdwCSNpAWZo_McowAzLlCqVhhxGRUF08T6Xs,59877
11
+ commonnexus/blocks/characters.py,sha256=5zvGPUi6J9ES9hc-1flKb_OJzkhdqXn_1lbL_QbSfag,60130
12
12
  commonnexus/blocks/codons.py,sha256=Gox96r1Y3y8wmJIP1KhchfAepMC8BZB4Y7O2BTOcybc,7365
13
13
  commonnexus/blocks/distances.py,sha256=E1XnkOhn4NKwhKQS3APhcKJ6HR6B33O2q6rdzQ0n4wU,16018
14
14
  commonnexus/blocks/notes.py,sha256=6YctkCTgGAtOWKQ08LgzKXW_X0E1Oe5OgkqcF6iR5LY,8502
15
15
  commonnexus/blocks/sets.py,sha256=iLtOgDSAbgkh8JeVi7kdMK4lTuAZMXdZUaE7cU2Mrio,7699
16
16
  commonnexus/blocks/taxa.py,sha256=Pzhing1_KKTQPKB4pAXVFMOb6O1kDsPH5VEFn1mc7Ls,3241
17
- commonnexus/blocks/trees.py,sha256=C0Oa1px9h4MK-_XkRlJATqrMwDKTk12zmaH1gpo4NoA,17642
17
+ commonnexus/blocks/trees.py,sha256=IBbLx4MPayLMKowdTCGj2H0Gw0XxySw0GsB3e54lfY4,18614
18
18
  commonnexus/blocks/unaligned.py,sha256=7objnIbG4zjb7v2LbaU1kS44auw4KGlhh1hTE94qGvc,2240
19
19
  commonnexus/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
20
  commonnexus/commands/characters.py,sha256=VF458aKOVxFQc4ipOwoWkhZY29EuPCpSVxFY8QtDSY0,5977
@@ -28,9 +28,9 @@ commonnexus/tools/__init__.py,sha256=X8dv4VrjAo5C8VJdUXMrKviDLUrwXbawE5SJiQ--2uQ
28
28
  commonnexus/tools/combine.py,sha256=5vPQKcqA2acFji2lZc_xNZr1Xm2F3TPmfQk-fa9GA60,3048
29
29
  commonnexus/tools/matrix.py,sha256=3e2n_beug3MZyzXDgawjxxh1QfiM7KVp757OepCjQR0,11492
30
30
  commonnexus/tools/normalise.py,sha256=RdAasznob1aIY4B5z0Ir3jm9T5Yj_nbFzdtFtUM553U,6131
31
- commonnexus-1.9.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
32
- commonnexus-1.9.1.dist-info/METADATA,sha256=wTiq1lHknPwEw9KXEd_2EB_UG_45v_jWmYBNhLFpTVE,5357
33
- commonnexus-1.9.1.dist-info/WHEEL,sha256=bb2Ot9scclHKMOLDEHY6B2sicWOgugjFKaJsT7vwMQo,110
34
- commonnexus-1.9.1.dist-info/entry_points.txt,sha256=0CbsOaqe6jaHnG1rpheuIISCZvFp1G1oBgDym82rpAo,58
35
- commonnexus-1.9.1.dist-info/top_level.txt,sha256=SiWuQrmGciG5Ivhrqz6ueU1Sxv-fzudflsMof81-I54,12
36
- commonnexus-1.9.1.dist-info/RECORD,,
31
+ commonnexus-1.9.3.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
32
+ commonnexus-1.9.3.dist-info/METADATA,sha256=EY-NI_Fw5fmRZYFrNeGsgQ0WJVloJexMxPPVoWMm2IE,5429
33
+ commonnexus-1.9.3.dist-info/WHEEL,sha256=9Hm2OB-j1QcCUq9Jguht7ayGIIZBRTdOXD1qg9cCgPM,109
34
+ commonnexus-1.9.3.dist-info/entry_points.txt,sha256=0CbsOaqe6jaHnG1rpheuIISCZvFp1G1oBgDym82rpAo,58
35
+ commonnexus-1.9.3.dist-info/top_level.txt,sha256=SiWuQrmGciG5Ivhrqz6ueU1Sxv-fzudflsMof81-I54,12
36
+ commonnexus-1.9.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.38.4)
2
+ Generator: setuptools (75.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py2-none-any
5
5
  Tag: py3-none-any