annotate varscan.py @ 8:4c69f367c326 draft default tip

"planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 1232893782204bb041dd6ed46711295cb0bfc03f"
author iuc
date Sat, 04 Dec 2021 22:21:15 +0000
parents 100090cb4bec
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1 #!/usr/bin/env python3
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
2 from __future__ import print_function
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
3
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
4 import argparse
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
5 import io
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
6 import os
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
7 import subprocess
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
8 import sys
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
9 import tempfile
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
10 import time
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
11 from collections import namedtuple
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
12 from contextlib import ExitStack
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
13 from functools import partial
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
14 from threading import Thread
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
15
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
16 import pysam
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
17
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
18
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
19 AlleleStats = namedtuple(
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
20 "AlleleStats",
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
21 [
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
22 'reads_total',
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
23 'reads_fw',
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
24 'reads_rv',
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
25 'avg_mapqual',
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
26 'avg_basequal',
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
27 'avg_dist_from_center',
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
28 'avg_mismatch_fraction',
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
29 'avg_mismatch_qualsum',
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
30 'avg_clipped_len',
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
31 'avg_dist_from_3prime'
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
32 ]
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
33 )
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
34
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
35
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
36 def _get_allele_specific_pileup_column_stats(pileups, ref_fetch,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
37 ignore_md, ignore_nm,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
38 mm_runs, detect_q2_runs):
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
39 var_reads_plus = var_reads_minus = 0
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
40 sum_mapping_qualities = 0
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
41 sum_base_qualities = 0
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
42 sum_dist_from_center = 0
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
43 sum_dist_from_3prime = 0
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
44 sum_clipped_length = 0
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
45 sum_unclipped_length = 0
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
46 sum_mismatch_fractions = 0
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
47 sum_mismatch_qualities = 0
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
48
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
49 for p in pileups:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
50 if p.alignment.is_reverse:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
51 var_reads_minus += 1
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
52 else:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
53 var_reads_plus += 1
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
54 sum_mapping_qualities += p.alignment.mapping_quality
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
55 sum_base_qualities += p.alignment.query_qualities[p.query_position]
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
56 sum_clipped_length += p.alignment.query_alignment_length
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
57 unclipped_length = p.alignment.query_length
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
58 sum_unclipped_length += unclipped_length
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
59 # The following calculations are all in 1-based coordinates
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
60 # with respect to the physical 5'-end of the read sequence.
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
61 if p.alignment.is_reverse:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
62 read_base_pos = unclipped_length - p.query_position
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
63 read_first_aln_pos = (
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
64 unclipped_length - p.alignment.query_alignment_end + 1
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
65 )
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
66 read_last_aln_pos = (
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
67 unclipped_length - p.alignment.query_alignment_start
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
68 )
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
69 qualities_3to5prime = p.alignment.query_alignment_qualities
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
70 else:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
71 read_base_pos = p.query_position + 1
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
72 read_first_aln_pos = p.alignment.query_alignment_start + 1
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
73 read_last_aln_pos = p.alignment.query_alignment_end
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
74 qualities_3to5prime = reversed(
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
75 p.alignment.query_alignment_qualities
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
76 )
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
77
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
78 read_last_effective_aln_pos = read_last_aln_pos
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
79 if detect_q2_runs:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
80 # Note: the original bam-readcount algorithm always takes
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
81 # terminal q2 runs into account when determining the
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
82 # effective 3'-ends of reads.
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
83 # However, q2 runs have no special meaning since Illumina
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
84 # pipeline version 1.8 so detecting them is optional
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
85 # in this code.
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
86 for qual in qualities_3to5prime:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
87 if qual != 2:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
88 break
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
89 read_last_effective_aln_pos -= 1
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
90
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
91 # Note: the original bam-readcount algorithm defines the
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
92 # read center as:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
93 # read_center = p.alignment.query_alignment_length / 2
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
94 # This is less accurate than the implementation here.
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
95 read_center = (read_first_aln_pos + read_last_aln_pos) / 2
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
96 sum_dist_from_center += 1 - abs(
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
97 read_base_pos - read_center
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
98 ) / (read_center - 1)
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
99 # To calculate the distance of base positions from the 3'-ends
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
100 # of reads bam-readcount uses the formula:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
101 # sum_dist_from_3prime += abs(
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
102 # read_last_effective_aln_pos - read_base_pos
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
103 # ) / (unclipped_length - 1)
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
104 # , which treats base positions on both sides of the effective
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
105 # 3'-end equally. Since this seems hard to justify, we cap
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
106 # the distance calculation at 0 for base positions past the
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
107 # effective 3'-end (which, in turn, should only be possible
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
108 # with detection of q2 runs).
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
109 if read_last_effective_aln_pos > read_base_pos:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
110 sum_dist_from_3prime += (
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
111 read_last_effective_aln_pos - read_base_pos
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
112 ) / (unclipped_length - 1)
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
113
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
114 if sum_mismatch_fractions >= 0 or sum_mismatch_qualities >= 0:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
115 # sum_mismatch_fractions and sum_mismatch_qualities will be
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
116 # set to float('nan') if reference info (in form of an MD tag or
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
117 # an actual reference sequence) was not available for any previous
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
118 # read in the pileup.
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
119 # In that case, there is no point to trying to calculate
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
120 # mismatch stats for other reads anymore.
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
121
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
122 # The following mismatch calculations use this logic:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
123 # 1. For determining the edit distance between an aligned read and
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
124 # the reference, we follow the authoritative definition of the
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
125 # NM tag calculation in
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
126 # http://samtools.github.io/hts-specs/SAMtags.pdf
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
127 #
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
128 # For historical reasons, the result of this calculation will
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
129 # disagree more often than not with NM tag values calculated by
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
130 # other tools.
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
131 # If precalculated NM tag values are present on the aligned
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
132 # reads, these can be given preference through the use_nm flag.
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
133 # Doing so will mimick the behavior of bam-readcount, which
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
134 # requires and always just looks at NM tags.
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
135 # 2. For determining mismatch quality sums, a mismatch is defined
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
136 # differently and in accordance with the implementation in
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
137 # bam-readcount:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
138 # - only mismatches (not inserted or deleted bases) are
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
139 # considered
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
140 # - 'N' in the reference is considered a match for any read base
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
141 # - any matching (case-insensitive) base in reference and read
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
142 # is considered a match, even if that base is not one of
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
143 # A, C, G or T.
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
144 # In both 1. and 2. above a '=' in the read is always considered a
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
145 # match, irrespective of the reference base.
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
146
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
147 num_mismatches = 0
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
148 if not ignore_md:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
149 try:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
150 # see if the read has an MD tag, in which case pysam can
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
151 # calculate the reference sequence for us
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
152 ref_seq = p.alignment.get_reference_sequence().upper()
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
153 except ValueError:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
154 ignore_md = True
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
155 if not ignore_nm:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
156 try:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
157 num_mismatches = p.alignment.get_tag('NM')
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
158 except KeyError:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
159 ignore_nm = True
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
160
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
161 if ignore_md:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
162 if not ref_fetch:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
163 # cannot calculate mismatch stats without ref info
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
164 sum_mismatch_qualities = float('nan')
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
165 if ignore_nm:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
166 sum_mismatch_fractions = float('nan')
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
167 else:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
168 sum_mismatch_fractions += (
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
169 num_mismatches / p.alignment.query_alignment_length
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
170 )
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
171 continue
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
172 # Without an MD tag we need to extract the relevant part
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
173 # of the reference from the full sequence by position.
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
174 ref_positions = p.alignment.get_reference_positions()
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
175 ref_seq = ref_fetch(
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
176 ref_positions[0], ref_positions[-1] + 1
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
177 ).upper()
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
178
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
179 potential_matches = {'A', 'C', 'G', 'T'}
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
180 aligned_pairs = p.alignment.get_aligned_pairs(matches_only=True)
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
181 ref_offset = aligned_pairs[0][1]
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
182 last_mismatch_pos = None
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
183 mismatch_run_quals = []
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
184 for qpos, rpos in aligned_pairs:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
185 read_base = p.alignment.query_sequence[qpos].upper()
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
186 if read_base == '=':
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
187 # always treat the special read base '=' as a
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
188 # match, irrespective of the reference base
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
189 continue
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
190 ref_base = ref_seq[rpos - ref_offset]
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
191 # see if we have a mismatch to use for mismatch quality sum
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
192 # calculation
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
193 if ref_base != 'N' and ref_base != read_base:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
194 if mm_runs:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
195 if (
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
196 last_mismatch_pos is None
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
197 ) or (
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
198 last_mismatch_pos + 1 == qpos
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
199 ):
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
200 mismatch_run_quals.append(
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
201 p.alignment.query_qualities[qpos]
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
202 )
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
203 else:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
204 sum_mismatch_qualities += max(mismatch_run_quals)
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
205 mismatch_run_quals = [
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
206 p.alignment.query_qualities[qpos]
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
207 ]
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
208 last_mismatch_pos = qpos
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
209 else:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
210 sum_mismatch_qualities += (
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
211 p.alignment.query_qualities[qpos]
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
212 )
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
213 if ignore_nm:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
214 # see if we have a mismatch that increases the edit
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
215 # distance according to the SAMtags specs
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
216 if (
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
217 read_base not in potential_matches
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
218 ) or (
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
219 ref_base not in potential_matches
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
220 ) or (
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
221 read_base != ref_base
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
222 ):
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
223 num_mismatches += 1
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
224
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
225 if mismatch_run_quals:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
226 sum_mismatch_qualities += max(mismatch_run_quals)
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
227 if ignore_nm:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
228 # use the number of mismatches calculated above,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
229 # but add inserted and deleted bases to it
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
230 cigar_stats = p.alignment.get_cigar_stats()[0]
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
231 num_mismatches += cigar_stats[1] + cigar_stats[2]
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
232 sum_mismatch_fractions += (
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
233 num_mismatches / p.alignment.query_alignment_length
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
234 )
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
235
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
236 return (
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
237 var_reads_plus,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
238 var_reads_minus,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
239 sum_mapping_qualities,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
240 sum_base_qualities,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
241 sum_dist_from_center,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
242 sum_mismatch_fractions,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
243 sum_mismatch_qualities,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
244 sum_clipped_length,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
245 sum_dist_from_3prime
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
246 )
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
247
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
248
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
249 def get_allele_stats(reads, pos, alleles,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
250 ref=None, ignore_md=True, ignore_nm=True,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
251 mm_runs=True, detect_q2_runs=False,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
252 pileup_args=None):
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
253 chrom, start, stop = pos
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
254 if pileup_args is None:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
255 pileup_args = {}
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
256 if pileup_args.get('stepper') == 'samtools':
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
257 if pileup_args.get('compute_baq', True) is not False:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
258 if 'fastafile' not in pileup_args:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
259 pileup_args['fastafile'] = ref
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
260 # be careful when passing in a custom 'fastafile' option:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
261 # providing it slows down pysam tremendously even if the option
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
262 # isn't actually required.
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
263
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
264 pile = reads.pileup(
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
265 chrom, start, stop,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
266 **pileup_args
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
267 )
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
268 # apply false-positive filtering a la varscan fpfilter
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
269 # find the variant site in the pileup columns
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
270 for pile_column in pile:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
271 if pile_column.reference_pos == start:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
272 break
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
273 else:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
274 # With no reads covering the genomic position
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
275 # we can only return "empty" allele stats
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
276 return [
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
277 AlleleStats(0, 0, 0, *[float('nan')] * 7)
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
278 for allele in alleles
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
279 ]
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
280
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
281 # extract required information
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
282 # overall read depth at the site
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
283 read_depth = pile_column.get_num_aligned()
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
284 assert read_depth > 0
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
285
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
286 alleles_stats = []
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
287 for allele in alleles:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
288 if '-' in allele:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
289 allele, indel_type, indel_after = allele.partition('-')
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
290 indel_len = -len(indel_after)
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
291 elif '+' in allele:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
292 allele, indel_type, indel_after = allele.partition('+')
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
293 indel_len = len(indel_after)
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
294 else:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
295 indel_type = None
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
296
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
297 stats_it = (
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
298 p for p in pile_column.pileups
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
299 # skip reads that don't support the allele we're looking for
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
300 if (p.query_position is not None)
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
301 and (p.alignment.query_sequence[p.query_position] == allele)
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
302 )
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
303 if indel_type == '-':
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
304 stats_it = (
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
305 p for p in stats_it if p.indel == indel_len
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
306 )
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
307 elif indel_type == '+':
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
308 stats_it = (
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
309 p for p in stats_it if (
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
310 p.indel == indel_len
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
311 ) and (
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
312 p.alignment.query_sequence[
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
313 p.query_position + 1:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
314 p.query_position + 1 + indel_len
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
315 ] == indel_after
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
316 )
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
317 )
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
318 allele_stats = _get_allele_specific_pileup_column_stats(
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
319 stats_it,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
320 partial(
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
321 pysam.FastaFile.fetch, ref, chrom
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
322 ) if ref else None,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
323 ignore_md,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
324 ignore_nm,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
325 mm_runs,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
326 detect_q2_runs
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
327 )
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
328
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
329 allele_reads_total = allele_stats[0] + allele_stats[1]
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
330 if allele_reads_total == 0:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
331 # No stats without reads!
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
332 alleles_stats.append(
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
333 AlleleStats(read_depth, 0, 0, *[float('nan')] * 7)
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
334 )
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
335 else:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
336 alleles_stats.append(
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
337 AlleleStats(
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
338 read_depth, allele_stats[0], allele_stats[1],
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
339 *(i / allele_reads_total for i in allele_stats[2:])
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
340 )
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
341 )
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
342 return alleles_stats
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
343
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
344
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
345 class VariantCallingError (RuntimeError):
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
346 """Exception class for issues with samtools and varscan subprocesses."""
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
347
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
348 def __init__(self, message=None, call='', error=''):
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
349 self.message = message
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
350 self.call = call.strip()
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
351 self.error = error.strip()
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
352
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
353 def __str__(self):
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
354 if self.message is None:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
355 return ''
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
356 if self.error:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
357 msg_header = '"{0}" failed with:\n{1}\n\n'.format(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
358 self.call, self.error
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
359 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
360 else:
8
4c69f367c326 "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 1232893782204bb041dd6ed46711295cb0bfc03f"
iuc
parents: 7
diff changeset
361 msg_header = '{0} failed.\nNo further information about this error is available.\n\n'.format(
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
362 self.call
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
363 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
364 return msg_header + self.message
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
365
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
366
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
367 class VarScanCaller (object):
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
368 def __init__(self, ref_genome, bam_input_files,
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
369 max_depth=None, count_orphans=False, detect_overlaps=True,
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
370 min_mapqual=None, min_basequal=None,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
371 threads=1, verbose=False, quiet=True
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
372 ):
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
373 self.ref_genome = ref_genome
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
374 self.bam_input_files = bam_input_files
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
375 self.max_depth = max_depth
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
376 self.count_orphans = count_orphans
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
377 self.detect_overlaps = detect_overlaps
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
378 self.min_mapqual = min_mapqual
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
379 self.min_basequal = min_basequal
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
380 self.threads = threads
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
381 self.verbose = verbose
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
382 self.quiet = quiet
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
383
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
384 with pysam.FastaFile(ref_genome) as ref_fa:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
385 self.ref_contigs = ref_fa.references
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
386 self.ref_lengths = ref_fa.lengths
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
387
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
388 self.pileup_engine = ['samtools', 'mpileup']
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
389 self.varcall_engine = ['varscan', 'somatic']
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
390 self.requires_stdout_redirect = False
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
391 self.TemporaryContigVCF = partial(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
392 tempfile.NamedTemporaryFile,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
393 mode='wb', suffix='', delete=False, dir=os.getcwd()
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
394 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
395 self.tmpfiles = []
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
396
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
397 def _get_pysam_pileup_args(self):
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
398 # Compute the pileup args dynamically to account for possibly updated
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
399 # instance attributes.
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
400
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
401 # fixed default parameters
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
402 # Note on the fixed default for 'ignore_overlaps':
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
403 # In order to use the exact same pileup parameters during variant
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
404 # calling and postprocessing, we would have to compute the setting
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
405 # dynamically like so:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
406 # if not self.detect_overlaps:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
407 # param_dict['ignore_overlaps'] = False
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
408 # However, samtools/pysam implement overlap correction by manipulating
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
409 # (setting to zero) the lower qualities of bases that are part of an
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
410 # overlap (see
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
411 # https://sourceforge.net/p/samtools/mailman/message/32793789/). This
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
412 # manipulation has such a big undesirable effect on base quality stats
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
413 # calculated during postprocessing that calculating the stats on a
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
414 # slightly different pileup seems like the lesser evil.
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
415
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
416 param_dict = {
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
417 'ignore_overlaps': False,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
418 'compute_baq': False,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
419 'stepper': 'samtools',
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
420 }
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
421 # user-controllable parameters
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
422 if self.count_orphans:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
423 param_dict['ignore_orphans'] = False
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
424 if self.max_depth is not None:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
425 param_dict['max_depth'] = self.max_depth
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
426 if self.min_mapqual is not None:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
427 param_dict['min_mapping_quality'] = self.min_mapqual
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
428 if self.min_basequal is not None:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
429 param_dict['min_base_quality'] = self.min_basequal
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
430 return param_dict
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
431
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
432 def varcall_parallel(self, normal_purity=None, tumor_purity=None,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
433 min_coverage=None,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
434 min_var_count=None,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
435 min_var_freq=None, min_hom_freq=None,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
436 p_value=None, somatic_p_value=None,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
437 threads=None, verbose=None, quiet=None
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
438 ):
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
439 if not threads:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
440 threads = self.threads
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
441 if verbose is None:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
442 verbose = self.verbose
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
443 if quiet is None:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
444 quiet = self.quiet
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
445 # mapping of method parameters to varcall engine command line options
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
446 varcall_engine_option_mapping = [
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
447 ('--normal-purity', normal_purity),
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
448 ('--tumor-purity', tumor_purity),
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
449 ('--min-coverage', min_coverage),
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
450 ('--min-reads2', min_var_count),
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
451 ('--min-var-freq', min_var_freq),
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
452 ('--min-freq-for-hom', min_hom_freq),
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
453 ('--p-value', p_value),
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
454 ('--somatic-p-value', somatic_p_value),
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
455 ('--min-avg-qual', self.min_basequal)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
456 ]
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
457 varcall_engine_options = []
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
458 for option, value in varcall_engine_option_mapping:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
459 if value is not None:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
460 varcall_engine_options += [option, str(value)]
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
461 pileup_engine_options = ['-B']
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
462 if self.count_orphans:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
463 pileup_engine_options += ['-A']
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
464 if not self.detect_overlaps:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
465 pileup_engine_options += ['-x']
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
466 if self.max_depth is not None:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
467 pileup_engine_options += ['-d', str(self.max_depth)]
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
468 if self.min_mapqual is not None:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
469 pileup_engine_options += ['-q', str(self.min_mapqual)]
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
470 if self.min_basequal is not None:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
471 pileup_engine_options += ['-Q', str(self.min_basequal)]
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
472
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
473 # Create a tuple of calls to samtools mpileup and varscan for
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
474 # each contig. The contig name is stored as the third element of
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
475 # that tuple.
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
476 # The calls are stored in the reverse order of the contig list so
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
477 # that they can be popped off later in the original order
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
478 calls = [(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
479 self.pileup_engine + pileup_engine_options + [
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
480 '-r', contig + ':',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
481 '-f', self.ref_genome
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
482 ] + self.bam_input_files,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
483 self.varcall_engine + [
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
484 '-', '{out}', '--output-vcf', '1', '--mpileup', '1'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
485 ] + varcall_engine_options,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
486 contig
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
487 ) for contig in self.ref_contigs[::-1]]
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
488
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
489 if verbose:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
490 print('Starting variant calling ..')
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
491
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
492 # launch subprocesses and monitor their status
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
493 subprocesses = []
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
494 error_table = {}
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
495 tmp_io_started = []
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
496 tmp_io_finished = []
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
497 self.tmpfiles = []
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
498
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
499 def enqueue_stderr_output(out, stderr_buffer):
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
500 for line in iter(out.readline, b''):
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
501 # Eventually we are going to print the contents of
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
502 # the stderr_buffer to sys.stderr so we can
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
503 # decode things here using its encoding.
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
504 # We do a 'backslashreplace' just to be on the safe side.
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
505 stderr_buffer.write(line.decode(sys.stderr.encoding,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
506 'backslashreplace'))
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
507 out.close()
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
508
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
509 try:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
510 while subprocesses or calls:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
511 while calls and len(subprocesses) < threads:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
512 # There are still calls waiting for execution and we
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
513 # have unoccupied threads so we launch a new combined
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
514 # call to samtools mpileup and the variant caller.
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
515
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
516 # pop the call arguments from our call stack
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
517 call = calls.pop()
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
518 # get the name of the contig that this call is going
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
519 # to work on
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
520 contig = call[2]
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
521 # Based on the contig name, generate a readable and
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
522 # file system-compatible prefix and use it to create
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
523 # a named temporary file, to which the call output
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
524 # will be redirected.
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
525 # At the moment we create the output file we add it to
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
526 # the list of all temporary output files so that we can
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
527 # remove it eventually during cleanup.
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
528 call_out = self.TemporaryContigVCF(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
529 prefix=''.join(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
530 c if c.isalnum() else '_' for c in contig
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
531 ) + '_',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
532 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
533 # maintain a list of variant call outputs
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
534 # in the order the subprocesses got launched
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
535 tmp_io_started.append(call_out.name)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
536 if self.requires_stdout_redirect:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
537 # redirect stdout to the temporary file just created
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
538 stdout_p2 = call_out
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
539 stderr_p2 = subprocess.PIPE
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
540 else:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
541 # variant caller wants to write output to file directly
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
542 stdout_p2 = subprocess.PIPE
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
543 stderr_p2 = subprocess.STDOUT
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
544 call[1][call[1].index('{out}')] = call_out.name
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
545 call_out.close()
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
546 # for reporting purposes, join the arguments for the
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
547 # samtools and the variant caller calls into readable
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
548 # strings
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
549 c_str = (' '.join(call[0]), ' '.join(call[1]))
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
550 error_table[c_str] = [io.StringIO(), io.StringIO()]
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
551 # start the subprocesses
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
552 p1 = subprocess.Popen(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
553 call[0],
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
554 stdout=subprocess.PIPE, stderr=subprocess.PIPE
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
555 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
556 p2 = subprocess.Popen(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
557 call[1],
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
558 stdin=p1.stdout,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
559 stdout=stdout_p2,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
560 stderr=stderr_p2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
561 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
562 # subprocess bookkeeping
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
563 subprocesses.append((c_str, p1, p2, call_out, contig))
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
564 # make sure our newly launched call does not block
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
565 # because its buffers fill up
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
566 p1.stdout.close()
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
567 t1 = Thread(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
568 target=enqueue_stderr_output,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
569 args=(p1.stderr, error_table[c_str][0])
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
570 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
571 t2 = Thread(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
572 target=enqueue_stderr_output,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
573 args=(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
574 p2.stderr
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
575 if self.requires_stdout_redirect else
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
576 p2.stdout,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
577 error_table[c_str][1]
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
578 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
579 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
580 t1.daemon = t2.daemon = True
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
581 t1.start()
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
582 t2.start()
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
583
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
584 if verbose:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
585 print(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
586 'Calling variants for contig: {0}'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
587 .format(call[2])
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
588 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
589
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
590 # monitor all running calls to see if any of them are done
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
591 for call, p1, p2, ofo, contig in subprocesses:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
592 p1_stat = p1.poll()
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
593 p2_stat = p2.poll()
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
594 if p1_stat is not None or p2_stat is not None:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
595 # There is an outcome for this process!
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
596 # Lets see what it is
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
597 if p1_stat or p2_stat:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
598 print()
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
599 print(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
600 error_table[call][0].getvalue(),
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
601 error_table[call][1].getvalue(),
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
602 file=sys.stderr
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
603 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
604 raise VariantCallingError(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
605 'Variant Calling for contig {0} failed.'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
606 .format(contig),
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
607 call='{0} | {1}'.format(call[0], call[1])
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
608 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
609 if p1_stat == 0 and p2_stat is None:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
610 # VarScan is not handling the no output from
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
611 # samtools mpileup situation correctly so maybe
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
612 # that's the issue here
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
613 last_words = error_table[call][1].getvalue(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
614 ).splitlines()[-4:]
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
615 if len(last_words) < 4 or any(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
616 not msg.startswith('Input stream not ready')
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
617 for msg in last_words
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
618 ):
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
619 break
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
620 # lets give this process a bit more time
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
621 # VarScan is waiting for input it will never
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
622 # get, stop it.
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
623 p2.terminate()
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
624 subprocesses.remove((call, p1, p2, ofo, contig))
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
625 ofo.close()
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
626 break
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
627 if p2_stat == 0:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
628 # Things went fine.
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
629 # maintain a list of variant call outputs
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
630 # that finished successfully (in the order
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
631 # they finished)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
632 tmp_io_finished.append(ofo.name)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
633 if verbose:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
634 print()
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
635 print('Contig {0} finished.'.format(contig))
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
636 if not quiet:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
637 print()
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
638 print(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
639 'stderr output from samtools mpileup/'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
640 'bcftools:'.upper(),
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
641 file=sys.stderr
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
642 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
643 print(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
644 error_table[call][0].getvalue(),
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
645 error_table[call][1].getvalue(),
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
646 file=sys.stderr
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
647 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
648 # Discard the collected stderr output from
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
649 # the call, remove the call from the list of
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
650 # running calls and close its output file.
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
651 del error_table[call]
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
652 subprocesses.remove((call, p1, p2, ofo, contig))
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
653 # Closing the output file is important or we
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
654 # may hit the file system limit for open files
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
655 # if there are lots of contigs.
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
656 ofo.close()
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
657 break
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
658 # wait a bit in between monitoring cycles
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
659 time.sleep(2)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
660 finally:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
661 for call, p1, p2, ofo, contig in subprocesses:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
662 # make sure we do not leave running subprocesses behind
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
663 for proc in (p1, p2):
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
664 try:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
665 proc.terminate()
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
666 except Exception:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
667 pass
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
668 # close currently open files
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
669 ofo.close()
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
670 # store the files with finished content in the order that
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
671 # the corresponding jobs were launched
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
672 self.tmpfiles = [f for f in tmp_io_started if f in tmp_io_finished]
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
673 # Make sure remaining buffered stderr output of
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
674 # subprocesses does not get lost.
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
675 # Currently, we don't screen this output for real errors,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
676 # but simply rewrite everything.
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
677 if not quiet and error_table:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
678 print()
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
679 print(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
680 'stderr output from samtools mpileup/bcftools:'.upper(),
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
681 file=sys.stderr
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
682 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
683 for call, errors in error_table.items():
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
684 print(' | '.join(call), ':', file=sys.stderr)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
685 print('-' * 20, file=sys.stderr)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
686 print('samtools mpileup output:', file=sys.stderr)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
687 print(errors[0].getvalue(), file=sys.stderr)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
688 print('varscan somatic output:', file=sys.stderr)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
689 print(errors[1].getvalue(), file=sys.stderr)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
690
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
691 def _add_ref_contigs_to_header(self, header):
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
692 for chrom, length in zip(self.ref_contigs, self.ref_lengths):
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
693 header.add_meta(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
694 'contig',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
695 items=[('ID', chrom), ('length', length)]
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
696 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
697
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
698 def _add_filters_to_header(self, header):
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
699 varscan_fpfilters = {
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
700 'VarCount': 'Fewer than {min_var_count2} variant-supporting reads',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
701 'VarFreq': 'Variant allele frequency below {min_var_freq2}',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
702 'VarAvgRL':
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
703 'Average clipped length of variant-supporting reads < '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
704 '{min_var_len}',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
705 'VarReadPos': 'Relative average read position < {min_var_readpos}',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
706 'VarDist3':
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
707 'Average distance to effective 3\' end < {min_var_dist3}',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
708 'VarMMQS':
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
709 'Average mismatch quality sum for variant reads > '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
710 '{max_var_mmqs}',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
711 'VarMapQual':
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
712 'Average mapping quality of variant reads < {min_var_mapqual}',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
713 'VarBaseQual':
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
714 'Average base quality of variant reads < {min_var_basequal}',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
715 'Strand':
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
716 'Strand representation of variant reads < {min_strandedness}',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
717 'RefAvgRL':
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
718 'Average clipped length of ref-supporting reads < '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
719 '{min_ref_len}',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
720 'RefReadPos':
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
721 'Relative average read position < {min_ref_readpos}',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
722 'RefDist3':
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
723 'Average distance to effective 3\' end < {min_ref_dist3}',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
724 'RefMapQual':
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
725 'Average mapping quality of reference reads < '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
726 '{min_ref_mapqual}',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
727 'RefBaseQual':
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
728 'Average base quality of ref-supporting reads < '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
729 '{min_ref_basequal}',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
730 'RefMMQS':
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
731 'Average mismatch quality sum for ref-supporting reads > '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
732 '{max_ref_mmqs}',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
733 'MMQSdiff':
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
734 'Mismatch quality sum difference (var - ref) > '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
735 '{max_mmqs_diff}',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
736 'MinMMQSdiff':
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
737 'Mismatch quality sum difference (var - ref) < '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
738 '{max_mmqs_diff}',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
739 'MapQualDiff':
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
740 'Mapping quality difference (ref - var) > {max_mapqual_diff}',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
741 'MaxBAQdiff':
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
742 'Average base quality difference (ref - var) > '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
743 '{max_basequal_diff}',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
744 'ReadLenDiff':
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
745 'Average supporting read length difference (ref - var) > '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
746 '{max_relative_len_diff}',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
747 }
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
748 for filter_id, description in varscan_fpfilters.items():
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
749 header.filters.add(filter_id, None, None, description)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
750
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
751 def _add_indel_info_flag_to_header(self, header):
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
752 header.info.add(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
753 'INDEL', 0, 'Flag', 'Indicates that the variant is an INDEL'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
754 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
755
4
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
756 def _standardize_format_fields(self, header):
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
757 """Add standard FORMAT key declarations to a VCF header."""
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
758
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
759 format_field_specs = [
6
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
760 # pysam will not add quotes around single-word descriptions,
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
761 # which is a violation of the VCF specification.
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
762 # To work around this we are using two words as the
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
763 # GT format description (instead of the commonly used "Genotype").
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
764 # This could be changed once pysam learns to quote correctly.
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
765 ('GT', '1', 'String', 'Genotype code'),
4
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
766 ('GQ', '1', 'Integer', 'Genotype quality'),
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
767 ('DP', '1', 'Integer', 'Read depth'),
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
768 ('AD', 'R', 'Integer', 'Read depth for each allele'),
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
769 ('ADF', 'R', 'Integer',
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
770 'Read depth for each allele on the forward strand'),
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
771 ('ADR', 'R', 'Integer',
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
772 'Read depth for each allele on the reverse strand')
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
773 ]
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
774 # Existing FORMAT declarations cannot be overwritten.
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
775 # The only viable strategy is to mark them as removed,
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
776 # then merge the header with another one containing the
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
777 # correct declarations. This is what is implemented below.
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
778 temp_header = pysam.VariantHeader()
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
779 for spec in format_field_specs:
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
780 temp_header.formats.add(*spec)
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
781 if spec[0] in header.formats:
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
782 header.formats.remove_header(spec[0])
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
783 header.merge(temp_header)
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
784
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
785 def _compile_common_header(self, varcall_template, no_filters=False):
6
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
786 # read the header produced by VarScan for use as a template
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
787 with pysam.VariantFile(varcall_template, 'r') as original_data:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
788 varscan_header = original_data.header
5
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
789 # don't propagate non-standard and redundant FORMAT keys written
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
790 # by VarScan
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
791 varscan_header.formats.remove_header('AD')
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
792 varscan_header.formats.remove_header('FREQ')
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
793 varscan_header.formats.remove_header('RD')
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
794 varscan_header.formats.remove_header('DP4')
6
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
795 # build a new header containing information not written by VarScan
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
796 common_header = pysam.VariantHeader()
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
797 # copy over sample info from the VarScan template
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
798 for sample in varscan_header.samples:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
799 common_header.samples.add(sample)
6
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
800 # add reference information
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
801 common_header.add_meta('reference', value=self.ref_genome)
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
802 # change the source information
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
803 common_header.add_meta('source', value='varscan.py')
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
804 # add contig information
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
805 self._add_ref_contigs_to_header(common_header)
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
806 # declare an INDEL flag for record INFO fields
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
807 self._add_indel_info_flag_to_header(common_header)
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
808 # merge in remaining information from the VarScan template
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
809 common_header.merge(varscan_header)
6
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
810 # add additional FILTER declarations
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
811 if not no_filters:
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
812 # add filter info
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
813 self._add_filters_to_header(common_header)
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
814 # generate standard FORMAT field declarations
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
815 # including a correct AD declaration to prevent VarScan's
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
816 # non-standard one from getting propagated
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
817 self._standardize_format_fields(common_header)
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
818 return common_header
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
819
5
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
820 def _fix_record_gt_fields(self, record):
4
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
821 """Migrate non-standard genotype fields to standard ones."""
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
822
5
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
823 # The key issue to consider here is that we need to modify
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
824 # genotype field values on a per-sample basis, but htslib
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
825 # reserves memory for the values of all samples upon the first
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
826 # modification of the field in the variant record.
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
827 # => We need to calculate all values first, then fill each
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
828 # genotype field starting with the sample with the largest value.
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
829 new_gt_fields = {'AD': [], 'ADF': [], 'ADR': []}
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
830 # store the current genotype field contents for each sample
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
831 per_sample_gts = record.samples.values()
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
832 # calculate and store the new genotype field values
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
833 for gt_field in per_sample_gts:
4
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
834 # generate a standard AD field by combining VarScan's
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
835 # RD and non-standard AD fields
5
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
836 new_gt_fields['AD'].append((gt_field['RD'], gt_field['AD'][0]))
4
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
837 # split VarScan's DP4 field into the standard fields
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
838 # ADF and ADR
5
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
839 new_gt_fields['ADF'].append(
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
840 (int(gt_field['DP4'][0]), int(gt_field['DP4'][2]))
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
841 )
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
842 new_gt_fields['ADR'].append(
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
843 (int(gt_field['DP4'][1]), int(gt_field['DP4'][3]))
4
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
844 )
5
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
845 # Modify the record's genotype fields.
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
846 # For each field, modify the sample containing the largest
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
847 # value for the field first.
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
848 # Without this precaution we could trigger:
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
849 # "bcf_update_format: Assertion `!fmt->p_free' failed."
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
850 # in vcf.c of htslib resulting in a core dump.
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
851 for field in sorted(new_gt_fields):
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
852 for new_field, sample_fields in sorted(
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
853 zip(new_gt_fields[field], per_sample_gts),
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
854 key=lambda x: max(x[0]),
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
855 reverse=True
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
856 ):
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
857 sample_fields[field] = new_field
4
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
858 # remove redundant fields
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
859 # FREQ is easy to calculate from AD
5
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
860 del record.format['FREQ']
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
861 del record.format['RD']
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
862 del record.format['DP4']
4
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
863
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
864 def _postprocess_variant_records(self, invcf,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
865 min_var_count2, min_var_count2_lc,
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
866 min_var_freq2, min_var_count2_depth,
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
867 min_ref_readpos, min_var_readpos,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
868 min_ref_dist3, min_var_dist3,
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
869 detect_q2_runs,
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
870 min_ref_len, min_var_len,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
871 max_relative_len_diff,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
872 min_strandedness, min_strand_reads,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
873 min_ref_basequal, min_var_basequal,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
874 max_basequal_diff,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
875 min_ref_mapqual, min_var_mapqual,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
876 max_mapqual_diff,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
877 max_ref_mmqs, max_var_mmqs,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
878 min_mmqs_diff, max_mmqs_diff,
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
879 ignore_md,
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
880 **args):
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
881 # set FILTER field according to Varscan criteria
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
882 # multiple FILTER entries must be separated by semicolons
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
883 # No filters applied should be indicated with MISSING
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
884
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
885 # since posterior filters are always applied to just one sample,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
886 # a better place to store the info is in the FT genotype field:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
887 # can be PASS, '.' to indicate that filters have not been applied,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
888 # or a semicolon-separated list of filters that failed
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
889 # unfortunately, gemini does not support this field
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
890
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
891 with ExitStack() as io_stack:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
892 normal_reads, tumor_reads = (
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
893 io_stack.enter_context(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
894 pysam.Samfile(fn, 'rb')) for fn in self.bam_input_files
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
895 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
896 refseq = io_stack.enter_context(pysam.FastaFile(self.ref_genome))
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
897 pileup_args = self._get_pysam_pileup_args()
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
898 _get_stats = get_allele_stats
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
899 for record in invcf:
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
900 is_indel = False
6
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
901 if record.alleles[0] == 'N':
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
902 # It makes no sense to call SNPs against an unknown
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
903 # reference base
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
904 continue
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
905 if len(record.alleles[0]) > 1:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
906 # a deletion
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
907 is_indel = True
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
908 alleles = [
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
909 record.alleles[1], record.alleles[0].replace(
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
910 record.alleles[1], record.alleles[1] + '-', 1
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
911 )
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
912 ]
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
913 elif len(record.alleles[1]) > 1:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
914 # an insertion
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
915 is_indel = True
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
916 alleles = [
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
917 record.alleles[0],
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
918 record.alleles[1].replace(
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
919 record.alleles[0], record.alleles[0] + '+', 1
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
920 )
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
921 ]
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
922 else:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
923 # a regular SNV
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
924 alleles = record.alleles[:2]
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
925 # get pileup for genomic region affected by this variant
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
926 if record.info['SS'] == '2':
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
927 # a somatic variant => generate pileup from tumor data
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
928 reads_of_interest = tumor_reads
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
929 calculate_ref_stats = record.samples['TUMOR']['RD'] > 0
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
930 elif record.info['SS'] in ['1', '3']:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
931 # a germline or LOH variant => pileup from normal data
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
932 reads_of_interest = normal_reads
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
933 calculate_ref_stats = record.samples['NORMAL']['RD'] > 0
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
934 else:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
935 # TO DO: figure out if there is anything interesting to do
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
936 # for SS status codes 0 (reference) and 5 (unknown)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
937 yield record
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
938 continue
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
939
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
940 # no multiallelic sites in varscan
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
941 assert len(record.alleles) == 2
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
942
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
943 if calculate_ref_stats:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
944 ref_stats, alt_stats = _get_stats(
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
945 reads_of_interest,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
946 (record.chrom, record.start, record.stop),
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
947 alleles,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
948 refseq,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
949 ignore_md=ignore_md,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
950 ignore_nm=False,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
951 mm_runs=True,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
952 detect_q2_runs=detect_q2_runs,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
953 pileup_args=pileup_args
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
954 )
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
955 else:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
956 ref_stats = None
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
957 alt_stats = _get_stats(
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
958 reads_of_interest,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
959 (record.chrom, record.start, record.stop),
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
960 alleles[1:2],
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
961 refseq,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
962 ignore_md=ignore_md,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
963 ignore_nm=False,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
964 mm_runs=True,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
965 detect_q2_runs=detect_q2_runs,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
966 pileup_args=pileup_args
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
967 )[0]
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
968 ref_count = 0
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
969 if ref_stats:
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
970 ref_count = ref_stats.reads_fw + ref_stats.reads_rv
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
971 if ref_stats.avg_basequal < min_ref_basequal:
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
972 record.filter.add('RefBaseQual')
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
973 if ref_count >= 2:
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
974 if ref_stats.avg_mapqual < min_ref_mapqual:
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
975 record.filter.add('RefMapQual')
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
976 if ref_stats.avg_dist_from_center < min_ref_readpos:
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
977 record.filter.add('RefReadPos')
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
978 # ref_stats.avg_mismatch_fraction
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
979 # is not a filter criterion in VarScan fpfilter
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
980 if ref_stats.avg_mismatch_qualsum > max_ref_mmqs:
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
981 record.filter.add('RefMMQS')
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
982 if not is_indel and (
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
983 ref_stats.avg_clipped_len < min_ref_len
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
984 ):
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
985 # VarScan fpfilter does not apply this filter
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
986 # for indels, so we do not do it either.
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
987 record.filter.add('RefAvgRL')
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
988 if ref_stats.avg_dist_from_3prime < min_ref_dist3:
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
989 record.filter.add('RefDist3')
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
990 if alt_stats:
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
991 alt_count = alt_stats.reads_fw + alt_stats.reads_rv
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
992 if alt_count < min_var_count2:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
993 if (
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
994 (alt_count + ref_count) >= min_var_count2_depth
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
995 ) or (
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
996 alt_count < min_var_count2_lc
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
997 ):
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
998 record.filter.add('VarCount')
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
999 if alt_count / alt_stats.reads_total < min_var_freq2:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1000 record.filter.add('VarFreq')
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1001 if not is_indel and (
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1002 alt_stats.avg_basequal < min_var_basequal
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1003 ):
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1004 record.filter.add('VarBaseQual')
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1005 if alt_count >= min_strand_reads:
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1006 if (
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1007 alt_stats.reads_fw / alt_count < min_strandedness
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1008 ) or (
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1009 alt_stats.reads_rv / alt_count < min_strandedness
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1010 ):
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1011 record.filter.add('Strand')
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1012 if alt_count >= 2:
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1013 if alt_stats.avg_mapqual < min_var_mapqual:
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1014 record.filter.add('VarMapQual')
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1015 if alt_stats.avg_dist_from_center < min_var_readpos:
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1016 record.filter.add('VarReadPos')
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1017 # alt_stats.avg_mismatch_fraction
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1018 # is not a filter criterion in VarScan fpfilter
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1019 if alt_stats.avg_mismatch_qualsum > max_var_mmqs:
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1020 record.filter.add('VarMMQS')
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1021 if not is_indel and (
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1022 alt_stats.avg_clipped_len < min_var_len
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1023 ):
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1024 # VarScan fpfilter does not apply this filter
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1025 # for indels, so we do not do it either.
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1026 record.filter.add('VarAvgRL')
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1027 if alt_stats.avg_dist_from_3prime < min_var_dist3:
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1028 record.filter.add('VarDist3')
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1029 if ref_count >= 2 and alt_count >= 2:
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1030 if (
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1031 ref_stats.avg_mapqual - alt_stats.avg_mapqual
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1032 ) > max_mapqual_diff:
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1033 record.filter.add('MapQualDiff')
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1034 if (
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1035 ref_stats.avg_basequal - alt_stats.avg_basequal
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1036 ) > max_basequal_diff:
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1037 record.filter.add('MaxBAQdiff')
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1038 mmqs_diff = (
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1039 alt_stats.avg_mismatch_qualsum
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1040 - ref_stats.avg_mismatch_qualsum
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1041 )
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1042 if mmqs_diff < min_mmqs_diff:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1043 record.filter.add('MinMMQSdiff')
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1044 if mmqs_diff > max_mmqs_diff:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1045 record.filter.add('MMQSdiff')
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1046 if (
8
4c69f367c326 "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 1232893782204bb041dd6ed46711295cb0bfc03f"
iuc
parents: 7
diff changeset
1047 1
4c69f367c326 "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 1232893782204bb041dd6ed46711295cb0bfc03f"
iuc
parents: 7
diff changeset
1048 - alt_stats.avg_clipped_len
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1049 / ref_stats.avg_clipped_len
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1050 ) > max_relative_len_diff:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1051 record.filter.add('ReadLenDiff')
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1052 else:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1053 # No variant-supporting reads for this record!
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1054 # This can happen in rare cases because of
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1055 # samtools mpileup issues, but indicates a
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1056 # rather unreliable variant call.
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1057 record.filter.add('VarCount')
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1058 record.filter.add('VarFreq')
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1059 yield record
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1060
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1061 def _indel_flagged_records(self, vcf):
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1062 for record in vcf:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1063 record.info['INDEL'] = True
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1064 yield record
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1065
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1066 def _merge_generator(self, vcf1, vcf2):
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1067 try:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1068 record1 = next(vcf1)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1069 except StopIteration:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1070 for record2 in vcf2:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1071 yield record2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1072 return
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1073 try:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1074 record2 = next(vcf2)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1075 except StopIteration:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1076 yield record1
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1077 for record1 in vcf1:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1078 yield record1
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1079 return
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1080 while True:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1081 if (record1.start, record1.stop) < (record2.start, record2.stop):
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1082 yield record1
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1083 try:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1084 record1 = next(vcf1)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1085 except StopIteration:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1086 yield record2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1087 for record2 in vcf2:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1088 yield record2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1089 return
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1090 else:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1091 yield record2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1092 try:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1093 record2 = next(vcf2)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1094 except StopIteration:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1095 yield record1
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1096 for record1 in vcf1:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1097 yield record1
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1098 return
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1099
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1100 def merge_and_postprocess(self, snps_out, indels_out=None,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1101 no_filters=False, **filter_args):
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1102 temporary_data = self.tmpfiles
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1103 self.tmpfiles = []
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1104 temporary_snp_files = [f + '.snp.vcf' for f in temporary_data]
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1105 temporary_indel_files = [f + '.indel.vcf' for f in temporary_data]
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1106
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1107 for f in temporary_data:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1108 try:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1109 os.remove(f)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1110 except Exception:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1111 pass
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1112
6
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
1113 def filter_minimal(data, **kwargs):
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
1114 for record in data:
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
1115 if record.alleles[0] != 'N' or len(record.alleles[1]) > 1:
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
1116 # Yield everything except SNPs called against an unknown
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
1117 # reference base
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
1118 yield record
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1119
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1120 if no_filters:
6
2b1246db2c83 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents: 5
diff changeset
1121 apply_filters = filter_minimal
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1122 else:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1123 apply_filters = self._postprocess_variant_records
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1124
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1125 output_header = self._compile_common_header(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1126 temporary_snp_files[0],
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1127 no_filters
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1128 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1129 if indels_out is None:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1130 with open(snps_out, 'w') as o:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1131 o.write(str(output_header).format(**filter_args))
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1132 for snp_f, indel_f in zip(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1133 temporary_snp_files, temporary_indel_files
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1134 ):
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1135 with pysam.VariantFile(snp_f, 'r') as snp_invcf:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1136 # fix the input header on the fly
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1137 # to avoid Warnings from htslib about missing contig
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1138 # info
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1139 self._add_ref_contigs_to_header(snp_invcf.header)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1140 self._add_filters_to_header(snp_invcf.header)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1141 self._add_indel_info_flag_to_header(snp_invcf.header)
4
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
1142 self._standardize_format_fields(snp_invcf.header)
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1143 with pysam.VariantFile(indel_f, 'r') as indel_invcf:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1144 # fix the input header on the fly
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1145 # to avoid Warnings from htslib about missing
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1146 # contig info
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1147 self._add_ref_contigs_to_header(indel_invcf.header)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1148 self._add_filters_to_header(indel_invcf.header)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1149 self._add_indel_info_flag_to_header(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1150 indel_invcf.header
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1151 )
4
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
1152 self._standardize_format_fields(indel_invcf.header)
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1153 for record in apply_filters(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1154 self._merge_generator(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1155 snp_invcf,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1156 self._indel_flagged_records(indel_invcf)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1157 ),
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1158 **filter_args
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1159 ):
5
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
1160 self._fix_record_gt_fields(record)
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1161 o.write(str(record))
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1162 try:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1163 os.remove(snp_f)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1164 except Exception:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1165 pass
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1166 try:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1167 os.remove(indel_f)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1168 except Exception:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1169 pass
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1170
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1171 else:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1172 with open(snps_out, 'w') as o:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1173 o.write(str(output_header).format(**filter_args))
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1174 for f in temporary_snp_files:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1175 with pysam.VariantFile(f, 'r') as invcf:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1176 # fix the input header on the fly
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1177 # to avoid Warnings from htslib about missing
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1178 # contig info and errors because of undeclared
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1179 # filters
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1180 self._add_ref_contigs_to_header(invcf.header)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1181 self._add_filters_to_header(invcf.header)
4
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
1182 self._standardize_format_fields(invcf.header)
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1183 for record in apply_filters(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1184 invcf, **filter_args
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1185 ):
5
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
1186 self._fix_record_gt_fields(record)
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1187 o.write(str(record))
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1188 try:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1189 os.remove(f)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1190 except Exception:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1191 pass
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1192 with open(indels_out, 'w') as o:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1193 o.write(str(output_header))
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1194 for f in temporary_indel_files:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1195 with pysam.VariantFile(f, 'r') as invcf:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1196 # fix the input header on the fly
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1197 # to avoid Warnings from htslib about missing
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1198 # contig info and errors because of undeclared
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1199 # filters
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1200 self._add_ref_contigs_to_header(invcf.header)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1201 self._add_filters_to_header(invcf.header)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1202 self._add_indel_info_flag_to_header(invcf.header)
4
36e5fdd64607 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents: 2
diff changeset
1203 self._standardize_format_fields(invcf.header)
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1204 for record in apply_filters(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1205 self._indel_flagged_records(invcf), **filter_args
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1206 ):
5
8862177a6ead planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents: 4
diff changeset
1207 self._fix_record_gt_fields(record)
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1208 o.write(str(record))
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1209 try:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1210 os.remove(f)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1211 except Exception:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1212 pass
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1213
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1214
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1215 def varscan_call(ref_genome, normal, tumor, output_path, **args):
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1216 """Preparse arguments and orchestrate calling and postprocessing."""
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1217
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1218 if args.pop('split_output'):
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1219 if '%T' in output_path:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1220 out = (
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1221 output_path.replace('%T', 'snp'),
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1222 output_path.replace('%T', 'indel')
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1223 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1224 else:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1225 out = (
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1226 output_path + '.snp',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1227 output_path + '.indel'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1228 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1229 else:
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1230 out = (output_path, None)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1231
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1232 instance_args = {
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1233 k: args.pop(k) for k in [
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1234 'max_depth',
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1235 'count_orphans',
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1236 'detect_overlaps',
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1237 'min_mapqual',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1238 'min_basequal',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1239 'threads',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1240 'verbose',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1241 'quiet'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1242 ]
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1243 }
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1244 varscan_somatic_args = {
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1245 k: args.pop(k) for k in [
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1246 'normal_purity',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1247 'tumor_purity',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1248 'min_coverage',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1249 'min_var_count',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1250 'min_var_freq',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1251 'min_hom_freq',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1252 'somatic_p_value',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1253 'p_value'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1254 ]
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1255 }
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1256
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1257 v = VarScanCaller(ref_genome, [normal, tumor], **instance_args)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1258 v.varcall_parallel(**varscan_somatic_args)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1259 v.merge_and_postprocess(*out, **args)
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1260
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1261
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1262 if __name__ == '__main__':
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1263 p = argparse.ArgumentParser()
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1264 p.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1265 'ref_genome',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1266 metavar='reference_genome',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1267 help='the reference genome (in fasta format)'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1268 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1269 p.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1270 '--normal',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1271 metavar='BAM_file', required=True,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1272 help='the BAM input file of aligned reads from the normal sample'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1273 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1274 p.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1275 '--tumor',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1276 metavar='BAM_file', required=True,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1277 help='the BAM input file of aligned reads from the tumor sample'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1278 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1279 p.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1280 '-o', '--ofile', required=True,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1281 metavar='OFILE', dest='output_path',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1282 help='Name of the variant output file. With --split-output, the name '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1283 'may use the %%T replacement token or will be used as the '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1284 'basename for the two output files to be generated (see '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1285 '-s|--split-output below).'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1286 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1287 p.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1288 '-s', '--split-output',
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1289 dest='split_output', action='store_true',
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1290 help='indicate that separate output files for SNPs and indels '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1291 'should be generated (original VarScan behavior). If specified, '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1292 '%%T in the --ofile file name will be replaced with "snp" and '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1293 '"indel" to generate the names of the SNP and indel output '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1294 'files, respectively. If %%T is not found in the file name, it '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1295 'will get interpreted as a basename to which ".snp"/".indel" '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1296 'will be appended.'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1297 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1298 p.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1299 '-t', '--threads',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1300 type=int, default=1,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1301 help='level of parallelism'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1302 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1303 p.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1304 '-v', '--verbose',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1305 action='store_true',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1306 help='be verbose about progress'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1307 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1308 p.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1309 '-q', '--quiet',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1310 action='store_true',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1311 help='suppress output from wrapped tools'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1312 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1313 call_group = p.add_argument_group('Variant calling parameters')
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1314 call_group.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1315 '--normal-purity',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1316 dest='normal_purity', type=float,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1317 default=1.0,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1318 help='Estimated purity of the normal sample (default: 1.0)'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1319 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1320 call_group.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1321 '--tumor-purity',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1322 dest='tumor_purity', type=float,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1323 default=1.0,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1324 help='Estimated purity of the tumor sample (default: 1.0)'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1325 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1326 call_group.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1327 '--max-pileup-depth',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1328 dest='max_depth', type=int, default=8000,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1329 help='Maximum depth of generated pileups (samtools mpileup -d option; '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1330 'default: 8000)'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1331 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1332 call_group.add_argument(
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1333 '--count-orphans',
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1334 dest='count_orphans', action='store_true',
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1335 help='Use anomalous read pairs in variant calling '
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1336 '(samtools mpileup -A option; default: ignore anomalous pairs)'
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1337 )
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1338 call_group.add_argument(
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1339 '--no-detect-overlaps',
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1340 dest='detect_overlaps', action='store_false',
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1341 help='Disable automatic read-pair overlap detection by samtools '
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1342 'mpileup. Overlap detection tries to avoid counting duplicated '
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1343 'bases twice during variant calling. '
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1344 '(samtools mpileup -x option; default: use overlap detection)'
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1345 )
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1346 call_group.add_argument(
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1347 '--min-basequal',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1348 dest='min_basequal', type=int,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1349 default=13,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1350 help='Minimum base quality at the variant position to use a read '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1351 '(default: 13)'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1352 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1353 call_group.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1354 '--min-mapqual',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1355 dest='min_mapqual', type=int,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1356 default=0,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1357 help='Minimum mapping quality required to use a read '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1358 '(default: 0)'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1359 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1360 call_group.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1361 '--min-coverage',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1362 dest='min_coverage', type=int,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1363 default=8,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1364 help='Minimum site coverage required in the normal and in the tumor '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1365 'sample to call a variant (default: 8)'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1366 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1367 call_group.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1368 '--min-var-count',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1369 dest='min_var_count', type=int,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1370 default=2,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1371 help='Minimum number of variant-supporting reads required to call a '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1372 'variant (default: 2)'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1373 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1374 call_group.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1375 '--min-var-freq',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1376 dest='min_var_freq', type=float,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1377 default=0.1,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1378 help='Minimum variant allele frequency for calling (default: 0.1)'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1379 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1380 call_group.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1381 '--min-hom-freq',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1382 dest='min_hom_freq', type=float,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1383 default=0.75,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1384 help='Minimum variant allele frequency for homozygous call '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1385 '(default: 0.75)'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1386 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1387 call_group.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1388 '--p-value',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1389 dest='p_value', type=float,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1390 default=0.99,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1391 help='P-value threshold for heterozygous call (default: 0.99)'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1392 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1393 call_group.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1394 '--somatic-p-value',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1395 dest='somatic_p_value', type=float,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1396 default=0.05,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1397 help='P-value threshold for somatic call (default: 0.05)'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1398 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1399 filter_group = p.add_argument_group('Posterior variant filter parameters')
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1400 filter_group.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1401 '--no-filters',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1402 dest='no_filters', action='store_true',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1403 help='Disable all posterior variant filters. '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1404 'If specified, all following options will be ignored'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1405 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1406 filter_group.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1407 '--min-var-count2',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1408 dest='min_var_count2', type=int,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1409 default=4,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1410 help='Minimum number of variant-supporting reads (default: 4)'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1411 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1412 filter_group.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1413 '--min-var-count2-lc',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1414 dest='min_var_count2_lc', type=int,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1415 default=2,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1416 help='Minimum number of variant-supporting reads when depth below '
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1417 '--min-var-count2-depth (default: 2)'
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1418 )
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1419 filter_group.add_argument(
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1420 '--min-var-count2-depth',
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1421 dest='min_var_count2_depth', type=int,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1422 default=10,
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1423 help='Combined depth of ref- and variant-supporting reads required to '
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1424 'apply the --min-var-count filter instead of --min-var-count-lc '
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1425 '(default: 10)'
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1426 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1427 filter_group.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1428 '--min-var-freq2',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1429 dest='min_var_freq2', type=float,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1430 default=0.05,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1431 help='Minimum variant allele frequency (default: 0.05)'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1432 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1433 filter_group.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1434 '--min-ref-readpos',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1435 dest='min_ref_readpos', type=float,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1436 default=0.1,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1437 help='Minimum average relative distance of site from the ends of '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1438 'ref-supporting reads (default: 0.1)'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1439 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1440 filter_group.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1441 '--min-var-readpos',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1442 dest='min_var_readpos', type=float,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1443 default=0.1,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1444 help='Minimum average relative distance of site from the ends of '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1445 'variant-supporting reads (default: 0.1)'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1446 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1447 filter_group.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1448 '--min-ref-dist3',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1449 dest='min_ref_dist3', type=float,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1450 default=0.1,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1451 help='Minimum average relative distance of site from the effective '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1452 '3\'end of ref-supporting reads (default: 0.1)'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1453 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1454 filter_group.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1455 '--min-var-dist3',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1456 dest='min_var_dist3', type=float,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1457 default=0.1,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1458 help='Minimum average relative distance of site from the effective '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1459 '3\'end of variant-supporting reads (default: 0.1)'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1460 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1461 filter_group.add_argument(
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1462 '--detect-q2-runs',
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1463 dest='detect_q2_runs', action='store_true',
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1464 help='Look for 3\'-terminal q2 runs and take their lengths into '
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1465 'account for determining the effective 3\'end of reads '
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1466 '(default: off)'
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1467 )
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1468 filter_group.add_argument(
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1469 '--min-ref-len',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1470 dest='min_ref_len', type=int,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1471 default=90,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1472 help='Minimum average trimmed length of reads supporting the ref '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1473 'allele (default: 90)'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1474 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1475 filter_group.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1476 '--min-var-len',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1477 dest='min_var_len', type=int,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1478 default=90,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1479 help='Minimum average trimmed length of reads supporting the variant '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1480 'allele (default: 90)'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1481 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1482 filter_group.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1483 '--max-len-diff',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1484 dest='max_relative_len_diff', type=float,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1485 default=0.25,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1486 help='Maximum average relative read length difference (ref - var; '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1487 'default: 0.25)'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1488 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1489 filter_group.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1490 '--min-strandedness',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1491 dest='min_strandedness', type=float,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1492 default=0.01,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1493 help='Minimum fraction of variant reads from each strand '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1494 '(default: 0.01)'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1495 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1496 filter_group.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1497 '--min-strand-reads',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1498 dest='min_strand_reads', type=int,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1499 default=5,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1500 help='Minimum allele depth required to run --min-strandedness filter '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1501 '(default: 5)'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1502 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1503 filter_group.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1504 '--min-ref-basequal',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1505 dest='min_ref_basequal', type=int,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1506 default=15,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1507 help='Minimum average base quality for the ref allele (default: 15)'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1508 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1509 filter_group.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1510 '--min-var-basequal',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1511 dest='min_var_basequal', type=int,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1512 default=15,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1513 help='Minimum average base quality for the variant allele '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1514 '(default: 15)'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1515 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1516 filter_group.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1517 '--max-basequal-diff',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1518 dest='max_basequal_diff', type=int,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1519 default=50,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1520 help='Maximum average base quality diff (ref - var; default: 50)'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1521 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1522 filter_group.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1523 '--min-ref-mapqual',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1524 dest='min_ref_mapqual', type=int,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1525 default=15,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1526 help='Minimum average mapping quality of reads supporting the ref '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1527 'allele (default: 15)'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1528 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1529 filter_group.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1530 '--min-var-mapqual',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1531 dest='min_var_mapqual', type=int,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1532 default=15,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1533 help='Minimum average mapping quality of reads supporting the variant '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1534 'allele (default: 15)'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1535 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1536 filter_group.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1537 '--max-mapqual-diff',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1538 dest='max_mapqual_diff', type=int,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1539 default=50,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1540 help='Maximum average mapping quality difference (ref - var; '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1541 'default: 50)'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1542 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1543 filter_group.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1544 '--max-ref-mmqs',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1545 dest='max_ref_mmqs', type=int,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1546 default=100,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1547 help='Maximum mismatch quality sum of reads supporting the ref '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1548 'allele (default: 100)'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1549 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1550 filter_group.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1551 '--max-var-mmqs',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1552 dest='max_var_mmqs', type=int,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1553 default=100,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1554 help='Maximum mismatch quality sum of reads supporting the variant '
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1555 'allele (default: 100)'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1556 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1557 filter_group.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1558 '--min-mmqs-diff',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1559 dest='min_mmqs_diff', type=int,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1560 default=0,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1561 help='Minimum mismatch quality sum difference (var - ref; default: 0)'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1562 )
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1563 filter_group.add_argument(
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1564 '--max-mmqs-diff',
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1565 dest='max_mmqs_diff', type=int,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1566 default=50,
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1567 help='Maximum mismatch quality sum difference (var - ref; default: 50)'
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1568 )
7
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1569 filter_group.add_argument(
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1570 '--ignore-md',
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1571 dest='ignore_md', action='store_true',
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1572 help='Do not rely on read MD tag, even if it is present on the mapped '
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1573 'reads, and recalculate mismatch quality stats from ref '
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1574 'alignments instead.'
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1575 )
100090cb4bec "planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit fcf5ac14629c694f0f64773fab0428b1e78fe156"
iuc
parents: 6
diff changeset
1576
2
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1577 args = vars(p.parse_args())
83d72fb136f7 planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 3932667bb4f6770a671141f7aab1f326e6dd1919
iuc
parents:
diff changeset
1578 varscan_call(**args)