Skip to content

Commit

Permalink
refactor: split out pixelator dependency in CHECK_SAMPLESHEET
Browse files Browse the repository at this point in the history
  • Loading branch information
fbdtemme committed Aug 10, 2023
1 parent 91c5db8 commit f177cf7
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 19 deletions.
5 changes: 2 additions & 3 deletions bin/check_samplesheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@
import argparse
import csv
import logging
import re
import sys
import urllib.parse
from collections import Counter
from os import PathLike
from pathlib import Path, PurePath
import re
from typing import Iterable, List, MutableMapping, Optional, Set
from os import PathLike

logger = logging.getLogger()

Expand Down
6 changes: 0 additions & 6 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ process {
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]

withName: 'SAMPLESHEET_CHECK' {
if (params.pixelator_container) {
container = params.pixelator_container
}
}

withName: COLLECT_METADATA {
publishDir = [
path: { "${params.outdir}/pipeline_info" },
Expand Down
26 changes: 26 additions & 0 deletions modules/local/pixelator/list_designs.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
process PIXELATOR_LIST_DESIGNS {
label 'process_single'

// TODO: Update once pixelator is public in bioconda
conda "local::pixelator=0.12.0"
container "ghcr.io/pixelgentechnologies/pixelator:0.12.0"

output:
path "design_options.txt" , emit: designs
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''

"""
pixelator single-cell --list-designs $args > design_options.txt
cat <<-END_VERSIONS > versions.yml
"${task.process}":
pixelator: \$(echo \$(pixelator --version 2>/dev/null) | sed 's/pixelator, version //g' )
END_VERSIONS
"""
}
13 changes: 6 additions & 7 deletions modules/local/samplesheet_check.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ process SAMPLESHEET_CHECK {
tag "$samplesheet"
label 'process_single'

// TODO: Update once pixelator is public in bioconda
conda "local::pixelator=0.12.0"
container "ghcr.io/pixelgentechnologies/pixelator:0.12.0"
conda "conda-forge::python=3.8.3"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/python:3.8.3' :
'biocontainers/python:3.8.3' }"

input:
path samplesheet
path design_options
val samplesheet_path

output:
Expand All @@ -21,19 +23,16 @@ process SAMPLESHEET_CHECK {
def args = task.ext.args ?: ''

"""
pixelator single-cell --list-designs > design_options.txt
check_samplesheet.py \\
$samplesheet \\
samplesheet.valid.csv \\
--samplesheet-path $samplesheet_path \\
--design-options design_options.txt \\
--design-options $design_options \\
$args
cat <<-END_VERSIONS > versions.yml
"${task.process}":
python: \$(python --version | sed 's/Python //g')
pixelator: \$(echo \$(pixelator --version 2>/dev/null) | sed 's/pixelator, version //g' )
END_VERSIONS
"""
}
15 changes: 12 additions & 3 deletions subworkflows/local/input_check.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,24 @@
// Check input samplesheet and get read channels
//

include { SAMPLESHEET_CHECK } from '../../modules/local/samplesheet_check'
include { SAMPLESHEET_CHECK } from '../../modules/local/samplesheet_check'
include { PIXELATOR_LIST_DESIGNS } from '../../modules/local/pixelator/list_designs.nf'

workflow INPUT_CHECK {
take:
samplesheet // file: /path/to/samplesheet.csv

main:
ch_samplesheet_rows = SAMPLESHEET_CHECK ( samplesheet, samplesheet.toUri() )
.csv

PIXELATOR_LIST_DESIGNS()

SAMPLESHEET_CHECK (
samplesheet,
PIXELATOR_LIST_DESIGNS.out.designs,
samplesheet.toUri()
)

ch_samplesheet_rows = SAMPLESHEET_CHECK.out.csv
.splitCsv ( header:true, sep:',' )

reads = ch_samplesheet_rows.map { create_fastq_channel(it) }
Expand Down

0 comments on commit f177cf7

Please sign in to comment.