Summary statistics for raw sequence reads in FASTQ format. For assembled contigs, see Genomic Contig Summary.
Example
Section titled “Example”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'])Options
Section titled “Options”| Option | Default | Description |
|---|---|---|
input_fmt | Required | 'auto', 'fastq', 'gzip' |
mode | Required | 'minimal', 'default', or 'complete'. See Summary modes |
output_path | Required | Output directory |
output_prefix | None | Name of the output files |
phred (beta) | 'auto' | Quality score offset: 'auto', '33', '64' |
dup_sketch_size (beta) | 100000 | Distinct sequences kept to estimate duplication in complete mode |
plot (beta) | None | Chart options. See Charts and Reports |
Methods
Section titled “Methods”| Method | Description |
|---|---|
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.
Summary modes
Section titled “Summary modes”| Mode | Output |
|---|---|
'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')Quality checks
Section titled “Quality checks”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'])