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

feat: cooltools wrappers #519

Merged
merged 37 commits into from Aug 16, 2022
Merged

feat: cooltools wrappers #519

merged 37 commits into from Aug 16, 2022

Conversation

Phlya
Copy link
Contributor

@Phlya Phlya commented Jul 8, 2022

Description

Added the first wrapper to cooltools, chose to try with cooltools insulation to see how it works.
ADD: now also added two more wrappers, will add more.

I think I did everything correctly, but it's my first time :)

QC

For all wrappers added by this PR, I made sure that

  • there is a test case which covers any introduced changes,
  • input: and output: file paths in the resulting rule can be changed arbitrarily,
  • either the wrapper can only use a single core, or the example rule contains a threads: x statement with x being a reasonable default,
  • rule names in the test case are in snake_case and somehow tell what the rule is about or match the tools purpose or name (e.g., map_reads for a step that maps reads),
  • all environment.yaml specifications follow the respective best practices,
  • wherever possible, command line arguments are inferred and set automatically (e.g. based on file extensions in input: or output:),
  • all fields of the example rules in the Snakefiles and their entries are explained via comments (input:/output:/params: etc.),
  • stderr and/or stdout are logged correctly (log:), depending on the wrapped tool,
  • temporary files are either written to a unique hidden folder in the working directory, or (better) stored where the Python function tempfile.gettempdir() points to (see here; this also means that using any Python tempfile default behavior works),
  • the meta.yaml contains a link to the documentation of the respective tool or command,
  • Snakefiles pass the linting (snakemake --lint),
  • Snakefiles are formatted with snakefmt,
  • Python wrapper scripts are formatted with black.

@Phlya Phlya changed the title feat: cooltools insulation feat: cooltools wrappers Jul 10, 2022
@fgvieira
Copy link
Collaborator

fgvieira commented Jul 18, 2022

Hi @Phlya, and thanks for your contributions!

Made some suggestions. If they make sense, can you also apply them on the other wrappers?

Also, does cooltools use a temp directory?

@Phlya
Copy link
Contributor Author

Phlya commented Jul 18, 2022

Thank you for the comments @fgvieira! I'll look through them carefully.

I don't think any of the tools use a temporary directory or any temporary files, but I'll check. Does it need to be treated in a special way somehow?

@fgvieira
Copy link
Collaborator

If they use a temporary folder, use python's tempfile (you can check other wrappers for inspiration).

Phlya and others added 6 commits July 18, 2022 22:46
Co-authored-by: Filipe G. Vieira <fgarrettvieira@gmail.com>
Co-authored-by: Filipe G. Vieira <fgarrettvieira@gmail.com>
Co-authored-by: Filipe G. Vieira <fgarrettvieira@gmail.com>
@Phlya
Copy link
Contributor Author

Phlya commented Jul 26, 2022

I tried not specifying any dependencies in the environment and it seems to work fine! I think now this is ready for merging?

@fgvieira
Copy link
Collaborator

fgvieira commented Aug 3, 2022

I think it looks good, apart from "range" where I hope @johanneskoester can give some input.

@Phlya
Copy link
Contributor Author

Phlya commented Aug 3, 2022

Thank you! I could make something nicer for the range, but I think in the next version it won't be a required argument anymore, so don't want to invest too much into dealing with it.

@Phlya
Copy link
Contributor Author

Phlya commented Aug 3, 2022

So after all I added the final wrapper that I was having problems with earlier.

@Phlya
Copy link
Contributor Author

Phlya commented Aug 4, 2022

I removed the import where things were failing... But it shouldn't have failed anyway, that package should be installed as a dependency.

@Phlya
Copy link
Contributor Author

Phlya commented Aug 4, 2022

Why is it failing when importing in the Snakefile?

@Phlya
Copy link
Contributor Author

Phlya commented Aug 4, 2022

Ah I guess the environment is only activated within the execution of the rule! Oh that's tricky, is there a recommended way to circumvent that? The test data is too big to be in the repo and needs to be downloaded, and the normal way to do it is using the cooltools package...

@fgvieira
Copy link
Collaborator

fgvieira commented Aug 4, 2022

Can you make a smaller dummy test dataset?

@Phlya
Copy link
Contributor Author

Phlya commented Aug 4, 2022

In principle yes.

@fgvieira
Copy link
Collaborator

fgvieira commented Aug 4, 2022

Then it should be fine for testing purposes.

@Phlya
Copy link
Contributor Author

Phlya commented Aug 4, 2022

OK thanks, I did it.

@Phlya
Copy link
Contributor Author

Phlya commented Aug 10, 2022

Hi, do we need @johanneskoester to approve the solution for "range"? I'd like for this to be merged soon...

@fgvieira
Copy link
Collaborator

Yeah, I'd like to hear his opinion on the "range" solution.
Either way, only he can make a new release.

@johanneskoester
Copy link
Contributor

Sorry for being late to the party. I have a look now.

bio/cooltools/dots/environment.yaml Outdated Show resolved Hide resolved
bio/cooltools/dots/test/Snakefile Outdated Show resolved Hide resolved
"CN_{resolution,[0-9]+}.saddledump.npz",
params:
## Add optional parameters
range="--qrange 0.01 0.99",
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is ok.

@johanneskoester johanneskoester merged commit d28de15 into snakemake:master Aug 16, 2022
@Phlya
Copy link
Contributor Author

Phlya commented Aug 16, 2022

Thanks a lot @johanneskoester !

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.

None yet

3 participants