Question: Bioinformatics-Bash Scripting How can I grep all of the genes and their corresponding sequences that have a specific motif from a fasta.file. For this assignment,

Bioinformatics-Bash Scripting

How can I grep all of the genes and their corresponding sequences that have a specific motif from a fasta.file. For this assignment, we were given 10 motifs of interest, and a fasta file with 500 genes. In the bash script, I am using grep -n -o, but that is only giving me the line number where the motif sequence is located. I want both, the ">gene#" and its corresponding motif sequence "TTTT" to be redirected to a new file. This is what I want the output to the file to be:

for sequence TTTT I need it to look like:

cat TTTT.fasta

>gene2

TTTT

>gene 5

TTTT

>gene 100

TTTT

I want it to specify which genes have the motif sequence using grep command and redirect the output to a new file.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!