Hey, Thanks for help but I'm getting error. How can I resolve it
awk: syntax error at source line 1
context is
>>> {N=match($2,/(S....[FS]...L)/, <<<
awk: illegal statement at source line 1
awk: illegal statement at source line 1
Hello All,
How to Grep only specific motif from complete sequences in a fasta file using shell command? Also, I want to include the lines beginning with a > before these target sequences. I got help from the previous post in this link: A: grep whole sequences containing a specific motif in a fasta file to grep whole sequence containing motifs but now I want to grep only motifs with protein id as a header. Some protein sequence has more than one motifs.
My motifs look like that : SXXXX(F/S)XXXL
Here are list of protein sequences
>sp|Q9H257.2|CARD9_HUMAN RecName: Full=Caspase recruitment domain-containing protein 9; Short=hCARD9
MSDYENDDECWSVLEGSRVTLTSVIDRSRITPYLRQTKVLNPDDEEQVLSDPNLSIRKRKVGVLLDILQRTGHKGYVAFLESLELYYPQLYKKVTGKEPARVFSMIIDASGESGLTQLLMSEVMWFLQKLVQDLTALLSSK
>sp|Q9H37.2|CTYU_HUMAN
HHHSVLEGFRVTLTSVIDRFRITPYLRQTKVLNPDDEEQVLSDPNLVIRKRKVGVLLDILQRTGHKGYVAFLESLELYYPQLYKKVTGKEPARVFSMIIDASGESYSLTQLLMTEVMKLQKKVQDLTALLSSK
>sp|Q9re7.2|CARer_HUMAN RecName
BKLSVLEGWRVTLTSVIDRFRITPYLRQTKVLNPDDEEQVLSDPNLVIRKRKVGVLLDILQRTGHKGYVAFLESLELYYPQLYKKVTGKEPARVFSMIIDASGESGLTQLLMTEVMKLQKKVQDLTALLSSK
Result should be displayed like:
>sp|Q9H257.2|CARD9_HUMAN RecName: Full=Caspase recruitment domain-containing
SVLEGSRVTL
>sp|Q9H257.2|CARD9_HUMAN RecName: Full=Caspase recruitment domain-containing
SEVMWFLQKL
>sp|Q9H37.2|CTYU_HUMAN
SVLEGFRVTL
>sp|Q9H37.2|CTYU_HUMAN
SGESSLTQL
This command will take the whole sequence that contains motif I don't want to do like that
grep -E 'S[A-Z]{4}[FS][A-Z]{3}L' jara3.fasta > jara4.fasta
cat input.fa | paste - - | awk -F '\t' '{N=match($2,/(S....[FS]...L)/,a);if(N==0) next;printf("%s\n%s\n",$1,a[1]);}'
>sp|Q9H257.2|CARD9_HUMAN RecName: Full=Caspase recruitment domain-containing protein 9; Short=hCARD9
SVLEGSRVTL
>sp|Q9H37.2|CTYU_HUMAN
SVLEGFRVTL
(assuming two lines par fasta record. Otherwise, use https://gist.github.com/lindenb/2c0d4e11fd8a96d4c345 )
Hey, Thanks for help but I'm getting error. How can I resolve it
awk: syntax error at source line 1
context is
>>> {N=match($2,/(S....[FS]...L)/, <<<
awk: illegal statement at source line 1
awk: illegal statement at source line 1
Log in to answer this question.
I added markup to your post for increased readability. You can do this by selecting the text and clicking the 101010 button. When you compose or edit a post that button is in your toolbar, see image below:
Hello Jason!
We believe that this post does not fit the main topic of this site.
Pure unix question, a
man grepis all it'll take to get to your answers, which involvesgrep -o. Or better, usebioawkFor this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.
If you disagree please tell us why in a reply below, we'll be happy to talk about it.
Cheers!
The answer is in the first hits if you google
grep only print matching pattern