Skip to content

Commit

Permalink
Merge pull request #1615 from nextstrain/james/watronfire-spaces-in-b…
Browse files Browse the repository at this point in the history
…east-annotations

Allow spaces in BEAST annotations mk2
  • Loading branch information
jameshadfield authored Sep 3, 2024
2 parents ade798b + 4604976 commit c5bd513
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
* filter: Improved warning and error messages in the case of missing columns. [#1604] (@victorlin)
* merge: Any user-customized `~/.sqliterc` file is now ignored so it doesn't break `augur merge`'s internal use of SQLite. [#1608][] (@tsibley)
* merge: Non-id columns in metadata inputs that would conflict with the output id column are now forbidden and will cause an error if present. Previously they would overwrite values in the output id column, causing incorrect output. [#1593][] (@tsibley)
* import: Spaces in BEAST MCC tree annotations (for example, from a discrete state reconstruction) no longer break `augur import beast`'s parsing. [#1610][] (@watronfire)

[#1593]: https://github.com/nextstrain/augur/pull/1593
[#1594]: https://github.com/nextstrain/augur/pull/1594
[#1604]: https://github.com/nextstrain/augur/pull/1604
[#1608]: https://github.com/nextstrain/augur/pull/1608
[#1610]: https://github.com/nextstrain/augur/pull/1610

## 25.3.0 (22 August 2024)

Expand Down
6 changes: 3 additions & 3 deletions augur/import_/beast.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,15 @@ def parse_beast_tree(data, tipMap, verbose=False):
print('%d adding multitype node %s'%(i,multitypeNode.group(1)))
i+=len(multitypeNode.group(1))

commentBlock=re.match(r'(\:)*\[(&[A-Za-z\_\-{}\,0-9\.\%=\"\'\+!#]+)\]',data[i:])## look for MCC comments
commentBlock=re.match(r'(\:)*\[(&[A-Za-z\_\-{}\,0-9\.\%=\"\'\+ !#]+)\]',data[i:])## look for MCC comments
if commentBlock is not None:
if verbose==True:
print('%d comment: %s'%(i,commentBlock.group(2)))
comment=commentBlock.group(2)
numerics=re.findall(r'[,&][A-Za-z\_\.0-9]+=[0-9\-Ee\.]+',comment) ## find all entries that have values as floats
strings=re.findall(r'[,&][A-Za-z\_\.0-9]+=["|\']*[A-Za-z\_0-9\.\+]+["|\']*',comment) ## strings
strings=re.findall(r'[,&][A-Za-z\_\.0-9]+=["|\']*[A-Za-z\_0-9\.\+ ]+["|\']*',comment) ## strings
treelist=re.findall(r'[,&][A-Za-z\_\.0-9]+={[A-Za-z\_,{}0-9\.]+}',comment) ## complete history logged robust counting (MCMC trees)
sets=re.findall(r'[,&][A-Za-z\_\.0-9\%]+={[A-Za-z\.\-0-9eE,\"\_]+}',comment) ## sets and ranges
sets=re.findall(r'[,&][A-Za-z\_\.0-9\%]+={[A-Za-z\.\-0-9 ,\"\_]+}',comment) ## sets and ranges
figtree=re.findall(r'\![A-Za-z]+=[A-Za-z0-9#]+',comment) ## figtree comments, in case MCC was manipulated in FigTree

for vals in strings: ## string states go here
Expand Down

0 comments on commit c5bd513

Please sign in to comment.