Question: Cutadapt for loop
gravatar for linas.kapocius
5 days ago by
linas.kapocius0 wrote:

I have two questions.

How to for loop .fastq files which are in a single directory in cutadapt?

For example:

for file in *.fastq; do cutadapt -a AACTGTCGGCACCATCTA -o cell_line_output.fastq cell_line.fastq

This one gives me an error.

And, also, how to change output files names for every loop, for example, cell_line_1_output.fastq, cell_line_2_output.fastq?

assembly • 71 views
ADD COMMENTlink modified 5 days ago by ATpoint28k • written 5 days ago by linas.kapocius0

You need to grab the base file name and then use it in the loop so you get proper names that refer to each sample. This can be done using name=$(basename file.fastq .fastq). There are plenty of posts on biostars for help with for loops. Here is one example: C: Bash Script Loop Help This shows sed way of editing file names so you can grab the file basename that way.

ADD REPLYlink modified 5 days ago • written 5 days ago by genomax76k

...there is no done closing your loop. beyond that please read what genomax linked and be sure to extensively browse the web for tutorials.

ADD REPLYlink written 5 days ago by ATpoint28k

What you should do is use a pipeline.

ADD REPLYlink written 5 days ago by Asaf6.7k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1220 users visited in the last hour