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

Added pulling out a specific member of an array to FAQ #327

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions src/faq.md
Original file line number Diff line number Diff line change
@@ -455,3 +455,32 @@ https://github.com/common-workflow-language/common-workflow-language/blob/master

% - https://github.com/common-workflow-language/user_guide/issues/6
% - Maybe adapt some of these (or move to a workaround?) https://www.synapse.org/#!Synapse:syn2813589/wiki/401464

## Pulling Out a Specific Member of an Array

This example demonstrates how you can get a specific file in an array. This could be useful when you are taking files produced from another step in a workflow and need to capture a specific one.
Copy link
Member

Choose a reason for hiding this comment

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

Following up on what @swzCuroverse said, there needs to be more text explaining why/how this works.

  • order of operations ("source" before "valueFrom")
  • What "valueFrom" does
  • what "self" means in this context

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you @tetron for the feedback. I'll make updates 🙂


```yaml
cwlVersion: v1.0
class: Workflow

inputs: []

steps:
generates_an_array:
run: array_of_files.cwl
in: {}
out: [ an_array_of_files ]
single_file_processor:
run: only_one_file_input_tool.cwl
in:
raw_file: # this is type: File
source: generates_an_array/an_array_of_files
valueFrom: $(self[0])
out: [ result ]

outputs:
result:
type: File
outputSource: single_file_processor/result
```