Skip to content

Pair detection fails for files containing multiple _1 or _R1 substrings #57

Description

@pansapiens

When running with the commandline options -extn .fq.gz -paired -pairIds _1,_2 and input FASTQs named like R_10_1.fq.gz and R_10_2.fq.gz, RNAsik fails with the error:

Fatal error: /scratch/pl41/laxy/jobs/miniconda3/envs/rnasik-1.5.4/bin/../opt/rnasik-1.5.4/src/sikFqFiles.bds, line 247, pos 17. -paired set to true, but can't find _2 read. Is it single-end data? Also check your -pairIds _1,_2
Stack trace:
error "-paired set to $paired, but can't find $pai ...  # /scratch/pl41/laxy/jobs/miniconda3/envs/rnasik-1.5.4/bin/../opt/rnasik-1.5.4/src/sikFqFiles.bds:247
  samplesSheet = makeSamplesSheet( fqFiles,fqRgxs, ...  # /scratch/pl41/laxy/jobs/miniconda3/envs/rnasik-1.5.4/bin/../opt/rnasik-1.5.4/src/RNAsik.bds:93

I believe this is because when it looks for the corresponding _2file here, the filename is incorrectly generated:
https://github.com/MonashBioinformaticsPlatform/RNAsik-pipe/blob/master/src/sikFqFiles.bds#L242

eg, string chkR2 = fq.replace(pairIdsList[0], pairIdsList[1])

if:

fq = "R_10_1.fq.gz"
pairIdsList = ["_1", "_2"]

then we would get chkR2 set to "R_20_2.fq.gz" rather than the expected R_10_2.fq.gz

There are also corner cases where this could also result in mis-pairing of files (eg, if the incorrectly generated filename "R_20_2.fq.gz" happened to exist)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions