I have a fasta file and I need to count the number of exact matched sequences in it. I tried
cat my.fasta | tr -d "\n" | grep "MySequence"
but it's not working for me.
I have a fasta file and I need to count the number of exact matched sequences in it. I tried
cat my.fasta | tr -d "\n" | grep "MySequence"
but it's not working for me.
I'd do
grep ">" myfile.fa | wc -l
That should just count the number of lines with ">", so line breaks won't matter.
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
How is this question related to RNAseq?
How is it not working for you? Does grep not find the pattern that you can see is there? Do you need to create 1 line per fasta entry? (Multiline Fasta To Single Line Fasta)? If you have bowtie available, you could create an alignment index with your fasta, then supply "MySequence" on the command line, and count up the results.