Created
May 6, 2017 14:34
-
-
Save mtholder/0ab3ef34ac96d4eec38fcfbefd4e66cc to your computer and use it in GitHub Desktop.
count_species_rank_binomen.sh from binomen
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 | |
| OTT_DIR=$1 | |
| ROOT_TAXON=$2 | |
| echo "Extracting taxa that are descendants of ${ROOT_TAXON}" | |
| otc-taxonomy-parser \ | |
| $OTT_DIR \ | |
| --format="%R | %N |" \ | |
| -r $ROOT_TAXON \ | |
| --cull-flags "major_rank_conflict,major_rank_conflict_inherited,environmental,viral,barren,not_otu,hidden,was_container,inconsistent,hybrid,merged" \ | |
| > "all-${ROOT_TAXON}.txt" | |
| echo "pulling out the species rank" | |
| cat "all-${ROOT_TAXON}.txt" | grep '^species [|]' | sed -E 's/species \| //' | sed -E 's/ \|.*//' > "species-${ROOT_TAXON}.txt" | |
| echo "pulling out the two word names" | |
| cat "species-${ROOT_TAXON}.txt" | sed -E '/[A-Z0-9a-z]+ [0-9A-Za-z].+ [0-9A-Za-z].+/d' | sed -E '/^[A-Z0-9a-z]+$/d' > "species-binomens-${ROOT_TAXON}.txt" | |
| wc -l "species-binomens-${ROOT_TAXON}.txt" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment