I wrote a code to go through all my .fasta files in my directory but it is not working. I want it to match with my -db Viral.fna and output (fasta file name).txt and -outfmt 6
I tried 2 different codes
for f in file1.fasta file2.fasta etc ...
do blastn -db Viral.fna -query $f.fasta -out $f_output3.txt -outfmt 6
Done
Which didn't work: gave me this error
Command line argument error: Argument "query". File is not accessible: `file1.fasta.fasta'and repeated for all the files
I also tried this :
for f in 'ls *.fasta'
do blastn -db Viral.fna -query $f -out $f_output3.txt -outfmt 6
Done
Can someone help me out with figure out how to make this loop work I keep getting an error that says
Too many positional arguments (1), the offending value: 123.fasta
The .fasta extension is already part of $f, so don't add it. And if there's whitespace in any of the file names you have to use quotes where you use $f:
-query "$f" -out "$f"_output3.txt
Also, when you write $f_output3.txt, the shell will think you want use a variable called f_output3 which doesn't exist