Created
December 28, 2019 19:20
-
-
Save mtholder/114b918187c7c89f643fb19a65a9753a to your computer and use it in GitHub Desktop.
generates subproblems/subproblems-scaffold.tre and subproblems/subproblems-scaffold-only.tre for an Open Tree synth. tree build
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # This needs to be made part of the propinquity process. | |
| # MTH ran steps that made up the basis of this before the | |
| # Jan 2020 SSB workshop. So the resulting file will be in | |
| # the https://files.opentreeoflife.org/synthesis/opentree12.3/opentree12.3/subproblems/ | |
| # folder, but (perversely enough) not in the tar archive at https://files.opentreeoflife.org/synthesis/opentree12.3/opentree12.3.tgz | |
| # If all goes as planned, we'll start adding this to the tree build process so that it will be in | |
| # builds and archives made after 12.3 | |
| # This is to be run with the working directory being the propinquity | |
| # output directory and with otcetera tools on the PATH | |
| set -x | |
| # Make a tree that is a polytomy with a leaf-set of all of the subproblem roots ID | |
| cat subproblems/subproblem-ids.txt | sed -E 's/\.tre/,/' > idswithoutdottre.txt || exit | |
| echo '(' > x.tre || exit | |
| cat idswithoutdottre.txt >> x.tre || exit | |
| echo ');' >> x.tre || exit | |
| # remove the extra , by replacing ,\n) with ) | |
| perl -0777 -i -pe 's/,\n[)]/)/' x.tre || exit | |
| # produce the induced tree for the taxonomy: | |
| otc-induced-subtree exemplified_phylo/taxonomy.tre x.tre > subproblems/subproblems-scaffold.tre || exit | |
| rm x.tre || exit | |
| # Suppress monotypic taxa. This may eliminate some trivial subproblems, but gives | |
| # but gives an easier tree to look at. | |
| python suppress-non-listed-ids-or-unnamed.py subproblems/subproblems-scaffold.tre idswithoutdottre.txt >subproblems/subproblems-scaffold-only.tre || exit | |
| rm idswithoutdottre.txt || exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment