Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes issue with fastq.gz files having _I1_ etc. #109

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

charles-cowart
Copy link
Collaborator

Fixes issue with fastq.gz files having I1, R1, etc. in parts of the file-name other than the expected location.
This fix is currently working in qiita-rc.

Fixes issue with fastq.gz files having _I1_, _R1_, etc. in parts of the
file-name other than the expected location.
Copy link
Contributor

@antgonza antgonza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A question. Also, will this be propagated to the other libraries for SPP or do we need PRs updating those too?

sequence_processing_pipeline/FastQCJob.py Show resolved Hide resolved
sequence_processing_pipeline/FastQCJob.py Show resolved Hide resolved
sequence_processing_pipeline/FastQCJob.py Outdated Show resolved Hide resolved
sequence_processing_pipeline/FastQCJob.py Show resolved Hide resolved
i2_only = [x for x in files if '_I2_' in x]
# use capturing to handle both raw files as well as trimmed and
# filtered files. We don't need to process the captured string.
i1_files = compile(r"^.*_L\d{3}_I1_\d{3}\.(trimmed\.|filtered"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the capture group, it doesn't seem like it's used?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A side of effect of using the capture group is that I can use one regex to handle '.trimmed.fastq.gz', '.filtered.fastq.gz', and '.fastq.gz' files. Brackets ('[',']') and ORs ('|') didn't work for me.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not good practice to rely on side effects... Suggest adding ?:, see

>>> import re
>>> re.compile(r'(?:foo|bar)?baz').match('baz')
<re.Match object; span=(0, 3), match='baz'>
>>> re.compile(r'(?:foo|bar)?baz').match('foobaz')
<re.Match object; span=(0, 6), match='foobaz'>
>>> re.compile(r'(?:foo|bar)?baz').match('barbaz')
<re.Match object; span=(0, 6), match='barbaz'>
>>> re.compile(r'(?:foo|bar)?baz').match('fbaz')
>>>

r1_only = []
r2_only = []

for some_path in files:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a regression test to verify that the bug exists and these changes fix it

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'll add a test with the old filenames to show how they fail.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. It's important that bugs are coupled with regression tests to ensure they are fixed and don't arise again

@coveralls
Copy link

coveralls commented Oct 30, 2023

Pull Request Test Coverage Report for Build 6698670902

  • 18 of 21 (85.71%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.1%) to 83.304%

Changes Missing Coverage Covered Lines Changed/Added Lines %
sequence_processing_pipeline/FastQCJob.py 18 21 85.71%
Totals Coverage Status
Change from base Build 6632678122: -0.1%
Covered Lines: 2073
Relevant Lines: 2354

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants