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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### `Added`

- Substituted VCF_TO_CSV local module with GATK4/VARIANTSTOTABLE nf-core module [#280](https://github.com/nf-core/variantbenchmarking/issues/280)
- RTGtools update to 3.13 [#261](https://github.com/nf-core/variantbenchmarking/issues/261)
- Transforming local modules with bcftools and tabix to standard nf-core modules [#267](https://github.com/nf-core/variantbenchmarking/pull/267)
- Replace local modules SORT_BED and REFORMAT_HEADER with nf-core ones. [#268](https://github.com/nf-core/variantbenchmarking/pull/268)
Expand Down
Binary file modified assets/nf-core-variantbenchmarking_logo_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions bin/merge_sompy_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,16 @@ def get_sample_names(files):
sample_names.append(gt_column.replace('.GT', ''))
return sample_names

def write_merged_csv(merged_data, output_file, sample_names):
"""Write merged dictionary to CSV."""
def write_merged_file(merged_data, output_file, sample_names, delimiter):
"""Write merged dictionary to file according to delimiter."""
sorted_keys = sorted(merged_data.keys(), key=lambda x: (x[0], int(x[1])))

fixed_fields = ["CHROM", "POS", "REF", "ALT", "FILTER"]
dynamic_fields = sorted([f"{sample}_GT" for sample in sample_names])
fieldnames = fixed_fields + dynamic_fields

with open(output_file, 'w', newline='') as f:
writer = csv.DictWriter(f, fieldnames=fieldnames, restval='./.')
writer = csv.DictWriter(f, fieldnames=fieldnames, restval='./.', delimiter = delimiter)
writer.writeheader()
for key in sorted_keys:
writer.writerow({field: merged_data[key].get(field, "./.") for field in fieldnames})
Expand All @@ -94,7 +94,7 @@ def main():
description="Merge CSVs by CHROM, POS, and handle dynamic GT columns."
)
parser.add_argument("files", nargs='+', help="Input CSV files (e.g. *_TP.csv)")
parser.add_argument("--output", required=True, help="Output merged CSV file")
parser.add_argument("--output", required=True, help="Output merged TSV file")
args = parser.parse_args()

all_dicts = []
Expand All @@ -106,7 +106,7 @@ def main():
all_dicts.append(sample_dict)

merged = merge_dicts_by_key(all_dicts, all_sample_names)
write_merged_csv(merged, args.output, all_sample_names)
write_merged_file(merged, args.output, all_sample_names, delimiter = "\t")
print(f"Merged CSV written to {args.output}")

if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion bin/plot_upset.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def parse_file(file_path, category_name):
return {}

try:
df = pd.read_csv(file_path, sep=',')
df = pd.read_csv(file_path, sep='\t')
except pd.errors.EmptyDataError:
print(f"Warning: File {file_path} is empty.")
return {}
Expand Down
15 changes: 10 additions & 5 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -676,13 +676,18 @@ process {
]
}

withName: BCFTOOLS_SORT_COMPARE{
ext.prefix = { vcf.baseName - ".vcf" + ".sort"}
publishDir = [
enabled: false
]
}

withName: VCF_TO_CSV {
ext.prefix = {"${meta.id}.${meta.tag}"}
withName: "BCFTOOLS_REHEADER_COMPARE" {
ext.args2 = {"--output-type z" }
ext.prefix = { vcf.baseName - ".vcf" + ".reheader"}
publishDir = [
path: {"${params.outdir}/${params.variant_type}/summary/comparisons/${meta.id}"},
pattern: "*{.csv}",
mode: params.publish_dir_mode
enabled: false
]
}

Expand Down
10 changes: 10 additions & 0 deletions modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
"git_sha": "6383d8fe58f9498eecd5aa303e71a4a932d1e9f6",
"installed_by": ["modules"]
},
"bcftools/index": {
"branch": "master",
"git_sha": "6383d8fe58f9498eecd5aa303e71a4a932d1e9f6",
"installed_by": ["modules"]
},
"bcftools/merge": {
"branch": "master",
"git_sha": "6383d8fe58f9498eecd5aa303e71a4a932d1e9f6",
Expand Down Expand Up @@ -66,6 +71,11 @@
"installed_by": ["modules"],
"patch": "modules/nf-core/gatk4/concordance/gatk4-concordance.diff"
},
"gatk4/variantstotable": {
"branch": "master",
"git_sha": "52b7843bd92ccf833cc12e71cd84aeccf2583852",
"installed_by": ["modules"]
},
"gawk": {
"branch": "master",
"git_sha": "76b1f53edcf72798d8515c82f4728ad44b3dd902",
Expand Down
6 changes: 3 additions & 3 deletions modules/local/custom/merge_sompy_features/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ process MERGE_SOMPY_FEATURES {
tuple val(meta), path(csvs)

output:
tuple val(meta), path("*.csv") , emit: output
tuple val(meta), path("*.tsv") , emit: output
path "versions.yml" , emit: versions

when:
Expand All @@ -22,7 +22,7 @@ process MERGE_SOMPY_FEATURES {
def prefix = task.ext.prefix ?: "${meta.id}"

"""
merge_sompy_features.py $csvs --output ${prefix}.${meta.tag}.csv
merge_sompy_features.py $csvs --output ${prefix}.${meta.tag}.tsv

cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand All @@ -32,7 +32,7 @@ process MERGE_SOMPY_FEATURES {
stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.${meta.tag}.summary.csv
touch ${prefix}.${meta.tag}.summary.tsv

cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
8 changes: 4 additions & 4 deletions modules/local/custom/plot_upset/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ process PLOT_UPSET {
def prefix = task.ext.prefix ?: "${meta.id}"
"""
plot_upset.py \\
--fp ${meta.id}.FP.csv \\
--fn ${meta.id}.FN.csv \\
--tp-base ${meta.id}.TP_base.csv \\
--tp-comp ${meta.id}.TP_comp.csv \\
--fp ${meta.id}.FP.tsv \\
--fn ${meta.id}.FN.tsv \\
--tp-base ${meta.id}.TP_base.tsv \\
--tp-comp ${meta.id}.TP_comp.tsv \\
--output ${prefix} \\
--title "Upset plot for ${meta.id}"

Expand Down
9 changes: 0 additions & 9 deletions modules/local/custom/vcf_to_csv/environment.yml

This file was deleted.

43 changes: 0 additions & 43 deletions modules/local/custom/vcf_to_csv/main.nf

This file was deleted.

10 changes: 10 additions & 0 deletions modules/nf-core/bcftools/index/environment.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions modules/nf-core/bcftools/index/main.nf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

82 changes: 82 additions & 0 deletions modules/nf-core/bcftools/index/meta.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading