Skip to content

Commit

Permalink
Sample sheet channel factory docs tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
ewels committed May 7, 2024
1 parent c0cace6 commit e7921be
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
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

0 comments on commit e7921be

Please sign in to comment.