Skip to content
Snippets Groups Projects
Commit 70d3ac7f authored by van den Berg's avatar van den Berg
Browse files

Write stats to stdout by default

This is also the default behaviour in master. This change restores
the default behaviour, while still preserving the option to write
the stats json directly to a file by specifying --stats.
parent 5b51b794
Branches
Tags
2 merge requests!6Merge testing into master,!5Merge new testing code into devel
...@@ -154,10 +154,10 @@ Options: ...@@ -154,10 +154,10 @@ Options:
called multiple times [required] called multiple times [required]
-ps, --positive-samples TEXT Sample(s) in positive-vcf to consider. May be -ps, --positive-samples TEXT Sample(s) in positive-vcf to consider. May be
called multiple times [required] called multiple times [required]
-s, --stats PATH Path to output stats json file [required] -s, --stats PATH Path to output stats json file
-dc, --discordant PATH Path to output discordant VCF file -dc, --discordant PATH Path to output discordant VCF file
--help Show this message and exit --help Show this message and exit.
``` ```
## License ## License
......
...@@ -32,7 +32,7 @@ from .gcoverage import RefRecord, region_coverages ...@@ -32,7 +32,7 @@ from .gcoverage import RefRecord, region_coverages
"May be called multiple times", "May be called multiple times",
required=True) required=True)
@click.option("-s", "--stats", type=click.Path(writable=True), @click.option("-s", "--stats", type=click.Path(writable=True),
help="Path to output stats json file", required=True) help="Path to output stats json file", default='-')
@click.option("-dc", "--discordant", type=click.Path(writable=True), @click.option("-dc", "--discordant", type=click.Path(writable=True),
help="Path to output discordant VCF file", help="Path to output discordant VCF file",
required=False) required=False)
...@@ -43,12 +43,12 @@ def evaluate_cli(call_vcf, positive_vcf, call_samples, positive_samples, stats, ...@@ -43,12 +43,12 @@ def evaluate_cli(call_vcf, positive_vcf, call_samples, positive_samples, stats,
st, disc = site_concordancy(c_vcf, p_vcf, call_samples, st, disc = site_concordancy(c_vcf, p_vcf, call_samples,
positive_samples) positive_samples)
# Write the stats json file # Write the stats json file
with open(stats, 'w') as fout: with click.open_file(stats, 'w') as fout:
print(json.dumps(st), file=fout) print(json.dumps(st), file=fout)
# If specified, write the discordant variants # If specified, write the discordant variants
if discordant: if discordant:
with open(discordant, 'w') as fout: with click.open_file(discordant, 'w') as fout:
for record in disc: for record in disc:
print(record, file=fout, end='') print(record, file=fout, end='')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment