Counting the number of species from NCBI Taxonomy browser
1
0
Entering edit mode
3.8 years ago
adarsh_munna ▴ 50

Hi, I need to count the number of species for each genus search from NCBI Taxonomy Browser result. Is there any way to do this using coding ? Manual counting is highly tedious work. Thanks

Taxonomy NCBI • 757 views
ADD COMMENT
0
Entering edit mode
3.8 years ago

Try using taxonkit, but it needs some time.

There are 96645 TaxIds at genus rank.

$ time taxonkit list --ids 1 \
    | taxonkit filter --equal-to genus
    | wc -l
96645

Counting for 100 genuses costs:

time taxonkit list --ids 1 \
    | taxonkit filter --equal-to genus \
    | head -n 100 \
    | rush 'echo -ne "{}\t$(echo {} \
                                | taxonkit list --ids {} \
                                | taxonkit filter --equal-to species \
                                | wc -l \
                            )\n" ' \
    | csvtk sort -H -t -k 2:nr \
    | head -n 5

190729  178
558016  157
558017  55
687331  40
1307798 32

real    1m11.472s
user    16m28.239s
sys     0m55.687s

It works but is not efficient for this work.

ADD COMMENT

Login before adding your answer.

Traffic: 1088 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6