Dear developers,
Thanks for creating such a amazing tool!
Summary
When using .gz FASTQ with index=True, readSeqFile ignores key_func and uses rec.id directly as keys.
This causes PairSeq to fail for --coord presto because rec.id contains metadata (e.g. |CONSCOUNT=...) and does not match getCoordKey(...) results.
Steps to Reproduce
- Use
PairSeq.py on presto Consensus files in .fastq.gz:
PairSeq.py -1 /path/to/*.R1_consensus-pass.fastq.gz \
-2 /path/to/*.R2_consensus-pass.fastq.gz \
--coord presto --outdir /path/to/out --outname sample
- Observe that no pairs are found (PASS=0).
Expected Behavior
--coord presto should match reads by stripping annotations after |, so paired reads should be found.
Actual Behavior
No pairs found (PASS=0), because .gz indexing uses rec.id directly.
Example:
rec.id = GTAGCATATG|CONSCOUNT=1|PRCONS=IgA_5-primer_Leading_sequence|PRFREQ=1.0
getCoordKey(..., coord_type="presto") -> GTAGCATATG
Mismatch caused by .gz indexing ignoring key_func.
Root Cause (in code)
Current .gz path (index=True):
seq_records = {rec.id: rec for rec in SeqIO.parse(handle, seq_type)}
This bypasses key_func.
Proposed Fix
Use key_func for .gz indexing as well:
if key_func is None:
seq_records = {rec.id: rec for rec in SeqIO.parse(handle, seq_type)}
else:
seq_records = {key_func(rec.id): rec for rec in SeqIO.parse(handle, seq_type)}
This makes .gz behavior consistent with non-.gz indexing.
Best regards,
Chenyu Pei
Dear developers,
Thanks for creating such a amazing tool!
Summary
When using
.gzFASTQ withindex=True,readSeqFileignoreskey_funcand usesrec.iddirectly as keys.This causes PairSeq to fail for
--coord prestobecauserec.idcontains metadata (e.g.|CONSCOUNT=...) and does not matchgetCoordKey(...)results.Steps to Reproduce
PairSeq.pyon presto Consensus files in.fastq.gz:Expected Behavior
--coord prestoshould match reads by stripping annotations after|, so paired reads should be found.Actual Behavior
No pairs found (PASS=0), because
.gzindexing usesrec.iddirectly.Example:
Mismatch caused by
.gzindexing ignoringkey_func.Root Cause (in code)
Current
.gzpath (index=True):This bypasses
key_func.Proposed Fix
Use
key_funcfor.gzindexing as well:This makes
.gzbehavior consistent with non-.gzindexing.Best regards,
Chenyu Pei