This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to use extractfeat in bash to obtain feature tags values ?

Hi,

I am writing a bash script to extract some features like CDS from my sequences. I have noticed some of them have tags like Organism and Organelle, whose values I would like to extract. Like this example of a gene

I am not sure what the syntax would be in bash if this is possible, as I cannot get the script to extract these values.

bash emboss

From your example, extracting "Organism" in a Bash script can be:

$ ORG=$(grep 'ORGANISM' sequence.gb | sed -r 's/\s+ORGANISM\s+//')
$ echo $ORG
Caenorhabditis elegans

1 answer

$ wget -q  -O - "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nuccore&id=JF896456.1&retmode=xml" |\
xmllint --xpath '//GBSeq_organism/text()' - 

Caenorhabditis elegans

Log in to answer this question.