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

ENH: Adds FileDictMixin #347

Open
wants to merge 16 commits into
base: dev
Choose a base branch
from

Conversation

VinzentRisch
Copy link
Contributor

@VinzentRisch VinzentRisch commented Oct 15, 2024

solves #346

  • Adds FileDictMixin class that includes the function file_dict.

  • For per sample directories it returns a mapping of sample id to another dictionary where keys represent the ID and values correspond to the filepath for each file.

  • For files, it returns a mapping of ID to filepath for each file.

  • To create the ID the specified suffix is removed from the filename. it is expected that the suffix is given with the used separator character like ".report"

  • This mixin can only be added to classes with a pathspec attribute.

  • For now it is added to Kraken2ReportDirectoryFormat and Kraken2OutputsDirectoryFormat.

  • I also removed GenomeDataDirFmt and its genome_dict function and added FileDictMixin to GenesDirectoryFormat, ProteinsDirectoryFormat, LociDirectoryFormat and GenomeSequencesDirectoryFormat

This Mixin would also work with MAGSequencesDirFmt and MultiMAGSequencesDirFmt.

@VinzentRisch VinzentRisch marked this pull request as ready for review October 17, 2024 14:01
@ebolyen ebolyen self-assigned this Dec 12, 2024
@VinzentRisch
Copy link
Contributor Author

Hi @ebolyen @lizgehret
Could someone have a look at this?
The Idea is to have a mixin that can be added to any directory format that enables the format to use a file_dict function, similar to sample_dict function in MultiMAGSequencesDirFmt. So that the sample_dict function does not have to be added to any new formats.
This would be helpful for bokulich-lab/q2-annotate#212 and for my new plugin that I am working on right now.

Let me know if this makes sense to you or if you have any questions.

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

Successfully merging this pull request may close these issues.

2 participants