piping cutadapt --paired-output into bwa ? logs are written to stdout
1
0
Entering edit mode
5.8 years ago

is it possible to pipe the output of cutadapt (v 1.9.1 ) into bwa in paired-end mode ?

I tried something like:

cutadapt   -a ${P1} -A{P2} --quiet -o - --paired-output - R1.fastq.gz R2.fastq.gz 2> /dev/null but the first line on stdout is a log message (?!) Trimming 2 adapters with at most 10.0% errors in paired-end mode ... @HWI-1KL149:101:C8410ACXX:8:1101:1402:2226 1:N:0:GAGAGGC (...) Is there a way to tell cutadapt to print those logs to stderr ?? (or is it a bug ?) . I don't want to use 'grep -v'. EDIT: cross-posted: https://github.com/marcelm/cutadapt/issues/167 cutadapt • 2.7k views ADD COMMENT 0 Entering edit mode If you don't want to use grep, you can use sed or perl to filter the output ;) e.g. ...| perl -ne 'print unless$. == 1' | ...
...| sed "1 d" |...


What's wrong with an intermediate filtering step?

0
Entering edit mode

"What's wrong with an intermediate filtering step ?" I don't know all the possible messages that could be sent to stdout.

5
Entering edit mode
5.8 years ago
Marcel M ▴ 100

If you use the -o option, then all log messages are sent to stdout. I've implemented it that way for backwards compatibility, but especially in combination with --quiet and -o -, it won't work so well, as you can see. I'll fix it somehow, please follow the bugreport you also opened.

Other than that, all bets are off when you use the minus sign to redirect two streams to standard output. I think it should work, giving you an interlaced output file, but I haven't explicitly tested this case and it's not really supported. A solution is to use two FIFOs. This should work (not tested):

mkfifo trimmed.1.fastq
mkfifo trimmed.2.fastq
cutadapt -a ${P1} -A${P2} -o trimmed.1.fastq -p trimmed.2.fastq R1.fastq.gz R2.fastq.gz > report.log &
bwa mem ref.fasta trimmed.1.fastq trimmed.2.fastq


I'll also add explicit support for interlaced output and then this will be easier.