Skip to content
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#154](https://github.com/nf-core/references/pull/154) - Added `--hisat2_skip_splice_sites` parameter to skip splice site extraction for prokaryotic genomes
- [#155](https://github.com/nf-core/references/pull/155) - Added species-specific STAR index parameters (`--star_sjdbOverhang`, `--star_genomeSAindexNbases`) with per-genome asset file configuration
- [#159](https://github.com/nf-core/references/pull/159) - Add release roadmap for rnaseq and sarek consumability
- [#160](https://github.com/nf-core/references/pull/160) - Support list-valued VCF fields in datasheets, with positional TBI pairing (null entries trigger index building) and missing `ascat_loci_rt` schema entry

### Changed

Expand Down
63 changes: 27 additions & 36 deletions subworkflows/local/datasheet_to_channel/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -109,46 +109,18 @@ workflow DATASHEET_TO_CHANNEL {
}

// HANDLING OF VCF
// VCF fields can be a single path or a list of paths, with an optional
// parallel list of indexes (null entries mean the index needs to be built)

dbsnp = datasheet
.filter { meta, _readme -> meta.vcf_dbsnp_vcf }
.map { meta, _readme ->
def meta_extra = record(run_tabix: !meta.vcf_dbsnp_vcf_tbi)
meta_extra += record(type: 'dbsnp', source_vcf: meta.vcf_dbsnp_vcf_source)
[reduceMeta(meta) + meta_extra, files(meta.vcf_dbsnp_vcf, checkIfExists: true)]
}
dbsnp = toVcfChannel(datasheet, 'dbsnp')

germline_resource = datasheet
.filter { meta, _readme -> meta.vcf_germline_resource_vcf }
.map { meta, _readme ->
def meta_extra = record(run_tabix: !meta.vcf_germline_resource_vcf_tbi)
meta_extra += record(type: 'germline_resource', source_vcf: meta.vcf_germline_resource_vcf_source)
[reduceMeta(meta) + meta_extra, file(meta.vcf_germline_resource_vcf, checkIfExists: true)]
}
germline_resource = toVcfChannel(datasheet, 'germline_resource')

known_indels = datasheet
.filter { meta, _readme -> meta.vcf_known_indels_vcf }
.map { meta, _readme ->
def meta_extra = record(run_tabix: !meta.vcf_known_indels_vcf_tbi)
meta_extra += record(type: 'known_indels', source_vcf: meta.vcf_known_indels_vcf_source)
[reduceMeta(meta) + meta_extra, file(meta.vcf_known_indels_vcf, checkIfExists: true)]
}
known_indels = toVcfChannel(datasheet, 'known_indels')

known_snps = datasheet
.filter { meta, _readme -> meta.vcf_known_snps_vcf }
.map { meta, _readme ->
def meta_extra = record(run_tabix: !meta.vcf_known_snps_vcf_tbi)
meta_extra += record(type: 'known_snps', source_vcf: meta.vcf_known_snps_vcf_source)
[reduceMeta(meta) + meta_extra, file(meta.vcf_known_snps_vcf, checkIfExists: true)]
}
known_snps = toVcfChannel(datasheet, 'known_snps')

pon = datasheet
.filter { meta, _readme -> meta.vcf_pon_vcf }
.map { meta, _readme ->
def meta_extra = record(run_tabix: !meta.vcf_pon_vcf_tbi)
meta_extra += record(type: 'pon', source_vcf: meta.vcf_pon_vcf_source)
[reduceMeta(meta) + meta_extra, file(meta.vcf_pon_vcf, checkIfExists: true)]
}
pon = toVcfChannel(datasheet, 'pon')

vcf = channel.empty()
.mix(
Expand All @@ -158,7 +130,6 @@ workflow DATASHEET_TO_CHANNEL {
known_snps,
pon,
)
.flatMap { meta, vcfs -> vcfs instanceof Path ? [[meta, vcfs]] : vcfs.toList().collect { vcf_ -> [meta, vcf_] } }

emit:
ascat_alleles = ascat_alleles // channel: [meta, *.ascat_alleles.txt]
Expand Down Expand Up @@ -195,3 +166,23 @@ def reduceMeta(meta_) {
species: meta_.species,
)
}

// Build a [meta, vcf] channel for one VCF type
// The datasheet field can hold a single path or a list of paths
// Indexes are paired positionally, a null or missing entry means the index has to be built
def toVcfChannel(datasheet, type) {
def vcf_key = "vcf_${type}_vcf"
def tbi_key = "vcf_${type}_vcf_tbi"
def source_key = "vcf_${type}_vcf_source"
datasheet
.filter { meta, _readme -> meta[vcf_key] }
.flatMap { meta, _readme ->
def vcfs = meta[vcf_key] instanceof List ? meta[vcf_key] : [meta[vcf_key]]
def tbis = !meta[tbi_key] ? [] : meta[tbi_key] instanceof List ? meta[tbi_key] : [meta[tbi_key]]
vcfs.withIndex().collect { vcf_, i ->
def meta_extra = record(run_tabix: i >= tbis.size() || !tbis[i])
meta_extra += record(type: type, source_vcf: meta[source_key])
[reduceMeta(meta) + meta_extra, file(vcf_, checkIfExists: true)]
}
}
}
241 changes: 201 additions & 40 deletions subworkflows/local/utils_references/schema_references.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@
"pattern": "^\\S+$",
"errorMessage": "TODO"
},
"ascat_loci_rt": {
"meta": ["ascat_loci_rt"],
"type": "string",
"pattern": "^\\S+$",
"errorMessage": "TODO"
},
"bed12": {
"meta": ["bed12"],
"type": "string",
Expand Down Expand Up @@ -255,17 +261,48 @@
},
"vcf_dbsnp_vcf": {
"meta": ["vcf_dbsnp_vcf"],
"type": "string",
"exists": true,
"pattern": "^\\S+\\.vcf(\\.gz)?$",
"errorMessage": "DBSNP VCF must be an existing file ending in '.vcf' that does not contain spaces. This file can be bgzipped"
"anyOf": [
{
"type": "string",
"exists": true,
"pattern": "^\\S+\\.vcf(\\.gz)?$"
},
{
"type": "array",
"items": {
"type": "string",
"exists": true,
"pattern": "^\\S+\\.vcf(\\.gz)?$"
}
}
],
"errorMessage": "DBSNP VCF must be an existing file (or list of existing files) ending in '.vcf' that does not contain spaces. This file can be bgzipped"
},
"vcf_dbsnp_vcf_tbi": {
"meta": ["vcf_dbsnp_vcf_tbi"],
"type": "string",
"pattern": "^\\S+\\.vcf\\.gz\\.tbi?$",
"exists": true,
"errorMessage": "DBSNP VCF index must be an existing file ending in '.vcf.gz.tbi' that does not contain spaces"
"anyOf": [
{
"type": "string",
"pattern": "^\\S+\\.vcf\\.gz\\.tbi?$",
"exists": true
},
{
"type": "array",
"items": {
"anyOf": [
{
"type": "string",
"pattern": "^\\S+\\.vcf\\.gz\\.tbi?$",
"exists": true
},
{
"type": "null"
}
]
}
}
],
"errorMessage": "DBSNP VCF index must be an existing file (or list of existing files, null entries allowed) ending in '.vcf.gz.tbi' that does not contain spaces"
},
"vcf_dbsnp_vcf_vqsr": {
"meta": ["vcf_dbsnp_vcf_vqsr"],
Expand All @@ -281,17 +318,48 @@
},
"vcf_germline_resource_vcf": {
"meta": ["vcf_germline_resource_vcf"],
"type": "string",
"exists": true,
"pattern": "^\\S+\\.vcf(\\.gz)?$",
"errorMessage": "Germline Resource VCF must be an existing file ending in '.vcf' that does not contain spaces. This file can be bgzipped"
"anyOf": [
{
"type": "string",
"exists": true,
"pattern": "^\\S+\\.vcf(\\.gz)?$"
},
{
"type": "array",
"items": {
"type": "string",
"exists": true,
"pattern": "^\\S+\\.vcf(\\.gz)?$"
}
}
],
"errorMessage": "Germline Resource VCF must be an existing file (or list of existing files) ending in '.vcf' that does not contain spaces. This file can be bgzipped"
},
"vcf_germline_resource_vcf_tbi": {
"meta": ["vcf_germline_resource_vcf_tbi"],
"type": "string",
"pattern": "^\\S+\\.vcf\\.gz\\.tbi?$",
"exists": true,
"errorMessage": "Germline Resource VCF index must be an existing file ending in '.vcf.gz.tbi' that does not contain spaces"
"anyOf": [
{
"type": "string",
"pattern": "^\\S+\\.vcf\\.gz\\.tbi?$",
"exists": true
},
{
"type": "array",
"items": {
"anyOf": [
{
"type": "string",
"pattern": "^\\S+\\.vcf\\.gz\\.tbi?$",
"exists": true
},
{
"type": "null"
}
]
}
}
],
"errorMessage": "Germline Resource VCF index must be an existing file (or list of existing files, null entries allowed) ending in '.vcf.gz.tbi' that does not contain spaces"
},
"vcf_germline_resource_vcf_source": {
"meta": ["vcf_germline_resource_vcf_source"],
Expand All @@ -301,17 +369,48 @@
},
"vcf_known_indels_vcf": {
"meta": ["vcf_known_indels_vcf"],
"type": "string",
"exists": true,
"pattern": "^\\S+\\.vcf(\\.gz)?$",
"errorMessage": "Known indels VCF must be an existing file ending in '.vcf' that does not contain spaces. This file can be bgzipped"
"anyOf": [
{
"type": "string",
"exists": true,
"pattern": "^\\S+\\.vcf(\\.gz)?$"
},
{
"type": "array",
"items": {
"type": "string",
"exists": true,
"pattern": "^\\S+\\.vcf(\\.gz)?$"
}
}
],
"errorMessage": "Known indels VCF must be an existing file (or list of existing files) ending in '.vcf' that does not contain spaces. This file can be bgzipped"
},
"vcf_known_indels_vcf_tbi": {
"meta": ["vcf_known_indels_vcf_tbi"],
"type": "string",
"pattern": "^\\S+\\.vcf\\.gz\\.tbi?$",
"exists": true,
"errorMessage": "Known indels VCF index must be an existing file ending in '.vcf.gz.tbi' that does not contain spaces"
"anyOf": [
{
"type": "string",
"pattern": "^\\S+\\.vcf\\.gz\\.tbi?$",
"exists": true
},
{
"type": "array",
"items": {
"anyOf": [
{
"type": "string",
"pattern": "^\\S+\\.vcf\\.gz\\.tbi?$",
"exists": true
},
{
"type": "null"
}
]
}
}
],
"errorMessage": "Known indels VCF index must be an existing file (or list of existing files, null entries allowed) ending in '.vcf.gz.tbi' that does not contain spaces"
},
"vcf_known_indels_vcf_source": {
"meta": ["vcf_known_indels_vcf_source"],
Expand All @@ -321,17 +420,48 @@
},
"vcf_known_snps_vcf": {
"meta": ["vcf_known_snps_vcf"],
"type": "string",
"exists": true,
"pattern": "^\\S+\\.vcf(\\.gz)?$",
"errorMessage": "Known snps VCF must be an existing file ending in '.vcf' that does not contain spaces. This file can be bgzipped"
"anyOf": [
{
"type": "string",
"exists": true,
"pattern": "^\\S+\\.vcf(\\.gz)?$"
},
{
"type": "array",
"items": {
"type": "string",
"exists": true,
"pattern": "^\\S+\\.vcf(\\.gz)?$"
}
}
],
"errorMessage": "Known snps VCF must be an existing file (or list of existing files) ending in '.vcf' that does not contain spaces. This file can be bgzipped"
},
"vcf_known_snps_vcf_tbi": {
"meta": ["vcf_known_snps_vcf_tbi"],
"type": "string",
"pattern": "^\\S+\\.vcf\\.gz\\.tbi?$",
"exists": true,
"errorMessage": "Known snps VCF index must be an existing file ending in '.vcf.gz.tbi' that does not contain spaces"
"anyOf": [
{
"type": "string",
"pattern": "^\\S+\\.vcf\\.gz\\.tbi?$",
"exists": true
},
{
"type": "array",
"items": {
"anyOf": [
{
"type": "string",
"pattern": "^\\S+\\.vcf\\.gz\\.tbi?$",
"exists": true
},
{
"type": "null"
}
]
}
}
],
"errorMessage": "Known snps VCF index must be an existing file (or list of existing files, null entries allowed) ending in '.vcf.gz.tbi' that does not contain spaces"
},
"vcf_known_snps_vcf_source": {
"meta": ["vcf_known_snps_vcf_source"],
Expand All @@ -341,17 +471,48 @@
},
"vcf_pon_vcf": {
"meta": ["vcf_pon_vcf"],
"type": "string",
"exists": true,
"pattern": "^\\S+\\.vcf(\\.gz)?$",
"errorMessage": "PON VCF must be an existing file ending in '.vcf' that does not contain spaces. This file can be bgzipped"
"anyOf": [
{
"type": "string",
"exists": true,
"pattern": "^\\S+\\.vcf(\\.gz)?$"
},
{
"type": "array",
"items": {
"type": "string",
"exists": true,
"pattern": "^\\S+\\.vcf(\\.gz)?$"
}
}
],
"errorMessage": "PON VCF must be an existing file (or list of existing files) ending in '.vcf' that does not contain spaces. This file can be bgzipped"
},
"vcf_pon_vcf_tbi": {
"meta": ["vcf_pon_vcf_tbi"],
"type": "string",
"pattern": "^\\S+\\.vcf\\.gz\\.tbi?$",
"exists": true,
"errorMessage": "PON VCF index must be an existing file ending in '.vcf.gz.tbi' that does not contain spaces"
"anyOf": [
{
"type": "string",
"pattern": "^\\S+\\.vcf\\.gz\\.tbi?$",
"exists": true
},
{
"type": "array",
"items": {
"anyOf": [
{
"type": "string",
"pattern": "^\\S+\\.vcf\\.gz\\.tbi?$",
"exists": true
},
{
"type": "null"
}
]
}
}
],
"errorMessage": "PON VCF index must be an existing file (or list of existing files, null entries allowed) ending in '.vcf.gz.tbi' that does not contain spaces"
},
"vcf_pon_vcf_source": {
"meta": ["vcf_pon_vcf_source"],
Expand Down
Loading
Loading