I am really new to coding generally. I'm trying to figure out how to write a bash script that can help me find the occurrences of patterns in a fasta file. The occurrences are in a .txt
file, and are pretty basic:
ATTG
CGCCT
TGGAC
GGCCA
etct.
I've been trying to write a bash script that looks like:
while read pattern;
do
grep -c -i $pattern [myfile.fasta] > acountoftheoccurances.txt
done < patternfile.txt
I've thought that would return the list of all the patterns, then a count, but all I got was a count of the number of occurrences for the last pattern (I tried them all manually to see what I should expect).
Any help or pointing in the right direction would be appreciated!