---
format: gfm
---
```{r setup, include=FALSE}
package <- yaml::read_yaml("_viash.yaml")
license <- paste0(package$links$repository, "/blob/main/LICENSE")
contributing <- paste0(package$links$repository, "/blob/main/CONTRIBUTING.md")

pkg <- package$name
ver <- if (!is.null(package$version)) package$version else "v0.3.0"
comp <- "concat_rtext"
```
# 🪡📦 `r pkg`

[![ViashHub](https://img.shields.io/badge/ViashHub-`r pkg`-7a4baa.svg)](https://www.viash-hub.com/packages/`r pkg`) 
[![GitHub](https://img.shields.io/badge/GitHub-viash--hub%2F`r pkg`-blue.svg)](`r package$links$repository`) 
[![GitHub License](https://img.shields.io/github/license/viash-hub/`r pkg`.svg)](`r license`) 
[![GitHub Issues](https://img.shields.io/github/issues/viash-hub/`r pkg`.svg)](`r package$links$issue_tracker`) 
[![Viash version](https://img.shields.io/badge/Viash-v`r gsub("-", "--", package$viash_version)`-blue.svg)](https://viash.io)

`r package$summary`

## Introduction

`r package$description`

## Example Usage

Viash components in `r pkg` can be run in various ways:

```{r mmd, echo=FALSE, results='asis'}
cat(
  "```mermaid\n",
  "flowchart TD\n",
  "    A[", pkg, " ", ver, "] --> B(Viash Hub Launch)\n",
  "    A --> C(Viash CLI)\n",
  "    A --> D(Nextflow CLI)\n",
  "    A --> E(Seqera Cloud)\n",
  "    A --> F(As a dependency)\n",
  "```\n",
  sep = ""
)
```

### 1. Via the Viash Hub Launch interface

You can run this component directly from the Viash Hub [Launch interface](https://www.viash-hub.com/launch?package=`r pkg`&version=`r ver`&component=`r comp`&runner=Executable).

![](docs/viash-hub.png)

### 2. Via the Viash CLI

You can run this component directly from the command line using the Viash CLI.

```bash
viash run vsh://`r pkg`@`r ver`/`r comp` -- --help

viash run vsh://`r pkg`@`r ver`/`r comp` -- \
  --input path/to/input.txt \
  --input path/to/compressed.txt.gz \
  --output path/to/output.txt
```

This will run the component with the specified input files and output the results to the specified output file.

### 3. Via the Nextflow CLI or Seqera Cloud

You can run this component as a Nextflow pipeline.

```bash
nextflow run https://packages.viash-hub.com/vsh/`r pkg` \
  -revision `r ver` \
  -main-script target/nextflow/`r comp`/main.nf \
  -latest -resume \
  -profile docker \
  --input "path/to/input.txt;path/to/compressed.txt.gz" \
  --output path/to/output.txt
```

**Note:** Make sure that the [Nextflow SCM](https://www.nextflow.io/docs/latest/git.html#git-configuration) is set up properly. You can do this by adding the following lines to your `~/.nextflow/scm` file:

```groovy
providers.vsh.platform = 'gitlab'
providers.vsh.server = 'https://packages.viash-hub.com'
```

**Tip:** This will also work with Seqera Cloud or other Nextflow-compatible platforms.

### 4. As a dependency

In your Viash config file (`config.vsh.yaml`), you can add this component as a dependency:

```yaml
dependencies:
  - name: `r comp`
    repository: vsh://`r pkg`@`r ver`
```

**Tip:** See the [Viash documentation](https://viash.io/guide/nextflow_vdsl3/create-a-pipeline.html#pipeline-as-a-component) for more details on how to use Viash components as a dependency in your own Nextflow workflows.

## Contributing

Contributions are welcome! We aim to build a comprehensive collection of high-quality bioinformatics components. If you'd like to contribute, please follow these general steps:


```{r echo=FALSE}
lines <- readr::read_lines("CONTRIBUTING.md")

index_start <- grep("^### Step [0-9]*:", lines)

index_end <- c(index_start[-1] - 1, length(lines))

name <- gsub("^### Step [0-9]*: *", "", lines[index_start])

knitr::asis_output(
  paste(paste0(" 1. ", name, "\n"), collapse = "")
)
```

See the [CONTRIBUTING](`r contributing`) file for more details.
