I have human Rna-Seq data by reading nanopore. Data has over 1000 .fastq files. I want to trim all fastq files individually. I am using NanoFilt for trimming. All Fastq files are in the directory(not gzip format).
How can I write a loop or command line for trimming all fastq files individually?
I am using Linux Ubuntu 21.04.
I guess this will also work for the same:
I wrote loop like
for file in *.fastq do porechop -i ${file} > /Diroctory/${file} > donebut how can I specify for when all data is trimmed stop the loopIt should not be necessary to stop the loop since the above command will consider each
.fastqfile only once.Thank you for answer. How can I add another
do <something>donein the same bash for example I want to use some filtering tools after the trimming.Please use google to learn shell loops. devarora and Carlo have helped you get started, we cannot feed you the directions for each step.
Just add more lines of code commands between
doanddone. In my answer bellow, the code does two things for each file: it prints the file name and then it runs thenanofitcommand.Can you explain how to run with porechop with all fastq file in the loop ? .
@carlo has explained the basics of a shell loop below. You can try to figure out how to replace
porechopin place ofnanofiltin the loop below. You should take a look atbasenamewhich will allow you to extract just name of sample (here is an example for you to try things out): How to modify my sbatch script to make it be able to be used for other filesWrite a loop. Use
echoto test things out and ask questions with specific examples.