# Using a program to pre-process the samplesheet

**URL:** https://community.seqera.io/t/using-a-program-to-pre-process-the-samplesheet/1259
**Category:** Ask for help
**Tags:** nf-core
**Created:** [October 4, 2024, 8:02pm UTC](https://community.seqera.io/t/using-a-program-to-pre-process-the-samplesheet/1259 "2024-10-04T20:02:21Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![ramirobarrantes](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/ramirobarrantes/32/717_2.png) [@ramirobarrantes](https://community.seqera.io/u/ramirobarrantes)
#### Post date: [October 4, 2024, 8:02pm UTC](https://community.seqera.io/t/using-a-program-to-pre-process-the-samplesheet/1259/1 "2024-10-04T20:02:21Z")

</div>

I am working on an nf-core pipeline. The way I have it setup is that I have four different types of sample sheets (one type for each instrument), and then I have a program that validates the sample sheet, and then creates a single sample sheet which is the one that actually goes into the nf-core pipeline. Is there a way for me to integrate my program into the pipeline? This is what I have in mind:

1. the user starts the pipeline with a sample sheet and the instrument type
2. program validates the sample sheet and creates a single sample sheet with two columns (ID, fastq)
3. pipeline proceeds

Any suggestions?

---

<div class="post-metadata">

### Author: ![mribeirodantas](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/mribeirodantas/32/235_2.png) [@mribeirodantas](https://community.seqera.io/u/mribeirodantas)
#### Post date: [October 6, 2024, 3:10am UTC](https://community.seqera.io/t/using-a-program-to-pre-process-the-samplesheet/1259/2 "2024-10-06T03:10:51Z")

</div>

There is a proof-of-concept for chaining nf-core-like pipelines. @mahesh.binzerpanchal called it [nf-cascade](https://github.com/mahesh-panchal/nf-cascade). With that, I believe you’d be able to run your pipeline and then the nf-core pipeline afterwards, with the finished samplesheet.

---

<div class="post-metadata">

### Author: ![ramirobarrantes](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/ramirobarrantes/32/717_2.png) [@ramirobarrantes](https://community.seqera.io/u/ramirobarrantes)
#### Post date: [October 7, 2024, 2:10pm UTC](https://community.seqera.io/t/using-a-program-to-pre-process-the-samplesheet/1259/3 "2024-10-07T14:10:21Z")

</div>

Thank you Marcel. However, I don’t really want to chain two nf-core pipelines. The first is just a simple R program that validates a sample sheet and prepares a new sample sheet, can this be integrated into an nf-core pipeline?

What I was doing before was just that I run my program and then run the pipeline, but I wanted to put this into seqera platform so then I need them both in one. However ,I just saw that you can do a “pre-run script”, and maybe that will work.

---

<div class="post-metadata">

### Author: ![mribeirodantas](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/mribeirodantas/32/235_2.png) [@mribeirodantas](https://community.seqera.io/u/mribeirodantas)
#### Post date: [October 9, 2024, 10:01pm UTC](https://community.seqera.io/t/using-a-program-to-pre-process-the-samplesheet/1259/4 "2024-10-09T22:01:04Z")

</div>

Yup, you can do a pre-run script with `beforeScript` (docs [here](https://www.nextflow.io/docs/latest/reference/process.html#beforescript)). You should be able to overwrite `params.input` with the processed samplesheet.

As for nf-cascade, it doesn’t have to be two nf-core pipelines. It can be any two pipelines, but depending on how far they are from nf-core standards, you may need to do some work on the pipeline code (check guidelines [here](https://github.com/mahesh-panchal/nf-cascade/wiki)).

---

<div class="post-metadata">

### Author: ![ramirobarrantes](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/ramirobarrantes/32/717_2.png) [@ramirobarrantes](https://community.seqera.io/u/ramirobarrantes)
#### Post date: [October 16, 2024, 10:01pm UTC](https://community.seqera.io/t/using-a-program-to-pre-process-the-samplesheet/1259/5 "2024-10-16T22:01:47Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
