How to save trimmomatic terminal summary to an output file?
2
0
Entering edit mode
5.4 years ago
DNAngel ▴ 250

I can't use the trimmomatic -trimlog output because it severely slows down the process and I just want to save the summary statistics. The statistics show up as the stdout on the terminal window but I cannot figure out how to save that to my own output file in my bash script.

#!/bin/bash
for files in .
do
java -jar /path/to/trimmomatic-jar SE -phred33 ${files} ${files%%.fastq}_trimmed.fastq ILLUMINACLIP:/path/to/trimmomatic/adapters.fa:2:30:10 SLIDINGWINDOW:4:20 > log.txt
done

Using > log.txt at the end does not work, neither did: command | tee log.txt nor did command >> script log.txt nor did command 2& > log.txt

Anyone have any ideas?

trimmomatic • 3.8k views
ADD COMMENT
1
Entering edit mode
5.4 years ago
DNAngel ▴ 250

Thanks for the help everyone but I got it to work simply with:

commands &>> output.file

This allowed me to save the actual output from the terminal instead of using trimlog which TAKES FOREVER. Now this saves just the main statistics all in one file neatly.

ADD COMMENT
2
Entering edit mode

&>> appends STDOUT and STDERR to the same file. You might benefit from not mixing stuff up and piping 2>file.err 1>file.out

ADD REPLY
1
Entering edit mode

Agreed. Once you start using pipes (and you will/should for larger NGS data) this &>> will likely eventually corrupt your output files. Go with the suggestion of Wouter using 2>.

ADD REPLY
0
Entering edit mode

If an answer was helpful, you should upvote it; if the answer resolved your question, you should mark it as accepted. You can accept more than one answer if they all work.

Upvote|Bookmark|Accept

ADD REPLY
3
Entering edit mode
5.4 years ago

I think it's written to stderr, not stdout, so you can redirect those logs to a file as below:

command 2> log.txt

ADD COMMENT

Login before adding your answer.

Traffic: 3199 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6