Commit 8fa81b5f authored by van den Berg's avatar van den Berg
Browse files

Add tests for two samples

parent bd0401ed
#!/usr/bin/env python3
import argparse
import json
def print_tsv(data, filename):
""" Flatten data and print in tsv format """
# Determine the header
for sample in data:
header = sorted(data[sample].keys())
# Print the header, and then for each sample the data
with open(filename, 'w') as fout:
print('sample_name', *header, sep='\t', file=fout)
for sample in data:
print(sample, *(data[sample][field] for field in header), sep='\t',
file=fout)
def main(args):
data = dict()
for filename in args.metrics:
with open(filename, 'rt') as fin:
metrics = json.load(fin)
name = metrics.pop('sample_name')
data[name] = metrics
if args.json:
with open(args.json, 'wt') as fout:
json.dump(data, fout, indent=2)
if args.tsv:
print_tsv(data, args.tsv)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--metrics',
required = True,
help = 'Metrics json files',
nargs = '+'
)
parser.add_argument('--json', required=False)
parser.add_argument('--tsv', required=False)
args = parser.parse_args()
main(args)
{
"samples": {
"micro1": {
"libraries": {
"lib_01": {
"R1": "tests/data/fastq/micro_rg1_R1.fq.gz",
"R2": "tests/data/fastq/micro_rg1_R2.fq.gz"
}
}
},
"micro2": {
"libraries": {
"lib_02": {
"R1": "tests/data/fastq/micro_rg2_R1.fq.gz",
"R2": "tests/data/fastq/micro_rg2_R2.fq.gz"
}
}
}
},
"reference":"tests/data/reference/ref.fa",
"dbsnp": "tests/data/reference/database.vcf.gz",
"known_sites": ["tests/data/reference/database.vcf.gz"],
"bedfile": "tests/data/reference/full_chrM.bed"
}
......@@ -192,7 +192,6 @@
- name: test-integration-two-readgroups
tags:
- integration
- new
command: >
snakemake
--use-singularity
......@@ -246,3 +245,37 @@
contains:
- "status\tin_reads\tin_bp\ttoo_short\ttoo_long\ttoo_many_n\tout_reads\tw/adapters\tqualtrim_bp\tout_bp\tw/adapters2\tqualtrim2_bp\tout2_bp"
- "OK\t3860\t1139177\t0\t0\t0\t3860\t3\t416\t572845\t14\t711\t565152"
- name: test-integration-two-samples
tags:
- integration
- new
command: >
snakemake
--use-singularity
--singularity-prefix /tmp/singularity
--singularity-args ' --cleanenv --bind /tmp'
--jobs 1 -w 120
-r -p -s Snakefile
--config
CONFIG_JSON=tests/data/config/sample_config_two_samples.json
stderr:
contains:
- "Job counts"
- "localrule all:"
- "(100%) done"
must_not_contain:
- "rror"
files:
- path: "micro1/pre_process/micro1-lib_01.txt"
- path: "micro2/pre_process/micro2-lib_02.txt"
- path: "micro1/vcf/micro1.vcf.gz"
- path: "micro2/vcf/micro2.vcf.gz"
- path: "micro1/vcf/micro1.g.vcf.gz"
- path: "micro2/vcf/micro2.g.vcf.gz"
- path: "micro1/bams/micro1.markdup.bam"
- path: "micro2/bams/micro2.markdup.bam"
- path: "metrics.tsv"
contains:
- "micro1"
- "micro2"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment