Skip to content
Open
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
29 changes: 23 additions & 6 deletions modules/local/star_align.nf
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,36 @@ process STAR_ALIGN {

// separate forward from reverse pairs
def (forward, reverse) = reads.collate(2).transpose()

// parse whitelist file(s)
arg_whitelist = ""
decompress_cmd = ""
def whitelistList = whitelist ? (whitelist instanceof List ? whitelist : [whitelist]) : []

if (whitelistList) {
if (whitelistList.size() == 1) {
def file = whitelistList[0]
def fileStr = file.toString()
if (fileStr.endsWith('.gz')) {
def uncompressed = file.getBaseName() // strips .gz
decompress_cmd = "gzip -cdf ${file} > ${uncompressed}"
arg_whitelist = "--soloCBwhitelist ${uncompressed}"
} else {
arg_whitelist = "--soloCBwhitelist ${fileStr}"
}
} else {
arg_whitelist = "--soloCBwhitelist ${whitelistList.join(' ')}"
}
}
"""
if [[ $whitelist == *.gz ]]; then
gzip -cdf $whitelist > whitelist.uncompressed.txt
else
cp $whitelist whitelist.uncompressed.txt
fi
${decompress_cmd}

STAR \\
--genomeDir $index \\
--readFilesIn ${reverse.join( "," )} ${forward.join( "," )} \\
--runThreadN $task.cpus \\
--outFileNamePrefix $prefix. \\
--soloCBwhitelist whitelist.uncompressed.txt \\
$arg_whitelist \\
--soloType $protocol \\
--soloFeatures $star_feature \\
$other_10x_parameters \\
Expand Down
3 changes: 1 addition & 2 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@
"type": "string",
"description": "If not using the 10X Genomics platform, a custom barcode whitelist can be used with `--barcode_whitelist`.",
"fa_icon": "fas fa-barcode",
"format": "file-path",
"exists": true
"format": "file-path"
},
"aligner": {
"type": "string",
Expand Down
5 changes: 4 additions & 1 deletion workflows/scrnaseq.nf
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ workflow SCRNASEQ {
ch_txp2gene = params.txp2gene ? file(params.txp2gene, checkIfExists: true) : []

if (params.barcode_whitelist) {
ch_barcode_whitelist = file(params.barcode_whitelist, checkIfExists: true)
// if multiple files -> create channel with single list that keeps the order of the whitelist files preserved
ch_barcode_whitelist = params.barcode_whitelist.contains(',') ?
params.barcode_whitelist.split(',').collect { file(it.trim(), exists: true) } :
file(params.barcode_whitelist, checkIfExists: true)
} else if (protocol_config.containsKey("whitelist")) {
ch_barcode_whitelist = file("$projectDir/${protocol_config['whitelist']}", checkIfExists: true)
} else {
Expand Down
Loading