Question: How to save trimmomatic terminal summary to an output file?
0
gravatar for DNAngel
9 months ago by
DNAngel30
DNAngel30 wrote:

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 • 480 views
ADD COMMENTlink modified 9 months ago • written 9 months ago by DNAngel30
1
gravatar for DNAngel
9 months ago by
DNAngel30
DNAngel30 wrote:

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 COMMENTlink modified 9 months ago by RamRS24k • written 9 months ago by DNAngel30
2

&>> 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 REPLYlink written 9 months ago by RamRS24k
1

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 REPLYlink written 9 months ago by ATpoint23k

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 REPLYlink modified 9 months ago • written 9 months ago by RamRS24k
3
gravatar for WouterDeCoster
9 months ago by
Belgium
WouterDeCoster41k wrote:

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 COMMENTlink written 9 months ago by WouterDeCoster41k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1141 users visited in the last hour