Skip to content

Skip copying specified files with an exclusion pattern#11

Merged
RyanBerger98 merged 4 commits into
mainfrom
exclude
Apr 3, 2026
Merged

Skip copying specified files with an exclusion pattern#11
RyanBerger98 merged 4 commits into
mainfrom
exclude

Conversation

@standage

@standage standage commented Apr 1, 2026

Copy link
Copy Markdown
Member

This PR adds a new feature that skips copying for user-specified FASTQ files. It doesn't affect the initial FASTQ file discovery stage: if, for instance, ezfastq is expecting paired-end data, it will still fail if more or less than two FASTQ files are found for any sample. But after successful discovery, the new feature will skip copying for files matching the user-specified exclusion pattern (typically something like "R2").

Pair programming with @danejo3

Comment thread ezfastq/cli.py
Comment on lines +117 to +124
parser.add_argument(
"-x",
"--exclude",
metavar="REGEX",
type=str,
default=None,
help="skip copying FASTQ files containing the given substring",
)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

New -x/--exclude argument in the CLI.

Comment thread ezfastq/api.py
subdir="seq",
link=False,
verbose=False,
excl_pattern=None,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

New excl_pattern argument in the Python API.

Comment thread ezfastq/copier.py
Comment on lines +121 to +122
if self.excl_pattern and re.search(self.excl_pattern, source_path.name):
continue

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Core change in this PR. All other changes are supporting updates to the interfaces or tests of the new behavior.

@standage standage requested a review from RyanBerger98 April 1, 2026 15:31
@standage

standage commented Apr 1, 2026

Copy link
Copy Markdown
Member Author

Calling @RyanBerger98 for the code review, although would welcome any feedback you might have @rnmitchell. Thanks!

@rnmitchell

Copy link
Copy Markdown
Contributor

This looks good to me!

@RyanBerger98 RyanBerger98 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Updates look good and functionality is as expected. Minor comments/concerns.

Comment thread ezfastq/copier.py Outdated
Comment on lines 114 to 115

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I recommend updating the __len__ attribute of the FastqCopier class. Right now if using the exclude flag, ezfastq will say its copying over 2 files when it's really only copying 1.

def __len__(self):
    return len([fastq for fastq in self]) 

Simplifies the length attribute and makes it more accurate.

Comment thread ezfastq/cli.py
Comment on lines 52 to 56
[bold cyan]Examples:[/bold cyan]
[dim]ezfastq /path/to/fastqs/ sample1 sample2 sample3
ezfastq /path/to/fastqs/ s1:Sample1 s2:Sample2 s3:Sample3
ezfastq /path/to/fastqs/ samplenames.txt
ezfastq /path/to/fastqs/ samplenames.txt --workdir /path/to/projectdir/ --subdir seq/Run01/

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Also might be worth updating the CLI epilogue to include a command using the --exclude flag

ezfastq /path/to/fastqs/ sample1 sample2 --exclude "[r,R]2"

@standage

standage commented Apr 3, 2026

Copy link
Copy Markdown
Member Author

Great suggestions. I updated the __len__ function, the epilog, and one of the tests.

@RyanBerger98 RyanBerger98 merged commit 0f4d7ee into main Apr 3, 2026
4 checks passed
@standage standage deleted the exclude branch April 6, 2026 12:51
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.

3 participants