flowcraft.templates.trimmomatic_report module


This module is intended parse the results of the Trimmomatic log for a set of one or more samples.

Expected input

The following variables are expected whether using NextFlow or the main() executor.

  • log_files: Trimmomatic log files.
    • e.g.: 'Sample1_trimlog.txt Sample2_trimlog.txt'

Generated output

  • trimmomatic_report.csv : Summary report of the trimmomatic logs for all samples

Code documentation


Retrieves some statistics from a single Trimmomatic log file.

This function parses Trimmomatic’s log file and stores some trimming statistics in an OrderedDict object. This object contains the following keys:

  • clean_len: Total length after trimming.
  • total_trim: Total trimmed base pairs.
  • total_trim_perc: Total trimmed base pairs in percentage.
  • 5trim: Total base pairs trimmed at 5’ end.
  • 3trim: Total base pairs trimmed at 3’ end.
log_file : str

Path to trimmomatic log file.

x : OrderedDict

Object storing the trimming statistics.

flowcraft.templates.trimmomatic_report.write_report(storage_dic, output_file, sample_id)[source]

Writes a report from multiple samples.

storage_dic : dict or OrderedDict

Storage containing the trimming statistics. See parse_log() for its generation.

output_file : str

Path where the output file will be generated.

sample_id : str

Id or name of the current sample.