Skip to content

Commit 70874d1

Browse files
authored
Merge pull request #124 from martinghunt/expose_filter_opts
Expose filter opts
2 parents 589c2a4 + d67edd4 commit 70874d1

File tree

4 files changed

+64
-3
lines changed

4 files changed

+64
-3
lines changed

python/clockwork/tasks/variant_call_one_sample.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,11 @@ def run(options):
2323
debug=options.debug,
2424
keep_bam=options.keep_bam,
2525
trim_reads=not options.no_trim,
26+
minos_filter_min_dp=options.filter_min_dp,
27+
minos_filter_min_frs=options.filter_min_frs,
28+
minos_filter_min_gcp=options.filter_min_gcp,
29+
minos_filter_max_dp=options.filter_max_dp,
30+
gvcf_to_fasta_ignore_minos_pass=options.fasta_allow_minos_filter_fail,
31+
gvcf_to_fasta_min_frs=options.fasta_min_frs,
32+
gvcf_to_fasta_min_dp=options.fasta_min_dp,
2633
)

python/clockwork/var_call_one_sample_pipeline.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ def run(
2828
debug=False,
2929
keep_bam=False,
3030
trim_reads=True,
31+
minos_filter_min_dp=2,
32+
minos_filter_min_frs=0.9,
33+
minos_filter_min_gcp=0.5,
34+
minos_filter_max_dp=3.0,
35+
gvcf_to_fasta_ignore_minos_pass=False,
36+
gvcf_to_fasta_min_frs=0.9,
37+
gvcf_to_fasta_min_dp=2,
3138
):
3239
if len(reads1_list) != len(reads2_list):
3340
raise Exception(
@@ -153,7 +160,7 @@ def run(
153160
minos_vcf_has_vars = False
154161
else:
155162
minos_dir = os.path.join(outdir, "minos")
156-
cmd = f"minos adjudicate --reads {rmdup_bam} {minos_dir} {refdir.ref_fasta} {samtools_vcf} {cortex_vcf}"
163+
cmd = f"minos adjudicate --filter_min_dp {minos_filter_min_dp} --filter_min_frs {minos_filter_min_frs} --filter_min_gcp {minos_filter_min_gcp} --filter_max_dp {minos_filter_max_dp} --reads {rmdup_bam} {minos_dir} {refdir.ref_fasta} {samtools_vcf} {cortex_vcf}"
157164
utils.syscall(cmd)
158165
os.rename(os.path.join(minos_dir, "final.vcf"), final_vcf)
159166
if not debug:
@@ -165,7 +172,7 @@ def run(
165172
)
166173
if not debug:
167174
os.unlink(samtools_gvcf)
168-
gvcf.gvcf_to_fasta(final_gvcf, f"{final_gvcf}.fasta")
175+
gvcf.gvcf_to_fasta(final_gvcf, f"{final_gvcf}.fasta", require_minos_pass=gvcf_to_fasta_ignore_minos_pass, min_frs=gvcf_to_fasta_min_frs, min_dp=gvcf_to_fasta_min_dp)
169176

170177
if not (keep_bam or debug):
171178
os.unlink(rmdup_bam)

python/scripts/clockwork

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,53 @@ subparser_variant_call_one_sample.add_argument(
971971
action="store_true",
972972
help="Skip read trimming stage at start of pipeline",
973973
)
974+
subparser_variant_call_one_sample.add_argument(
975+
"--filter_min_dp",
976+
type=int,
977+
default=2,
978+
help="Minimum depth filter cutoff (same as minos option --filter_min_dp) in final VCF file [%(default)s]",
979+
metavar="INT",
980+
)
981+
subparser_variant_call_one_sample.add_argument(
982+
"--filter_min_frs",
983+
type=float,
984+
default=0.9,
985+
help="Minimum FRS filter cutoff (same as minos option --filter_min_frs) in final VCF file [%(default)s]",
986+
metavar="FLOAT",
987+
)
988+
subparser_variant_call_one_sample.add_argument(
989+
"--filter_min_gcp",
990+
type=float,
991+
default=0.5,
992+
help="Minimum GCP filter cutoff (same as minos option --filter_min_gcp) in final VCF file [%(default)s]",
993+
metavar="FLOAT",
994+
)
995+
subparser_variant_call_one_sample.add_argument(
996+
"--filter_max_dp",
997+
type=float,
998+
default=3.0,
999+
help="Determines maximum depth filter cutoff (same as minos option --filter_max_dp) in final VCF file. Using a value of 'x' here sets the cutoff to be more than x standard deviations from the mean read depth [%(default)s]",
1000+
metavar="FLOAT",
1001+
)
1002+
subparser_variant_call_one_sample.add_argument(
1003+
"--fasta_allow_minos_filter_fail",
1004+
action="store_true",
1005+
help="When making consensus fasta, ignore whether or not PASS is in the FILTER column of minos calls. Default is to put an N whenever there is a filter fail",
1006+
)
1007+
subparser_variant_call_one_sample.add_argument(
1008+
"--fasta_min_frs",
1009+
type=float,
1010+
help="When making consensus fasta, minimum fraction of reads (FRS) required supporting the call. If FRS is less than the given value, then N is added to the FASTA [%(default)s]",
1011+
default=0.9,
1012+
metavar="FLOAT",
1013+
)
1014+
subparser_variant_call_one_sample.add_argument(
1015+
"--fasta_min_dp",
1016+
type=int,
1017+
help="When making consensus fasta, minimum total read depth. If depth is less than this, then N is added to the FASTA [%(default)s]",
1018+
default=2,
1019+
metavar="INT",
1020+
)
9741021
subparser_variant_call_one_sample.add_argument(
9751022
"ref_dir", help="Directory of reference files, made by clockwork reference_prepare"
9761023
)

scripts/install_dependencies.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,4 +260,4 @@ pip3 install .
260260

261261
#________________________ minos _____________________________#
262262
pip3 install 'cluster_vcf_records==0.13.3'
263-
pip3 install git+https://github.com/iqbal-lab-org/minos@v0.12.5
263+
pip3 install git+https://github.com/iqbal-lab-org/minos@v0.12.6

0 commit comments

Comments
 (0)