Skip to content

Commit 7f61421

Browse files
add examples of how read from STDIN / write to STDOUT
1 parent d62d2b4 commit 7f61421

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

docs/examples.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,35 @@ Combining FASTQ output
6161
By default, AdapterRemoval will create one output file for each mate, one file for discarded reads, and (in PE mode) one file paired reads where one mate has been discarded, and (optionally) two files for collapsed reads. Alternatively, these files may be combined using the ``--combined-output``, in which case all output is directed to the mate 1 and (in PE mode) to the mate 2 file. In cases where reads are discarded due to trimming to due to being collapsed into a single sequence, the sequence and quality scores of the discarded read is replaced with a single 'N' with base-quality 0. This option may be combined with ``--interleaved`` / ``--interleaved-output``, to write a single, interleaved file in paired-end mode.
6262

6363

64+
Reading from STDIN and writing to STDOUT
65+
----------------------------------------
66+
67+
AdapterRemoval does not provide specific command-line options for for reading data from STDIN or writing data to STDOUT, but files are opened/read only once and no data is written to STDOUT. The only exception is the ``--identify-adapters`` command, which prints the identification results to STDOUT, but this command does not produce FASTQ output.
68+
69+
This means that it is possible to read data from STDIN simply by using the special files ``/dev/stdin`` and ``/dev/stdout``.
70+
71+
For example, to read FASTQ reads from STDIN assuming that ``fastq-producer`` is a command that produces FASTQ output (compressed or uncompressed)::
72+
73+
$ fastq-producer | AdapterRemoval --file1 /dev/stdin
74+
75+
Interleaved, paired-end reads are supported via the ``--interleaved-input`` and ``--interleaved`` options::
76+
77+
$ fastq-producer | AdapterRemoval --file1 /dev/stdin --interleaved-input
78+
79+
Similarly, to write FASTQ to STDOUT for SE and PE data::
80+
81+
$ AdapterRemoval --file1 my_reads.fq.gz --output1 /dev/stdout | fastq-consumer
82+
$ AdapterRemoval --file1 my_reads_1.fq.gz --file2 my_reads_2.fq.gz --interleaved-output --output1 /dev/stdout | fastq-consumer
83+
84+
This can be combined to both read from STDIN and write to STDOUT, assuming that ``fastq-consumer`` is a command that consumes FASTQ input::
85+
86+
$ fastq-producer | AdapterRemoval --file1 /dev/stdin --output1 /dev/stdout | fastq-consumer
87+
$ fastq-producer | AdapterRemoval --interleaved --file1 /dev/stdin --output1 /dev/stdout | fastq-consumer
88+
89+
The ``--combined-output`` option can be used to write *all* reads (mate 1, mate 2, singleton, merged, and discarded) to a file or to STDOUT::
90+
91+
AdapterRemoval --file1 my_reads_1.fq.gz --file2 my_reads_2.fq.gz --combined-output --output1 /dev/stdout | fastq-consumer
92+
6493
Different quality score encodings
6594
---------------------------------
6695

0 commit comments

Comments
 (0)