1
$\begingroup$

I have DNA sample from 5 pools, having 25 fastq files each. I am running cutadapt to remove the primers using this command cutadapt -g ACTTAAGTGTATGTAAACTTCCGACTTCAACTG A7_S7_R1_001.fastq -o sb_A7_S7_R1_001.fastq --discard-untrimmed However, this is too time consuming. I tried my hand at writing shell script

for file in /dir/*
do
  cmd cutadapt -g ACTTAAGTGTATGTAAACTTCCGACTTCAACTG "$file" >> results.out
done

But it is not running . Can someone help. Thanks

$\endgroup$
1
  • $\begingroup$ I assume you don't really have cmd in there. Put and ls in just to see which files are seen. $\endgroup$
    – Devon Ryan
    Mar 8, 2020 at 14:18

1 Answer 1

2
$\begingroup$

Try this one

for file in /dir/*
do
  cutadapt -g ACTTAAGTGTATGTAAACTTCCGACTTCAACTG "$file" >> results.out
done

Also you have omitted --discard-untrimmed from the original command. If you want that as well along with everything to run in parallel:

for file in /dir/*
do
  cutadapt -g ACTTAAGTGTATGTAAACTTCCGACTTCAACTG --discard-untrimmed "$file" -o "`basename -s .fastq $file`_out.fastq" &
done
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.