This is a test version of Biostars. For the public version, visit https://www.biostars.org.
how to find family information from species name using entrez efetch

i have a fasta file with following information-

>mgm4958441.3|SRR16124173.15913997_1_130_+|RefSeq|002074a53cc252b220bf90d1e2737f50 accession=[NP_049991.1]  function=[immunity region]  organism=[Streptococcus phage Sfi21]
AGCAAAGCGATTGATAAAGCTAGTTCGTCCATTGATGCTGATTATAGTAAGTCGTCTTCTGAAAAAGCTAGTAAAGAAG

>mgm4958441.3|SRR16124173.29100137_1_150_+|RefSeq|002074a53cc252b220bf90d1e2737f50 accession=[NP_049991.1]  function=[immunity region]  organism=[Streptococcus phage Sfi21]
AAAAACAAAAAAGTGCTTGCTATTGTCGGAACTTGTTTATCTATAGCTTCAATCATCATTGTTCTTGTGACTCAAACAAT    
>mgm4958441.3|SRR16124173.10240675_1_150_-|RefSeq|0036f809e785ecade55b2f0a227ac0c3 accession=[YP_003347665.1]   function=[putative DNA primase] organism=[Klebsiella phage KP34]
CGCATACAGTTACAGGAAGAGCCGAGGGTGCAGCCCTCTGCACCTGCAGATGCAATTTGCATTAGCCAAGCGCATG

i need to find a way to retrieve family name using species name here in this fasta file. i don't know how to use e-utelities to do it, any link or direction would be helpful. thanks!

e-utelities

1 answer

Using EntrezDirect (linked by @Pierre above):

$ esearch -db taxonomy -query "Klebsiella phage KP34" | efetch -format native -mode xml | xtract -pattern Taxon -block "*/Taxon" -unless Rank -equals "no rank" -tab "\n" -element Rank,ScientificName
superkingdom    Viruses
clade   Duplodnaviria
kingdom Heunggongvirae
phylum  Uroviricota
class   Caudoviricetes
order   Caudovirales
family  Autographiviridae
subfamily   Slopekvirinae
genus   Drulisvirus
species Klebsiella virus KP34

If you just need family

$ esearch -db taxonomy -query "Streptococcus phage Sfi21" | efetch -format native -mode xml | xtract -pattern Taxon -block "*/Taxon" -unless Rank -equals "no rank" -tab "\n" -element Rank,ScientificName | grep family
family  Siphoviridae

I to get the family information of multiple viruses using the species information using this command?

Log in to answer this question.