I suspect that case insensitive matching is not required in this case (so loose -i), and the use of the slower Perl regular expressions is probably not necessary either, so the following would likely do:
grep -o 'Gene_Symbol=.*$' inFile.fasta >IPIGenes.out
If there are problems with "Gene_Symbol=" occurring elsewhere in the fasta headers, then the following would be a bit more robust:
grep -o ' Gene_Symbol=.*$' inFile.fasta > IPIGenes.out
Or if you prefer Perl regular expressions, the word boundary can be used instead:
grep -oP '\bGene_Symbol=.*$' inFile.fasta > IPIGenes.out
@Abdul Rawoof,
To be honest, I am not that good in writing those scripts. I have similar problem with sorting the gene names from fasta headers. I wonder to know how you managed to sort gene codes using excel easily?
Thanks in advance,
Shewit
Dear skalayout, what I did is that, first of all I extracted all fasta header in a separated text file using a small perl script.
You will get protein fasta header like following
Further I replaced "Gene_Symbol" with "#Gene_Symbol" using Find and replace option in textpad and saved changes. After that I open this in Excel usig Text import wizard > select delimited > next > select tab button and in other option put
#symbol and finish. You will get Gene symbol=gene name in separate column.Best,
Abdul Rawoof
Thanks Abdul. Amazingly, your suggestion is still helpful, even after two years:)
Thanks again.