Mercurial > repos > iuc > varscan_mpileup
annotate varscan.py @ 3:ee62c46d9cbe draft
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 79f2f0e89e74348cf18602e83762a0cb26131f17
author | iuc |
---|---|
date | Tue, 04 Dec 2018 05:51:02 -0500 |
parents | d062703d6f13 |
children | ab2f908f0b08 |
rev | line source |
---|---|
2
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1 #!/usr/bin/env python3 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
2 from __future__ import print_function |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
3 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
4 import argparse |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
5 import io |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
6 import os |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
7 import subprocess |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
8 import sys |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
9 import tempfile |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
10 import time |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
11 from contextlib import ExitStack |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
12 from functools import partial |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
13 from threading import Thread |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
14 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
15 import pysam |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
16 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
17 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
18 class VariantCallingError (RuntimeError): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
19 """Exception class for issues with samtools and varscan subprocesses.""" |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
20 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
21 def __init__(self, message=None, call='', error=''): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
22 self.message = message |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
23 self.call = call.strip() |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
24 self.error = error.strip() |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
25 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
26 def __str__(self): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
27 if self.message is None: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
28 return '' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
29 if self.error: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
30 msg_header = '"{0}" failed with:\n{1}\n\n'.format( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
31 self.call, self.error |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
32 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
33 else: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
34 msg_header = '{0} failed.\n' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
35 'No further information about this error is available.\n\n'.format( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
36 self.call |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
37 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
38 return msg_header + self.message |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
39 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
40 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
41 class VarScanCaller (object): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
42 def __init__(self, ref_genome, bam_input_files, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
43 max_depth=None, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
44 min_mapqual=None, min_basequal=None, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
45 threads=1, verbose=False, quiet=True |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
46 ): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
47 self.ref_genome = ref_genome |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
48 self.bam_input_files = bam_input_files |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
49 self.max_depth = max_depth |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
50 self.min_mapqual = min_mapqual |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
51 self.min_basequal = min_basequal |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
52 self.threads = threads |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
53 self.verbose = verbose |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
54 self.quiet = quiet |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
55 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
56 with pysam.FastaFile(ref_genome) as ref_fa: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
57 self.ref_contigs = ref_fa.references |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
58 self.ref_lengths = ref_fa.lengths |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
59 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
60 self.pileup_engine = ['samtools', 'mpileup'] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
61 self.varcall_engine = ['varscan', 'somatic'] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
62 self.requires_stdout_redirect = False |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
63 self.TemporaryContigVCF = partial( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
64 tempfile.NamedTemporaryFile, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
65 mode='wb', suffix='', delete=False, dir=os.getcwd() |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
66 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
67 self.tmpfiles = [] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
68 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
69 def _get_pysam_pileup_args(self): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
70 param_dict = {} |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
71 if self.max_depth is not None: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
72 param_dict['max_depth'] = self.max_depth |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
73 if self.min_mapqual is not None: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
74 param_dict['min_mapping_quality'] = self.min_mapqual |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
75 if self.min_basequal is not None: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
76 param_dict['min_base_quality'] = self.min_basequal |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
77 param_dict['compute_baq'] = False |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
78 param_dict['stepper'] = 'samtools' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
79 return param_dict |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
80 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
81 def varcall_parallel(self, normal_purity=None, tumor_purity=None, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
82 min_coverage=None, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
83 min_var_count=None, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
84 min_var_freq=None, min_hom_freq=None, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
85 p_value=None, somatic_p_value=None, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
86 threads=None, verbose=None, quiet=None |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
87 ): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
88 if not threads: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
89 threads = self.threads |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
90 if verbose is None: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
91 verbose = self.verbose |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
92 if quiet is None: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
93 quiet = self.quiet |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
94 # mapping of method parameters to varcall engine command line options |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
95 varcall_engine_option_mapping = [ |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
96 ('--normal-purity', normal_purity), |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
97 ('--tumor-purity', tumor_purity), |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
98 ('--min-coverage', min_coverage), |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
99 ('--min-reads2', min_var_count), |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
100 ('--min-var-freq', min_var_freq), |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
101 ('--min-freq-for-hom', min_hom_freq), |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
102 ('--p-value', p_value), |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
103 ('--somatic-p-value', somatic_p_value), |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
104 ('--min-avg-qual', self.min_basequal) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
105 ] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
106 varcall_engine_options = [] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
107 for option, value in varcall_engine_option_mapping: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
108 if value is not None: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
109 varcall_engine_options += [option, str(value)] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
110 pileup_engine_options = ['-B'] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
111 if self.max_depth is not None: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
112 pileup_engine_options += ['-d', str(self.max_depth)] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
113 if self.min_mapqual is not None: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
114 pileup_engine_options += ['-q', str(self.min_mapqual)] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
115 if self.min_basequal is not None: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
116 pileup_engine_options += ['-Q', str(self.min_basequal)] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
117 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
118 # Create a tuple of calls to samtools mpileup and varscan for |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
119 # each contig. The contig name is stored as the third element of |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
120 # that tuple. |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
121 # The calls are stored in the reverse order of the contig list so |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
122 # that they can be popped off later in the original order |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
123 calls = [( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
124 self.pileup_engine + pileup_engine_options + [ |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
125 '-r', contig + ':', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
126 '-f', self.ref_genome |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
127 ] + self.bam_input_files, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
128 self.varcall_engine + [ |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
129 '-', '{out}', '--output-vcf', '1', '--mpileup', '1' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
130 ] + varcall_engine_options, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
131 contig |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
132 ) for contig in self.ref_contigs[::-1]] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
133 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
134 if verbose: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
135 print('Starting variant calling ..') |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
136 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
137 # launch subprocesses and monitor their status |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
138 subprocesses = [] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
139 error_table = {} |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
140 tmp_io_started = [] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
141 tmp_io_finished = [] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
142 self.tmpfiles = [] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
143 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
144 def enqueue_stderr_output(out, stderr_buffer): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
145 for line in iter(out.readline, b''): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
146 # Eventually we are going to print the contents of |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
147 # the stderr_buffer to sys.stderr so we can |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
148 # decode things here using its encoding. |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
149 # We do a 'backslashreplace' just to be on the safe side. |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
150 stderr_buffer.write(line.decode(sys.stderr.encoding, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
151 'backslashreplace')) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
152 out.close() |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
153 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
154 try: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
155 while subprocesses or calls: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
156 while calls and len(subprocesses) < threads: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
157 # There are still calls waiting for execution and we |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
158 # have unoccupied threads so we launch a new combined |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
159 # call to samtools mpileup and the variant caller. |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
160 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
161 # pop the call arguments from our call stack |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
162 call = calls.pop() |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
163 # get the name of the contig that this call is going |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
164 # to work on |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
165 contig = call[2] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
166 # Based on the contig name, generate a readable and |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
167 # file system-compatible prefix and use it to create |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
168 # a named temporary file, to which the call output |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
169 # will be redirected. |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
170 # At the moment we create the output file we add it to |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
171 # the list of all temporary output files so that we can |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
172 # remove it eventually during cleanup. |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
173 call_out = self.TemporaryContigVCF( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
174 prefix=''.join( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
175 c if c.isalnum() else '_' for c in contig |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
176 ) + '_', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
177 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
178 # maintain a list of variant call outputs |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
179 # in the order the subprocesses got launched |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
180 tmp_io_started.append(call_out.name) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
181 if self.requires_stdout_redirect: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
182 # redirect stdout to the temporary file just created |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
183 stdout_p2 = call_out |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
184 stderr_p2 = subprocess.PIPE |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
185 else: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
186 # variant caller wants to write output to file directly |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
187 stdout_p2 = subprocess.PIPE |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
188 stderr_p2 = subprocess.STDOUT |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
189 call[1][call[1].index('{out}')] = call_out.name |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
190 call_out.close() |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
191 # for reporting purposes, join the arguments for the |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
192 # samtools and the variant caller calls into readable |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
193 # strings |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
194 c_str = (' '.join(call[0]), ' '.join(call[1])) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
195 error_table[c_str] = [io.StringIO(), io.StringIO()] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
196 # start the subprocesses |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
197 p1 = subprocess.Popen( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
198 call[0], |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
199 stdout=subprocess.PIPE, stderr=subprocess.PIPE |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
200 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
201 p2 = subprocess.Popen( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
202 call[1], |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
203 stdin=p1.stdout, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
204 stdout=stdout_p2, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
205 stderr=stderr_p2 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
206 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
207 # subprocess bookkeeping |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
208 subprocesses.append((c_str, p1, p2, call_out, contig)) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
209 # make sure our newly launched call does not block |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
210 # because its buffers fill up |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
211 p1.stdout.close() |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
212 t1 = Thread( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
213 target=enqueue_stderr_output, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
214 args=(p1.stderr, error_table[c_str][0]) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
215 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
216 t2 = Thread( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
217 target=enqueue_stderr_output, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
218 args=( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
219 p2.stderr |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
220 if self.requires_stdout_redirect else |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
221 p2.stdout, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
222 error_table[c_str][1] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
223 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
224 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
225 t1.daemon = t2.daemon = True |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
226 t1.start() |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
227 t2.start() |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
228 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
229 if verbose: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
230 print( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
231 'Calling variants for contig: {0}' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
232 .format(call[2]) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
233 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
234 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
235 # monitor all running calls to see if any of them are done |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
236 for call, p1, p2, ofo, contig in subprocesses: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
237 p1_stat = p1.poll() |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
238 p2_stat = p2.poll() |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
239 if p1_stat is not None or p2_stat is not None: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
240 # There is an outcome for this process! |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
241 # Lets see what it is |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
242 if p1_stat or p2_stat: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
243 print() |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
244 print( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
245 error_table[call][0].getvalue(), |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
246 error_table[call][1].getvalue(), |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
247 file=sys.stderr |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
248 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
249 raise VariantCallingError( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
250 'Variant Calling for contig {0} failed.' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
251 .format(contig), |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
252 call='{0} | {1}'.format(call[0], call[1]) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
253 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
254 if p1_stat == 0 and p2_stat is None: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
255 # VarScan is not handling the no output from |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
256 # samtools mpileup situation correctly so maybe |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
257 # that's the issue here |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
258 last_words = error_table[call][1].getvalue( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
259 ).splitlines()[-4:] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
260 if len(last_words) < 4 or any( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
261 not msg.startswith('Input stream not ready') |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
262 for msg in last_words |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
263 ): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
264 break |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
265 # lets give this process a bit more time |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
266 # VarScan is waiting for input it will never |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
267 # get, stop it. |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
268 p2.terminate() |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
269 subprocesses.remove((call, p1, p2, ofo, contig)) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
270 ofo.close() |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
271 break |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
272 if p2_stat == 0: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
273 # Things went fine. |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
274 # maintain a list of variant call outputs |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
275 # that finished successfully (in the order |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
276 # they finished) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
277 tmp_io_finished.append(ofo.name) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
278 if verbose: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
279 print() |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
280 print('Contig {0} finished.'.format(contig)) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
281 if not quiet: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
282 print() |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
283 print( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
284 'stderr output from samtools mpileup/' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
285 'bcftools:'.upper(), |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
286 file=sys.stderr |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
287 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
288 print( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
289 error_table[call][0].getvalue(), |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
290 error_table[call][1].getvalue(), |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
291 file=sys.stderr |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
292 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
293 # Discard the collected stderr output from |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
294 # the call, remove the call from the list of |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
295 # running calls and close its output file. |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
296 del error_table[call] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
297 subprocesses.remove((call, p1, p2, ofo, contig)) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
298 # Closing the output file is important or we |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
299 # may hit the file system limit for open files |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
300 # if there are lots of contigs. |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
301 ofo.close() |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
302 break |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
303 # wait a bit in between monitoring cycles |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
304 time.sleep(2) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
305 finally: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
306 for call, p1, p2, ofo, contig in subprocesses: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
307 # make sure we do not leave running subprocesses behind |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
308 for proc in (p1, p2): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
309 try: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
310 proc.terminate() |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
311 except Exception: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
312 pass |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
313 # close currently open files |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
314 ofo.close() |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
315 # store the files with finished content in the order that |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
316 # the corresponding jobs were launched |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
317 self.tmpfiles = [f for f in tmp_io_started if f in tmp_io_finished] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
318 # Make sure remaining buffered stderr output of |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
319 # subprocesses does not get lost. |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
320 # Currently, we don't screen this output for real errors, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
321 # but simply rewrite everything. |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
322 if not quiet and error_table: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
323 print() |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
324 print( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
325 'stderr output from samtools mpileup/bcftools:'.upper(), |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
326 file=sys.stderr |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
327 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
328 for call, errors in error_table.items(): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
329 print(' | '.join(call), ':', file=sys.stderr) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
330 print('-' * 20, file=sys.stderr) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
331 print('samtools mpileup output:', file=sys.stderr) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
332 print(errors[0].getvalue(), file=sys.stderr) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
333 print('varscan somatic output:', file=sys.stderr) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
334 print(errors[1].getvalue(), file=sys.stderr) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
335 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
336 def _add_ref_contigs_to_header(self, header): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
337 for chrom, length in zip(self.ref_contigs, self.ref_lengths): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
338 header.add_meta( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
339 'contig', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
340 items=[('ID', chrom), ('length', length)] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
341 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
342 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
343 def _add_filters_to_header(self, header): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
344 varscan_fpfilters = { |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
345 'VarCount': 'Fewer than {min_var_count2} variant-supporting reads', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
346 'VarFreq': 'Variant allele frequency below {min_var_freq2}', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
347 'VarAvgRL': |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
348 'Average clipped length of variant-supporting reads < ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
349 '{min_var_len}', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
350 'VarReadPos': 'Relative average read position < {min_var_readpos}', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
351 'VarDist3': |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
352 'Average distance to effective 3\' end < {min_var_dist3}', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
353 'VarMMQS': |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
354 'Average mismatch quality sum for variant reads > ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
355 '{max_var_mmqs}', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
356 'VarMapQual': |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
357 'Average mapping quality of variant reads < {min_var_mapqual}', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
358 'VarBaseQual': |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
359 'Average base quality of variant reads < {min_var_basequal}', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
360 'Strand': |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
361 'Strand representation of variant reads < {min_strandedness}', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
362 'RefAvgRL': |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
363 'Average clipped length of ref-supporting reads < ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
364 '{min_ref_len}', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
365 'RefReadPos': |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
366 'Relative average read position < {min_ref_readpos}', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
367 'RefDist3': |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
368 'Average distance to effective 3\' end < {min_ref_dist3}', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
369 'RefMapQual': |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
370 'Average mapping quality of reference reads < ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
371 '{min_ref_mapqual}', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
372 'RefBaseQual': |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
373 'Average base quality of ref-supporting reads < ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
374 '{min_ref_basequal}', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
375 'RefMMQS': |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
376 'Average mismatch quality sum for ref-supporting reads > ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
377 '{max_ref_mmqs}', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
378 'MMQSdiff': |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
379 'Mismatch quality sum difference (var - ref) > ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
380 '{max_mmqs_diff}', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
381 'MinMMQSdiff': |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
382 'Mismatch quality sum difference (var - ref) < ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
383 '{max_mmqs_diff}', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
384 'MapQualDiff': |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
385 'Mapping quality difference (ref - var) > {max_mapqual_diff}', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
386 'MaxBAQdiff': |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
387 'Average base quality difference (ref - var) > ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
388 '{max_basequal_diff}', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
389 'ReadLenDiff': |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
390 'Average supporting read length difference (ref - var) > ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
391 '{max_relative_len_diff}', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
392 } |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
393 for filter_id, description in varscan_fpfilters.items(): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
394 header.filters.add(filter_id, None, None, description) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
395 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
396 def _add_indel_info_flag_to_header(self, header): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
397 header.info.add( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
398 'INDEL', 0, 'Flag', 'Indicates that the variant is an INDEL' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
399 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
400 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
401 def _compile_common_header(self, varcall_template, no_filters=False): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
402 # fix the header generated by VarScan |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
403 # by adding reference and contig information |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
404 common_header = pysam.VariantHeader() |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
405 common_header.add_meta('reference', value=self.ref_genome) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
406 self._add_ref_contigs_to_header(common_header) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
407 if not no_filters: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
408 # add filter info |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
409 self._add_filters_to_header(common_header) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
410 # change the source information |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
411 common_header.add_meta('source', value='varscan.py') |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
412 # declare an INDEL flag for record INFO fields |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
413 self._add_indel_info_flag_to_header(common_header) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
414 # take the remaining metadata from the template header produced by |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
415 # VarScan |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
416 with pysam.VariantFile(varcall_template, 'r') as original_data: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
417 varscan_header = original_data.header |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
418 for sample in varscan_header.samples: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
419 common_header.samples.add(sample) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
420 common_header.merge(varscan_header) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
421 return common_header |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
422 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
423 def pileup_masker(self, mask): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
424 def apply_mask_on_pileup(piled_items): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
425 for item, status in zip(piled_items, mask): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
426 if status: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
427 yield item |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
428 return apply_mask_on_pileup |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
429 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
430 def get_allele_specific_pileup_column_stats( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
431 self, allele, pile_column, ref_fetch |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
432 ): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
433 # number of reads supporting the given allele on |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
434 # forward and reverse strand, and in total |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
435 var_reads_plus = var_reads_minus = 0 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
436 var_supp_read_mask = [] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
437 for base in pile_column.get_query_sequences(): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
438 if base == allele: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
439 # allele supporting read on + strand |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
440 var_reads_plus += 1 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
441 var_supp_read_mask.append(True) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
442 elif base.upper() == allele: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
443 # allele supporting read on - strand |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
444 var_reads_minus += 1 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
445 var_supp_read_mask.append(True) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
446 else: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
447 var_supp_read_mask.append(False) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
448 var_reads_total = var_reads_plus + var_reads_minus |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
449 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
450 if var_reads_total == 0: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
451 # No stats without reads! |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
452 return None |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
453 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
454 var_supp_only = self.pileup_masker(var_supp_read_mask) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
455 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
456 # average mapping quality of the reads supporting the |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
457 # given allele |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
458 avg_mapping_quality = sum( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
459 mq for mq in var_supp_only( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
460 pile_column.get_mapping_qualities() |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
461 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
462 ) / var_reads_total |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
463 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
464 # for the remaining stats we need access to complete |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
465 # read information |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
466 piled_reads = [ |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
467 p for p in var_supp_only(pile_column.pileups) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
468 ] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
469 assert len(piled_reads) == var_reads_total |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
470 sum_avg_base_qualities = 0 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
471 sum_dist_from_center = 0 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
472 sum_dist_from_3prime = 0 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
473 sum_clipped_length = 0 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
474 sum_unclipped_length = 0 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
475 sum_num_mismatches_as_fraction = 0 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
476 sum_mismatch_qualities = 0 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
477 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
478 for p in piled_reads: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
479 sum_avg_base_qualities += sum( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
480 p.alignment.query_qualities |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
481 ) / p.alignment.infer_query_length() |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
482 sum_clipped_length += p.alignment.query_alignment_length |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
483 unclipped_length = p.alignment.infer_read_length() |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
484 sum_unclipped_length += unclipped_length |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
485 read_center = p.alignment.query_alignment_length / 2 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
486 sum_dist_from_center += 1 - abs( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
487 p.query_position - read_center |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
488 ) / read_center |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
489 if p.alignment.is_reverse: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
490 sum_dist_from_3prime += p.query_position / unclipped_length |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
491 else: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
492 sum_dist_from_3prime += 1 - p.query_position / unclipped_length |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
493 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
494 sum_num_mismatches = 0 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
495 for qpos, rpos in p.alignment.get_aligned_pairs(): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
496 if qpos is not None and rpos is not None: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
497 if p.alignment.query_sequence[qpos] != ref_fetch( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
498 rpos, rpos + 1 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
499 ).upper(): # ref bases can be lowercase! |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
500 sum_num_mismatches += 1 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
501 sum_mismatch_qualities += p.alignment.query_qualities[ |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
502 qpos |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
503 ] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
504 sum_num_mismatches_as_fraction += ( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
505 sum_num_mismatches / p.alignment.query_alignment_length |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
506 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
507 avg_basequality = sum_avg_base_qualities / var_reads_total |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
508 avg_pos_as_fraction = sum_dist_from_center / var_reads_total |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
509 avg_num_mismatches_as_fraction = ( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
510 sum_num_mismatches_as_fraction / var_reads_total |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
511 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
512 avg_sum_mismatch_qualities = sum_mismatch_qualities / var_reads_total |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
513 avg_clipped_length = sum_clipped_length / var_reads_total |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
514 avg_distance_to_effective_3p_end = ( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
515 sum_dist_from_3prime / var_reads_total |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
516 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
517 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
518 return ( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
519 avg_mapping_quality, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
520 avg_basequality, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
521 var_reads_plus, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
522 var_reads_minus, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
523 avg_pos_as_fraction, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
524 avg_num_mismatches_as_fraction, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
525 avg_sum_mismatch_qualities, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
526 avg_clipped_length, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
527 avg_distance_to_effective_3p_end |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
528 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
529 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
530 def _postprocess_variant_records(self, invcf, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
531 min_var_count2, min_var_count2_lc, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
532 min_var_freq2, max_somatic_p, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
533 max_somatic_p_depth, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
534 min_ref_readpos, min_var_readpos, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
535 min_ref_dist3, min_var_dist3, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
536 min_ref_len, min_var_len, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
537 max_relative_len_diff, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
538 min_strandedness, min_strand_reads, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
539 min_ref_basequal, min_var_basequal, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
540 max_basequal_diff, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
541 min_ref_mapqual, min_var_mapqual, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
542 max_mapqual_diff, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
543 max_ref_mmqs, max_var_mmqs, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
544 min_mmqs_diff, max_mmqs_diff, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
545 **args): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
546 # set FILTER field according to Varscan criteria |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
547 # multiple FILTER entries must be separated by semicolons |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
548 # No filters applied should be indicated with MISSING |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
549 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
550 # since posterior filters are always applied to just one sample, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
551 # a better place to store the info is in the FT genotype field: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
552 # can be PASS, '.' to indicate that filters have not been applied, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
553 # or a semicolon-separated list of filters that failed |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
554 # unfortunately, gemini does not support this field |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
555 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
556 with ExitStack() as io_stack: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
557 normal_reads, tumor_reads = ( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
558 io_stack.enter_context( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
559 pysam.Samfile(fn, 'rb')) for fn in self.bam_input_files |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
560 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
561 refseq = io_stack.enter_context(pysam.FastaFile(self.ref_genome)) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
562 pileup_args = self._get_pysam_pileup_args() |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
563 for record in invcf: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
564 if any(len(allele) > 1 for allele in record.alleles): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
565 # skip indel postprocessing for the moment |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
566 yield record |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
567 continue |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
568 # get pileup for genomic region affected by this variant |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
569 if record.info['SS'] == '2': |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
570 # a somatic variant => generate pileup from tumor data |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
571 pile = tumor_reads.pileup( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
572 record.chrom, record.start, record.stop, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
573 **pileup_args |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
574 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
575 sample_of_interest = 'TUMOR' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
576 elif record.info['SS'] in ['1', '3']: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
577 # a germline or LOH variant => pileup from normal data |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
578 pile = normal_reads.pileup( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
579 record.chrom, record.start, record.stop, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
580 **pileup_args |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
581 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
582 sample_of_interest = 'NORMAL' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
583 else: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
584 # TO DO: figure out if there is anything interesting to do |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
585 # for SS status codes 0 (reference) and 5 (unknown) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
586 yield record |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
587 continue |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
588 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
589 # apply false-positive filtering a la varscan fpfilter |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
590 # find the variant site in the pileup columns |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
591 for pile_column in pile: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
592 if pile_column.reference_pos == record.start: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
593 break |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
594 # extract required information |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
595 # overall read depth at the site |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
596 read_depth = pile_column.get_num_aligned() |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
597 assert read_depth > 0 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
598 # no multiallelic sites in varscan |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
599 assert len(record.alleles) == 2 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
600 if record.samples[sample_of_interest]['RD'] > 0: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
601 ref_stats, alt_stats = [ |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
602 self.get_allele_specific_pileup_column_stats( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
603 allele, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
604 pile_column, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
605 partial( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
606 pysam.FastaFile.fetch, refseq, record.chrom |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
607 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
608 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
609 for allele in record.alleles |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
610 ] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
611 else: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
612 ref_stats = None |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
613 alt_stats = self.get_allele_specific_pileup_column_stats( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
614 record.alleles[1], |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
615 pile_column, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
616 partial(pysam.FastaFile.fetch, refseq, record.chrom) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
617 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
618 ref_count = 0 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
619 if ref_stats: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
620 ref_count = ref_stats[2] + ref_stats[3] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
621 if ref_stats[1] < min_ref_basequal: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
622 record.filter.add('RefBaseQual') |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
623 if ref_count >= 2: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
624 if ref_stats[0] < min_ref_mapqual: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
625 record.filter.add('RefMapQual') |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
626 if ref_stats[4] < min_ref_readpos: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
627 record.filter.add('RefReadPos') |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
628 # ref_stats[5] (avg_num_mismatches_as_fraction |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
629 # is not a filter criterion in VarScan fpfilter |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
630 if ref_stats[6] > max_ref_mmqs: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
631 record.filter.add('RefMMQS') |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
632 if ref_stats[7] < min_ref_len: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
633 # VarScan fpfilter does not apply this filter |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
634 # for indels, but there is no reason |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
635 # not to do it. |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
636 record.filter.add('RefAvgRL') |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
637 if ref_stats[8] < min_ref_dist3: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
638 record.filter.add('RefDist3') |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
639 if alt_stats: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
640 alt_count = alt_stats[2] + alt_stats[3] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
641 if ( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
642 alt_count < min_var_count2_lc |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
643 ) or ( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
644 read_depth >= max_somatic_p_depth and |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
645 alt_count < min_var_count2 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
646 ): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
647 record.filter.add('VarCount') |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
648 if alt_count / read_depth < min_var_freq2: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
649 record.filter.add('VarFreq') |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
650 if alt_stats[1] < min_var_basequal: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
651 record.filter.add('VarBaseQual') |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
652 if alt_count > min_strand_reads: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
653 if ( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
654 alt_stats[2] / alt_count < min_strandedness |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
655 ) or ( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
656 alt_stats[3] / alt_count < min_strandedness |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
657 ): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
658 record.filter.add('Strand') |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
659 if alt_stats[2] + alt_stats[3] >= 2: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
660 if alt_stats[0] < min_var_mapqual: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
661 record.filter.add('VarMapQual') |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
662 if alt_stats[4] < min_var_readpos: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
663 record.filter.add('VarReadPos') |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
664 # alt_stats[5] (avg_num_mismatches_as_fraction |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
665 # is not a filter criterion in VarScan fpfilter |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
666 if alt_stats[6] > max_var_mmqs: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
667 record.filter.add('VarMMQS') |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
668 if alt_stats[7] < min_var_len: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
669 # VarScan fpfilter does not apply this filter |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
670 # for indels, but there is no reason |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
671 # not to do it. |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
672 record.filter.add('VarAvgRL') |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
673 if alt_stats[8] < min_var_dist3: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
674 record.filter.add('VarDist3') |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
675 if ref_count >= 2 and alt_count >= 2: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
676 if (ref_stats[0] - alt_stats[0]) > max_mapqual_diff: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
677 record.filter.add('MapQualDiff') |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
678 if (ref_stats[1] - alt_stats[1]) > max_basequal_diff: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
679 record.filter.add('MaxBAQdiff') |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
680 mmqs_diff = alt_stats[6] - ref_stats[6] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
681 if mmqs_diff < min_mmqs_diff: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
682 record.filter.add('MinMMQSdiff') |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
683 if mmqs_diff > max_mmqs_diff: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
684 record.filter.add('MMQSdiff') |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
685 if ( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
686 1 - alt_stats[7] / ref_stats[7] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
687 ) > max_relative_len_diff: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
688 record.filter.add('ReadLenDiff') |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
689 else: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
690 # No variant-supporting reads for this record! |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
691 # This can happen in rare cases because of |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
692 # samtools mpileup issues, but indicates a |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
693 # rather unreliable variant call. |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
694 record.filter.add('VarCount') |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
695 record.filter.add('VarFreq') |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
696 yield record |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
697 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
698 def _indel_flagged_records(self, vcf): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
699 for record in vcf: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
700 record.info['INDEL'] = True |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
701 yield record |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
702 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
703 def _merge_generator(self, vcf1, vcf2): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
704 try: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
705 record1 = next(vcf1) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
706 except StopIteration: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
707 for record2 in vcf2: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
708 yield record2 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
709 return |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
710 try: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
711 record2 = next(vcf2) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
712 except StopIteration: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
713 yield record1 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
714 for record1 in vcf1: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
715 yield record1 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
716 return |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
717 while True: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
718 if (record1.start, record1.stop) < (record2.start, record2.stop): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
719 yield record1 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
720 try: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
721 record1 = next(vcf1) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
722 except StopIteration: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
723 yield record2 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
724 for record2 in vcf2: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
725 yield record2 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
726 return |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
727 else: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
728 yield record2 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
729 try: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
730 record2 = next(vcf2) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
731 except StopIteration: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
732 yield record1 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
733 for record1 in vcf1: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
734 yield record1 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
735 return |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
736 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
737 def merge_and_postprocess(self, snps_out, indels_out=None, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
738 no_filters=False, **filter_args): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
739 temporary_data = self.tmpfiles |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
740 self.tmpfiles = [] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
741 temporary_snp_files = [f + '.snp.vcf' for f in temporary_data] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
742 temporary_indel_files = [f + '.indel.vcf' for f in temporary_data] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
743 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
744 for f in temporary_data: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
745 try: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
746 os.remove(f) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
747 except Exception: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
748 pass |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
749 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
750 def noop_gen(data, **kwargs): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
751 for d in data: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
752 yield d |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
753 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
754 if no_filters: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
755 apply_filters = noop_gen |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
756 else: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
757 apply_filters = self._postprocess_variant_records |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
758 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
759 output_header = self._compile_common_header( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
760 temporary_snp_files[0], |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
761 no_filters |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
762 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
763 if indels_out is None: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
764 with open(snps_out, 'w') as o: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
765 o.write(str(output_header).format(**filter_args)) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
766 for snp_f, indel_f in zip( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
767 temporary_snp_files, temporary_indel_files |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
768 ): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
769 with pysam.VariantFile(snp_f, 'r') as snp_invcf: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
770 # fix the input header on the fly |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
771 # to avoid Warnings from htslib about missing contig |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
772 # info |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
773 self._add_ref_contigs_to_header(snp_invcf.header) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
774 self._add_filters_to_header(snp_invcf.header) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
775 self._add_indel_info_flag_to_header(snp_invcf.header) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
776 with pysam.VariantFile(indel_f, 'r') as indel_invcf: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
777 # fix the input header on the fly |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
778 # to avoid Warnings from htslib about missing |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
779 # contig info |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
780 self._add_ref_contigs_to_header(indel_invcf.header) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
781 self._add_filters_to_header(indel_invcf.header) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
782 self._add_indel_info_flag_to_header( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
783 indel_invcf.header |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
784 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
785 for record in apply_filters( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
786 self._merge_generator( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
787 snp_invcf, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
788 self._indel_flagged_records(indel_invcf) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
789 ), |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
790 **filter_args |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
791 ): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
792 o.write(str(record)) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
793 try: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
794 os.remove(snp_f) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
795 except Exception: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
796 pass |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
797 try: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
798 os.remove(indel_f) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
799 except Exception: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
800 pass |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
801 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
802 else: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
803 with open(snps_out, 'w') as o: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
804 o.write(str(output_header).format(**filter_args)) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
805 for f in temporary_snp_files: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
806 with pysam.VariantFile(f, 'r') as invcf: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
807 # fix the input header on the fly |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
808 # to avoid Warnings from htslib about missing |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
809 # contig info and errors because of undeclared |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
810 # filters |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
811 self._add_ref_contigs_to_header(invcf.header) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
812 self._add_filters_to_header(invcf.header) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
813 for record in apply_filters( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
814 invcf, **filter_args |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
815 ): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
816 o.write(str(record)) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
817 try: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
818 os.remove(f) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
819 except Exception: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
820 pass |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
821 with open(indels_out, 'w') as o: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
822 o.write(str(output_header)) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
823 for f in temporary_indel_files: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
824 with pysam.VariantFile(f, 'r') as invcf: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
825 # fix the input header on the fly |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
826 # to avoid Warnings from htslib about missing |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
827 # contig info and errors because of undeclared |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
828 # filters |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
829 self._add_ref_contigs_to_header(invcf.header) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
830 self._add_filters_to_header(invcf.header) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
831 self._add_indel_info_flag_to_header(invcf.header) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
832 for record in apply_filters( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
833 self._indel_flagged_records(invcf), **filter_args |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
834 ): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
835 o.write(str(record)) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
836 try: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
837 os.remove(f) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
838 except Exception: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
839 pass |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
840 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
841 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
842 def varscan_call(ref_genome, normal, tumor, output_path, **args): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
843 """Preparse arguments and orchestrate calling and postprocessing.""" |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
844 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
845 if args.pop('split_output'): |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
846 if '%T' in output_path: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
847 out = ( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
848 output_path.replace('%T', 'snp'), |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
849 output_path.replace('%T', 'indel') |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
850 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
851 else: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
852 out = ( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
853 output_path + '.snp', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
854 output_path + '.indel' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
855 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
856 else: |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
857 out = (output_path, None) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
858 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
859 instance_args = { |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
860 k: args.pop(k) for k in [ |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
861 'max_depth', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
862 'min_mapqual', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
863 'min_basequal', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
864 'threads', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
865 'verbose', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
866 'quiet' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
867 ] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
868 } |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
869 varscan_somatic_args = { |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
870 k: args.pop(k) for k in [ |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
871 'normal_purity', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
872 'tumor_purity', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
873 'min_coverage', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
874 'min_var_count', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
875 'min_var_freq', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
876 'min_hom_freq', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
877 'somatic_p_value', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
878 'p_value' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
879 ] |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
880 } |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
881 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
882 v = VarScanCaller(ref_genome, [normal, tumor], **instance_args) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
883 v.varcall_parallel(**varscan_somatic_args) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
884 v.merge_and_postprocess(*out, **args) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
885 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
886 |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
887 if __name__ == '__main__': |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
888 p = argparse.ArgumentParser() |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
889 p.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
890 'ref_genome', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
891 metavar='reference_genome', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
892 help='the reference genome (in fasta format)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
893 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
894 p.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
895 '--normal', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
896 metavar='BAM_file', required=True, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
897 help='the BAM input file of aligned reads from the normal sample' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
898 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
899 p.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
900 '--tumor', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
901 metavar='BAM_file', required=True, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
902 help='the BAM input file of aligned reads from the tumor sample' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
903 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
904 p.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
905 '-o', '--ofile', required=True, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
906 metavar='OFILE', dest='output_path', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
907 help='Name of the variant output file. With --split-output, the name ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
908 'may use the %%T replacement token or will be used as the ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
909 'basename for the two output files to be generated (see ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
910 '-s|--split-output below).' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
911 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
912 p.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
913 '-s', '--split-output', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
914 dest='split_output', action='store_true', default=False, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
915 help='indicate that separate output files for SNPs and indels ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
916 'should be generated (original VarScan behavior). If specified, ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
917 '%%T in the --ofile file name will be replaced with "snp" and ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
918 '"indel" to generate the names of the SNP and indel output ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
919 'files, respectively. If %%T is not found in the file name, it ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
920 'will get interpreted as a basename to which ".snp"/".indel" ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
921 'will be appended.' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
922 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
923 p.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
924 '-t', '--threads', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
925 type=int, default=1, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
926 help='level of parallelism' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
927 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
928 p.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
929 '-v', '--verbose', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
930 action='store_true', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
931 help='be verbose about progress' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
932 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
933 p.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
934 '-q', '--quiet', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
935 action='store_true', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
936 help='suppress output from wrapped tools' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
937 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
938 call_group = p.add_argument_group('Variant calling parameters') |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
939 call_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
940 '--normal-purity', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
941 dest='normal_purity', type=float, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
942 default=1.0, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
943 help='Estimated purity of the normal sample (default: 1.0)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
944 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
945 call_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
946 '--tumor-purity', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
947 dest='tumor_purity', type=float, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
948 default=1.0, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
949 help='Estimated purity of the tumor sample (default: 1.0)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
950 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
951 call_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
952 '--max-pileup-depth', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
953 dest='max_depth', type=int, default=8000, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
954 help='Maximum depth of generated pileups (samtools mpileup -d option; ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
955 'default: 8000)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
956 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
957 call_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
958 '--min-basequal', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
959 dest='min_basequal', type=int, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
960 default=13, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
961 help='Minimum base quality at the variant position to use a read ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
962 '(default: 13)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
963 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
964 call_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
965 '--min-mapqual', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
966 dest='min_mapqual', type=int, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
967 default=0, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
968 help='Minimum mapping quality required to use a read ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
969 '(default: 0)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
970 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
971 call_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
972 '--min-coverage', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
973 dest='min_coverage', type=int, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
974 default=8, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
975 help='Minimum site coverage required in the normal and in the tumor ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
976 'sample to call a variant (default: 8)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
977 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
978 call_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
979 '--min-var-count', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
980 dest='min_var_count', type=int, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
981 default=2, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
982 help='Minimum number of variant-supporting reads required to call a ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
983 'variant (default: 2)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
984 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
985 call_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
986 '--min-var-freq', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
987 dest='min_var_freq', type=float, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
988 default=0.1, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
989 help='Minimum variant allele frequency for calling (default: 0.1)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
990 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
991 call_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
992 '--min-hom-freq', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
993 dest='min_hom_freq', type=float, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
994 default=0.75, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
995 help='Minimum variant allele frequency for homozygous call ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
996 '(default: 0.75)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
997 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
998 call_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
999 '--p-value', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1000 dest='p_value', type=float, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1001 default=0.99, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1002 help='P-value threshold for heterozygous call (default: 0.99)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1003 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1004 call_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1005 '--somatic-p-value', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1006 dest='somatic_p_value', type=float, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1007 default=0.05, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1008 help='P-value threshold for somatic call (default: 0.05)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1009 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1010 filter_group = p.add_argument_group('Posterior variant filter parameters') |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1011 filter_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1012 '--no-filters', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1013 dest='no_filters', action='store_true', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1014 help='Disable all posterior variant filters. ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1015 'If specified, all following options will be ignored' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1016 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1017 filter_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1018 '--min-var-count2', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1019 dest='min_var_count2', type=int, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1020 default=4, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1021 help='Minimum number of variant-supporting reads (default: 4)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1022 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1023 filter_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1024 '--min-var-count2-lc', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1025 dest='min_var_count2_lc', type=int, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1026 default=2, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1027 help='Minimum number of variant-supporting reads when depth below ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1028 '--somatic-p-depth (default: 2)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1029 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1030 filter_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1031 '--min-var-freq2', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1032 dest='min_var_freq2', type=float, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1033 default=0.05, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1034 help='Minimum variant allele frequency (default: 0.05)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1035 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1036 filter_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1037 '--max-somatic-p', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1038 dest='max_somatic_p', type=float, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1039 default=0.05, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1040 help='Maximum somatic p-value (default: 0.05)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1041 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1042 filter_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1043 '--max-somatic-p-depth', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1044 dest='max_somatic_p_depth', type=int, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1045 default=10, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1046 help='Depth required to run --max-somatic-p filter (default: 10)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1047 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1048 filter_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1049 '--min-ref-readpos', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1050 dest='min_ref_readpos', type=float, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1051 default=0.1, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1052 help='Minimum average relative distance of site from the ends of ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1053 'ref-supporting reads (default: 0.1)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1054 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1055 filter_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1056 '--min-var-readpos', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1057 dest='min_var_readpos', type=float, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1058 default=0.1, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1059 help='Minimum average relative distance of site from the ends of ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1060 'variant-supporting reads (default: 0.1)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1061 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1062 filter_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1063 '--min-ref-dist3', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1064 dest='min_ref_dist3', type=float, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1065 default=0.1, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1066 help='Minimum average relative distance of site from the effective ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1067 '3\'end of ref-supporting reads (default: 0.1)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1068 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1069 filter_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1070 '--min-var-dist3', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1071 dest='min_var_dist3', type=float, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1072 default=0.1, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1073 help='Minimum average relative distance of site from the effective ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1074 '3\'end of variant-supporting reads (default: 0.1)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1075 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1076 filter_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1077 '--min-ref-len', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1078 dest='min_ref_len', type=int, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1079 default=90, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1080 help='Minimum average trimmed length of reads supporting the ref ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1081 'allele (default: 90)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1082 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1083 filter_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1084 '--min-var-len', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1085 dest='min_var_len', type=int, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1086 default=90, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1087 help='Minimum average trimmed length of reads supporting the variant ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1088 'allele (default: 90)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1089 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1090 filter_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1091 '--max-len-diff', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1092 dest='max_relative_len_diff', type=float, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1093 default=0.25, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1094 help='Maximum average relative read length difference (ref - var; ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1095 'default: 0.25)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1096 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1097 filter_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1098 '--min-strandedness', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1099 dest='min_strandedness', type=float, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1100 default=0.01, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1101 help='Minimum fraction of variant reads from each strand ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1102 '(default: 0.01)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1103 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1104 filter_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1105 '--min-strand-reads', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1106 dest='min_strand_reads', type=int, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1107 default=5, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1108 help='Minimum allele depth required to run --min-strandedness filter ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1109 '(default: 5)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1110 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1111 filter_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1112 '--min-ref-basequal', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1113 dest='min_ref_basequal', type=int, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1114 default=15, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1115 help='Minimum average base quality for the ref allele (default: 15)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1116 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1117 filter_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1118 '--min-var-basequal', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1119 dest='min_var_basequal', type=int, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1120 default=15, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1121 help='Minimum average base quality for the variant allele ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1122 '(default: 15)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1123 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1124 filter_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1125 '--max-basequal-diff', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1126 dest='max_basequal_diff', type=int, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1127 default=50, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1128 help='Maximum average base quality diff (ref - var; default: 50)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1129 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1130 filter_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1131 '--min-ref-mapqual', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1132 dest='min_ref_mapqual', type=int, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1133 default=15, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1134 help='Minimum average mapping quality of reads supporting the ref ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1135 'allele (default: 15)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1136 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1137 filter_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1138 '--min-var-mapqual', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1139 dest='min_var_mapqual', type=int, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1140 default=15, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1141 help='Minimum average mapping quality of reads supporting the variant ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1142 'allele (default: 15)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1143 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1144 filter_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1145 '--max-mapqual-diff', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1146 dest='max_mapqual_diff', type=int, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1147 default=50, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1148 help='Maximum average mapping quality difference (ref - var; ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1149 'default: 50)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1150 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1151 filter_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1152 '--max-ref-mmqs', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1153 dest='max_ref_mmqs', type=int, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1154 default=100, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1155 help='Maximum mismatch quality sum of reads supporting the ref ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1156 'allele (default: 100)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1157 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1158 filter_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1159 '--max-var-mmqs', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1160 dest='max_var_mmqs', type=int, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1161 default=100, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1162 help='Maximum mismatch quality sum of reads supporting the variant ' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1163 'allele (default: 100)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1164 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1165 filter_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1166 '--min-mmqs-diff', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1167 dest='min_mmqs_diff', type=int, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1168 default=0, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1169 help='Minimum mismatch quality sum difference (var - ref; default: 0)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1170 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1171 filter_group.add_argument( |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1172 '--max-mmqs-diff', |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1173 dest='max_mmqs_diff', type=int, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1174 default=50, |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1175 help='Maximum mismatch quality sum difference (var - ref; default: 50)' |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1176 ) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1177 args = vars(p.parse_args()) |
d062703d6f13
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1178 varscan_call(**args) |