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

[PROOF OF PRINCIPLE] Rename publish_by_id to publish_by_meta and add flexibility of taking a list of ids #590

Closed
wants to merge 7 commits into from

Conversation

drpatelh
Copy link
Member

@drpatelh drpatelh commented Apr 8, 2021

PR checklist

  • This comment contains a description of changes (with reason).
  • If you've fixed a bug or added code that should be tested, add tests!
  • If you've added a new tool - have you followed the pipeline conventions in the contribution docs
  • If necessary, also make a PR on the nf-core/rnaseq branch on the nf-core/test-datasets repository.
  • Make sure your code lints (nf-core lint .).
  • Ensure the test suite passes (nextflow run . -profile test,docker).
  • Usage Documentation in docs/usage.md is updated.
  • Output Documentation in docs/output.md is updated.
  • CHANGELOG.md is updated.
  • README.md is updated (including new tool citations and authors/contributors).

@drpatelh drpatelh marked this pull request as draft April 8, 2021 13:31
@github-actions
Copy link

github-actions bot commented Apr 8, 2021

nf-core lint overall result: Passed ✅ ⚠️

Posted for pipeline commit f31c187

+| ✅ 105 tests passed       |+
#| ❔  13 tests were ignored |#
!| ❗   5 tests had warnings |!

❗ Test warnings:

  • files_exist - File not found: environment.yml
  • files_exist - File not found: Dockerfile
  • nextflow_config - Config variable not found: process.container
  • readme - README did not have a Nextflow minimum version badge.
  • schema_params - Schema param config_profile_name not found from nextflow config

❔ Tests ignored:

✅ Tests passed:

Run details

  • nf-core/tools version 1.13.3
  • Run at 2021-04-08 16:22:48

Copy link
Member

@JoseEspinosa JoseEspinosa left a comment

Choose a reason for hiding this comment

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

Awesome solution! 💥

@drpatelh drpatelh changed the title Rename publish_by_id to publish_by_meta and add flexibility of taking a list of ids [PROOF OF PRINCIPLE] Rename publish_by_id to publish_by_meta and add flexibility of taking a list of ids Apr 8, 2021
path = path instanceof String ? path : id
path_list.add(path)
}
}
}
Copy link

Choose a reason for hiding this comment

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

What happens when the id is not String for example: publish_by_meta = [1, 2, 3] or when the meta[id] is true/false?

Copy link
Member Author

Choose a reason for hiding this comment

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

If the key is not a String it will be ignored via the statement below:

if (args.meta && key instanceof String) {

for (id in publish_id_list) {
if (args.meta && id instanceof String) {
def path = args.meta.containsKey(id) ? args.meta[id] : id
path = path instanceof String ? path : id
Copy link

Choose a reason for hiding this comment

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

Looks like all non-String path would be ignored. Would you try to convert the path to String here? Is it possible to treat boolean value to be yes/no and append it to the end of the key? Also, can you replace id to key in the for loop so that it won't be confused between meta['id'] and meta[id]?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea! Done 1ab8199

Copy link

@wkang0 wkang0 left a comment

Choose a reason for hiding this comment

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

Please don't forget to update the modules.conf header part:
/*


  • Config file for defining DSL2 per module options

  • Available keys to override module options:
  •   args            = Additional arguments appended to command in module.
    
  •   args2           = Second set of arguments appended to command in module (multi-tool modules).
    
  •   publish_dir     = Directory to publish results.
    
  •   publish_by_meta = Groovy list of keys available in meta map to append as directories to "publish_dir" path
    
  •                     If publish_by_meta = true                 - Value of ${meta['id']} is appended as a directory to "publish_dir" path
    
  •                     If publish_by_meta = ['id', 'custompath'] - If "id" is in meta map and "custompath" isn't then "${meta['id']}/custompath/"
    
  •                                                                 is appended as a directory to "publish_dir" path 
    
  •                     If publish_by_meta = false / null         - No directories are appended to "publish_dir" path
    
  •   publish_files   = Groovy map where key = "file_ext" and value = "directory" to publish results for that file extension
    
  •                     The value of "directory" is appended to the standard "publish_dir" path as defined above.
    
  •                     If publish_files = null (unspecified)     - All files are published.
    
  •                     If publish_files = false                  - No files are published.
    
  •   suffix          = File name suffix for output files.
    

*/

@drpatelh
Copy link
Member Author

Added in nf-core/modules#423 and #591

@drpatelh drpatelh closed this Apr 10, 2021
@drpatelh drpatelh deleted the publishid branch April 12, 2021 10:46
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

4 participants