Created
November 25, 2018 01:40
-
-
Save cyklee/4f808ebb6a10a1428621d197e3f55353 to your computer and use it in GitHub Desktop.
sed and shell script to find pattern from a column and replacing it with entries from another column - handy for tidying up a newick phylogenetic tree
This file contains 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
paste Short.name.txt Proper.name.txt | while read n k; do sed -i "s/$n/$k/g" tree.nwk; done |
In addition, newick tree uses ":" as separator, so it can be used within the branch tip names.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If the name files contained "/", it will clash with sed. In that case, the delimiter can be replaced with other characters e.g. "s@$n@$k@g"