Skip to content

Genomic Read Summary

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

Install PySEGUL using pip if you haven’t done it yet

Terminal window
pip install pysegul

Create a new Python script, import the library, and write python code.

import pysegul
def summarize_reads():
input_dir = 'tests/raw-data'
input_format = 'auto'
summary_mode = 'default'
prefix = 'read_summary'
output_dir = 'tests/output'
summary = pysegul.ReadSummary(
input_format,
summary_mode,
output_dir,
prefix
)
summary.from_dir(input_dir)

You can also input the alignment paths in a list directly instead of using a directory. Replace the input_dir with input_files and provide a list of paths. Then, call the from_files method instead of from_dir.

import pysegul
def summarize_reads():
input_path = ['tests/raw-data/read1.fastq', 'tests/raw-data/read2.fastq']
input_format = 'auto'
# Available values for summary_mode: 'default', 'complete', 'minimal'.
summary_mode = 'default'
prefix = 'read_summary'
output_dir = 'tests/output'
summary = pysegul.ReadSummary(
input_format,
summary_mode,
output_dir,
prefix
)
summary.from_files(input_path)

In complete mode, the output directory also has per-position statistics (read-pos-summary.zip), read distributions (read-dist-summary.zip), and all statistics as JSON (read-report.json), which you can load with Python’s json module:

import json
with open('tests/output/read_summary_read-report.json') as f:
report = json.load(f)
for sample in report['samples']:
metrics = sample['metrics']
print(sample['sample'], metrics['read_count'], metrics['q30_pct'], metrics['duplicate_pct_est'])

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.