Hi everyone, I have a list of trimmed fasta files and need to run spades assembler for them using a list my fasta files name are like that s1_2 s1_3 s1_4 ... each sequence has been trimmed using trimmomatic in a directory with the same name my question is : how I can define a list then run spades for all in a loop?
Not sure what the input for SPAdes needs to be, but with
find . -type f -name "s1_*"
you will be able to get the list of all your filesthanks can you write it for my 3 samples s1_2 s1_3 s1_4 ?
I mean listing and then looping the spades
OK, you lost me :/
you only have three input files? I assume you mean
fastq
rather thenfasta
, correct? Do you want to run SPAdes on all samples together or once per sample/file ?sorry, I have all file paired and unpaired fastaq.gz and my samples are 95 samples so I need to make a list and run spades for all
right, and the
find
command I provided in the first comment is not doing/giving what you want/expect ? Simply run that in your top folder and it will report all files matching the regex in the-name
optionthank you still help me. this did not work
Question about the loop - will the output folder ( -o assembly) be overwritten each time it gets a new sample?
Probably. You'll need to check spades manual or its source code to be sure.
There are countless posts with bash loop questions, and countless solutions with either bash for loops or GNU parallel. Please read some of them and try to implement a solution, then ask a more detailed question if you get stuck.
How to run Spades For Nextseq data
Bash loop for files in several directories
For loop script
How to run a set or batch of genome assemblies at once in one go?
I have a directory with the name genome and in this directory, I have 90 directories each one for one sample. I did trimommatic for all then I need to loop them but it does not work. I used this command but nothing happened.
That's because the syntax is wrong in several ways. Go and take a look at how
find
works, and how to use commands infor
loops (hint:$(find ...)
).Second hint, your loop declares the variable
FILE
but you then never use it, so it's not really any wonder the loop doesn't work.Don't blindly copy and paste commands, attempt to understand what they do. This is important, because one time you may copy a command without thinking and erase your data, or maybe worse.
Two things:
-careful
seems to be a non ASCII character, probably from a copy-paste out of PDF/Word/a website. Ensure you type your commands on the terminal, avoid copy-paste unless you've gained considerable expertise at noticing non ASCII characters when you eyeball text.