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

Sample sheet channel factory docs tweaks #34

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ build
work
out
site
bin
16 changes: 8 additions & 8 deletions docs/samplesheets/samplesheetToList.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
title: Create a list
description: Function to create a list from a sample sheet.
title: Create a channel
description: Functions to create a list from a sample sheet.
---

# Create a list from a sample sheet

## `samplesheetToList`
## `samplesheetToList()`

This function validates and converts a sample sheet to a list. This is done using information encoded within a sample sheet schema (see the [docs](../nextflow_schema/sample_sheet_schema_specification.md)).
This function validates and converts a sample sheet to a Groovy list. This is done using information encoded within a sample sheet schema (see the [docs](../nextflow_schema/sample_sheet_schema_specification.md)).

The function has two mandatory arguments:
The function has two required arguments:

1. The path to the samplesheet
2. The path to the JSON schema file corresponding to the samplesheet.
Expand All @@ -28,19 +28,19 @@ This function can be used together with existing channel factories/operators to

### Use as a channel factory

The function can be given to the `.fromList` channel factory to mimic the functionality of a channel factory:
The function can be used with the `.fromList` channel factory to generate a queue channel:

```groovy
Channel.fromList(samplesheetToList("path/to/samplesheet", "path/to/json/schema"))
```

!!! note

This will mimic the `fromSamplesheet` channel factory as it was in [nf-validation](https://github.com/nextflow-io/nf-validation).
This will mimic the `fromSamplesheet` channel factory, found in the previous [nf-validation](https://github.com/nextflow-io/nf-validation).

### Use as a channel operator

The function can be used with the `.flatMap` channel operator to create a channel from samplesheets that are already in a channel:
Alternatively, the function can be used with the `.flatMap` channel operator to create a channel from samplesheet paths that are already in a channel:

```groovy
Channel.of("path/to/samplesheet").flatMap { samplesheetToList(it, "path/to/json/schema") }
Expand Down
Loading