Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The cutadapt adapter trimming command reads NGS sequences from a FASTQ file, and writes adapter-trimmed reads to a FASTQ file. Find its usage.

Expand
titleAnswer...

cutadapt    # overview; tells you to run cutadapt --help for details
cutadapt --help | less
cutadapt --help | more

Note that it also points you to https://cutadapt.readthedocs.io/ for full documentation.

Usage:

    cutadapt -a ADAPTER [options] [-o output.fastq] input.fastq

Where does cutadapt write its output to from by default? How can that be changed?

Expand
titleAnswer...

The cutadapt usage says that output can be written to a file using the -o option

Usage:
    cutadapt -a ADAPTER [options] [-o output.fastq] input.fastq

But the The brackets around [-o output.fastq] suggest this is optional. Reading a bit further we see:

... Without the -o option, output is sent to standard output.

This suggests output can be specified in 2 ways:

  • to a file, using the -o option
    • cutadapt -a CGTAATTCGCG -o trimmed.fastq  small.fq
  • to standard output without the -o option
    • cutadapt -a CGTAATTCGCG small.fq 1> trimmed.fastq

...

Expand
titleAnswer...

The cutadapt usage says an input.fastq file is a required argument:

    cutadapt -a ADAPTER [options] [-o output.fastq] input.fastq

But again, reading a bit further we see:

...                           Compressed input and output is supported and
auto-detected from the file name (.gz, .xz, .bz2). Use the file name '-' for
standard input/output. ...

This suggests input can be specified in 2 ways:

  • from a file, using the -o option
    • cutadapt -a CGTAATTCGCG -o trimmed.fastq  small.fq
  • from standard input if the input.fastq argument is replaced with a dash ( - )
    • cat small.fq | cutadapt -a CGTAATTCGCG -o trimmed.fastq  -

And also says that the input.fastq file can be provided in one of three compression formats.

...

Expand
titleAnswer...

The cutadapt usage doesn't say anything about diagnostics:

    cutadapt -a ADAPTER [options] [-o output.fastq] input.fastq

But again, reading in the Output: options section:

   -o FILE, --output=FILE
        Write trimmed reads to FILE. FASTQ or FASTA format is
        chosen depending on input. The summary report is sent
        to standard output. Use '{name}' in FILE to
        demultiplex reads into multiple files. Default: write
       
to standard output

Careful reading of this suggests that:

  • When the trimmed output is sent to a file with the -o output.fastq option ,diagnostics are is omitted, and output goes to standard output,
    • diagnostics must be written to standard outputerror
      • so can be redirected to a log file with 1> 2> trim.log
    • cutadapt -a CGTAATTCGCG -o trimmed.fastq  small.fq 1> trimmed.fastq 2> trim.log
  • But when the trimmed output is sent to a file with the -o output.fastq option is omitted, and output goes to standard output,
    • diagnostics must be are written to standard erroroutput
      • so can be redirected to a log file with 2> 1> trim.log
    • cutadapt -a CGTAATTCGCG -o trimmed.fastq  small.fq 1> trimmed.fastq 2> trim.log


Expand
titleReal example...


Code Block
languagebash
cd ~/gzips 
cutadapt -a AGATCGGAAGAGCACACGTCTGA small.fq  > trimmed.fq