Skip to content

Genomic Read Summary

Summary statistics for raw sequence reads in FASTQ format. For assembled contigs, see Genomic Contig Summary.

import pysegul
def summarize_reads():
summary = pysegul.ReadSummary(
input_fmt='auto',
mode='default',
output_path='tests/output',
output_prefix='read_summary',
)
outputs = summary.from_dir('tests/raw-data')

To use a list of files, call from_files instead of from_dir:

summary.from_files(['tests/raw-data/read1.fastq', 'tests/raw-data/read2.fastq'])
OptionDefaultDescription
input_fmtRequired'auto', 'fastq', 'gzip'
modeRequired'minimal', 'default', or 'complete'. See Summary modes
output_pathRequiredOutput directory
output_prefixNoneName of the output files
phred (beta)'auto'Quality score offset: 'auto', '33', '64'
dup_sketch_size (beta)100000Distinct sequences kept to estimate duplication in complete mode
plot (beta)NoneChart options. See Charts and Reports
MethodDescription
from_dir(input_dir)Summarize the read files in a directory
from_files(input_files)Summarize a list of read files

Both return a dictionary of output paths: summary, positions, distributions, report, and plots. positions, distributions, and report are written in complete mode only.

ModeOutput
'minimal'Read count only
'default'Essential statistics. See the CLI guideline
'complete'Essential statistics, plus per-position statistics (read-pos-summary.zip), read distributions (read-dist-summary.zip), and all statistics as JSON (read-report.json), including duplication, overrepresented sequences, and adapter content

Complete mode matches the read quality checks of FastQC and fastp, and adds options only SEGUL has. See how SEGUL compares.

summary = pysegul.ReadSummary(
'auto',
'complete',
'tests/output',
'read_summary',
phred='33',
plot=pysegul.PlotOptions(format='svg'),
)
outputs = summary.from_dir('tests/raw-data')

Load the JSON report with load_read_report. Each sample has its statistics, the read quality checks (qc), and the worst status among them (qc_status: 'Pass', 'Warn', or 'Fail'). These are the same checks the GUI and the segul view summary viewer show.

report = pysegul.load_read_report(outputs['report'])
for sample in report['samples']:
metrics = sample['metrics']
print(sample['sample'], metrics['read_count'], sample['qc_status'])
for check in sample['qc']:
print(' ', check['name'], round(check['value'], 1), check['unit'], check['status'])

This material is based upon work supported by the National Science Foundation under grant numbers: DEB-1754393 and DEB-2244754. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the National Science Foundation.