Mercurial > repos > iuc > varscan_somatic
annotate varscan.py @ 8:b79bb8b09822 draft
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
author | iuc |
---|---|
date | Thu, 28 Mar 2019 18:19:00 -0400 |
parents | 2657ab48e16a |
children | 4e97191a1ff7 |
rev | line source |
---|---|
2
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1 #!/usr/bin/env python3 |
2fe9ebb98aad
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 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
3 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
4 import argparse |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
5 import io |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
6 import os |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
7 import subprocess |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
8 import sys |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
9 import tempfile |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
10 import time |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
11 from contextlib import ExitStack |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
12 from functools import partial |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
13 from threading import Thread |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
14 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
15 import pysam |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
16 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
17 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
18 class VariantCallingError (RuntimeError): |
2fe9ebb98aad
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.""" |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
20 |
2fe9ebb98aad
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=''): |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
22 self.message = message |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
23 self.call = call.strip() |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
24 self.error = error.strip() |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
25 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
26 def __str__(self): |
2fe9ebb98aad
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: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
28 return '' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
29 if self.error: |
2fe9ebb98aad
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( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
31 self.call, self.error |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
32 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
33 else: |
2fe9ebb98aad
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' |
2fe9ebb98aad
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( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
36 self.call |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
37 ) |
2fe9ebb98aad
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 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
39 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
40 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
41 class VarScanCaller (object): |
2fe9ebb98aad
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, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
43 max_depth=None, |
2fe9ebb98aad
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, |
2fe9ebb98aad
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 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
46 ): |
2fe9ebb98aad
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 |
2fe9ebb98aad
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 |
2fe9ebb98aad
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 |
2fe9ebb98aad
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 |
2fe9ebb98aad
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 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
52 self.threads = threads |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
53 self.verbose = verbose |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
54 self.quiet = quiet |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
55 |
2fe9ebb98aad
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: |
2fe9ebb98aad
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 |
2fe9ebb98aad
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 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
59 |
2fe9ebb98aad
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'] |
2fe9ebb98aad
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'] |
2fe9ebb98aad
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 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
63 self.TemporaryContigVCF = partial( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
64 tempfile.NamedTemporaryFile, |
2fe9ebb98aad
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() |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
66 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
67 self.tmpfiles = [] |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
68 |
2fe9ebb98aad
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): |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
70 param_dict = {} |
2fe9ebb98aad
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: |
2fe9ebb98aad
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 |
2fe9ebb98aad
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: |
2fe9ebb98aad
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 |
2fe9ebb98aad
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: |
2fe9ebb98aad
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 |
2fe9ebb98aad
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 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
78 param_dict['stepper'] = 'samtools' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
79 return param_dict |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
80 |
2fe9ebb98aad
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, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
82 min_coverage=None, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
83 min_var_count=None, |
2fe9ebb98aad
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, |
2fe9ebb98aad
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, |
2fe9ebb98aad
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 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
87 ): |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
88 if not threads: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
89 threads = self.threads |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
90 if verbose is None: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
91 verbose = self.verbose |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
92 if quiet is None: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
93 quiet = self.quiet |
2fe9ebb98aad
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 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
95 varcall_engine_option_mapping = [ |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
96 ('--normal-purity', normal_purity), |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
97 ('--tumor-purity', tumor_purity), |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
98 ('--min-coverage', min_coverage), |
2fe9ebb98aad
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), |
2fe9ebb98aad
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), |
2fe9ebb98aad
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), |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
102 ('--p-value', p_value), |
2fe9ebb98aad
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), |
2fe9ebb98aad
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) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
105 ] |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
106 varcall_engine_options = [] |
2fe9ebb98aad
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: |
2fe9ebb98aad
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: |
2fe9ebb98aad
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)] |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
110 pileup_engine_options = ['-B'] |
2fe9ebb98aad
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: |
2fe9ebb98aad
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)] |
2fe9ebb98aad
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: |
2fe9ebb98aad
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)] |
2fe9ebb98aad
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: |
2fe9ebb98aad
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)] |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
117 |
2fe9ebb98aad
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 |
2fe9ebb98aad
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 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
120 # that tuple. |
2fe9ebb98aad
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 |
2fe9ebb98aad
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 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
123 calls = [( |
2fe9ebb98aad
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 + [ |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
125 '-r', contig + ':', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
126 '-f', self.ref_genome |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
127 ] + self.bam_input_files, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
128 self.varcall_engine + [ |
2fe9ebb98aad
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' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
130 ] + varcall_engine_options, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
131 contig |
2fe9ebb98aad
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]] |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
133 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
134 if verbose: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
135 print('Starting variant calling ..') |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
136 |
2fe9ebb98aad
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 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
138 subprocesses = [] |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
139 error_table = {} |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
140 tmp_io_started = [] |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
141 tmp_io_finished = [] |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
142 self.tmpfiles = [] |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
143 |
2fe9ebb98aad
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): |
2fe9ebb98aad
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''): |
2fe9ebb98aad
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 |
2fe9ebb98aad
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 |
2fe9ebb98aad
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. |
2fe9ebb98aad
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. |
2fe9ebb98aad
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, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
151 'backslashreplace')) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
152 out.close() |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
153 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
154 try: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
155 while subprocesses or calls: |
2fe9ebb98aad
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: |
2fe9ebb98aad
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 |
2fe9ebb98aad
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 |
2fe9ebb98aad
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. |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
160 |
2fe9ebb98aad
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 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
162 call = calls.pop() |
2fe9ebb98aad
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 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
164 # to work on |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
165 contig = call[2] |
2fe9ebb98aad
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 |
2fe9ebb98aad
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 |
2fe9ebb98aad
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 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
169 # will be redirected. |
2fe9ebb98aad
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 |
2fe9ebb98aad
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 |
2fe9ebb98aad
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. |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
173 call_out = self.TemporaryContigVCF( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
174 prefix=''.join( |
2fe9ebb98aad
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 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
176 ) + '_', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
177 ) |
2fe9ebb98aad
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 |
2fe9ebb98aad
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 |
2fe9ebb98aad
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) |
2fe9ebb98aad
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: |
2fe9ebb98aad
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 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
183 stdout_p2 = call_out |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
184 stderr_p2 = subprocess.PIPE |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
185 else: |
2fe9ebb98aad
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 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
187 stdout_p2 = subprocess.PIPE |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
188 stderr_p2 = subprocess.STDOUT |
2fe9ebb98aad
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 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
190 call_out.close() |
2fe9ebb98aad
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 |
2fe9ebb98aad
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 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
193 # strings |
2fe9ebb98aad
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])) |
2fe9ebb98aad
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()] |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
196 # start the subprocesses |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
197 p1 = subprocess.Popen( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
198 call[0], |
2fe9ebb98aad
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 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
200 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
201 p2 = subprocess.Popen( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
202 call[1], |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
203 stdin=p1.stdout, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
204 stdout=stdout_p2, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
205 stderr=stderr_p2 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
206 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
207 # subprocess bookkeeping |
2fe9ebb98aad
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)) |
2fe9ebb98aad
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 |
2fe9ebb98aad
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 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
211 p1.stdout.close() |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
212 t1 = Thread( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
213 target=enqueue_stderr_output, |
2fe9ebb98aad
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]) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
215 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
216 t2 = Thread( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
217 target=enqueue_stderr_output, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
218 args=( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
219 p2.stderr |
2fe9ebb98aad
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 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
221 p2.stdout, |
2fe9ebb98aad
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] |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
223 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
224 ) |
2fe9ebb98aad
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 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
226 t1.start() |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
227 t2.start() |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
228 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
229 if verbose: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
230 print( |
2fe9ebb98aad
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}' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
232 .format(call[2]) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
233 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
234 |
2fe9ebb98aad
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 |
2fe9ebb98aad
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: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
237 p1_stat = p1.poll() |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
238 p2_stat = p2.poll() |
2fe9ebb98aad
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: |
2fe9ebb98aad
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! |
2fe9ebb98aad
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 |
2fe9ebb98aad
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: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
243 print() |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
244 print( |
2fe9ebb98aad
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(), |
2fe9ebb98aad
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(), |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
247 file=sys.stderr |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
248 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
249 raise VariantCallingError( |
2fe9ebb98aad
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.' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
251 .format(contig), |
2fe9ebb98aad
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]) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
253 ) |
2fe9ebb98aad
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: |
2fe9ebb98aad
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 |
2fe9ebb98aad
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 |
2fe9ebb98aad
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 |
2fe9ebb98aad
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( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
259 ).splitlines()[-4:] |
2fe9ebb98aad
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( |
2fe9ebb98aad
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') |
2fe9ebb98aad
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 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
263 ): |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
264 break |
2fe9ebb98aad
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 |
2fe9ebb98aad
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 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
267 # get, stop it. |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
268 p2.terminate() |
2fe9ebb98aad
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)) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
270 ofo.close() |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
271 break |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
272 if p2_stat == 0: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
273 # Things went fine. |
2fe9ebb98aad
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 |
2fe9ebb98aad
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 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
276 # they finished) |
2fe9ebb98aad
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) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
278 if verbose: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
279 print() |
2fe9ebb98aad
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)) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
281 if not quiet: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
282 print() |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
283 print( |
2fe9ebb98aad
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/' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
285 'bcftools:'.upper(), |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
286 file=sys.stderr |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
287 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
288 print( |
2fe9ebb98aad
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(), |
2fe9ebb98aad
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(), |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
291 file=sys.stderr |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
292 ) |
2fe9ebb98aad
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 |
2fe9ebb98aad
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 |
2fe9ebb98aad
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. |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
296 del error_table[call] |
2fe9ebb98aad
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)) |
2fe9ebb98aad
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 |
2fe9ebb98aad
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 |
2fe9ebb98aad
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. |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
301 ofo.close() |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
302 break |
2fe9ebb98aad
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 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
304 time.sleep(2) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
305 finally: |
2fe9ebb98aad
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: |
2fe9ebb98aad
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 |
2fe9ebb98aad
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): |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
309 try: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
310 proc.terminate() |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
311 except Exception: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
312 pass |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
313 # close currently open files |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
314 ofo.close() |
2fe9ebb98aad
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 |
2fe9ebb98aad
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 |
2fe9ebb98aad
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] |
2fe9ebb98aad
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 |
2fe9ebb98aad
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. |
2fe9ebb98aad
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, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
321 # but simply rewrite everything. |
2fe9ebb98aad
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: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
323 print() |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
324 print( |
2fe9ebb98aad
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(), |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
326 file=sys.stderr |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
327 ) |
2fe9ebb98aad
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(): |
2fe9ebb98aad
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) |
2fe9ebb98aad
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) |
2fe9ebb98aad
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) |
2fe9ebb98aad
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) |
2fe9ebb98aad
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) |
2fe9ebb98aad
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) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
335 |
2fe9ebb98aad
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): |
2fe9ebb98aad
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): |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
338 header.add_meta( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
339 'contig', |
2fe9ebb98aad
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)] |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
341 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
342 |
2fe9ebb98aad
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): |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
344 varscan_fpfilters = { |
2fe9ebb98aad
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', |
2fe9ebb98aad
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}', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
347 'VarAvgRL': |
2fe9ebb98aad
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 < ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
349 '{min_var_len}', |
2fe9ebb98aad
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}', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
351 'VarDist3': |
2fe9ebb98aad
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}', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
353 'VarMMQS': |
2fe9ebb98aad
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 > ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
355 '{max_var_mmqs}', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
356 'VarMapQual': |
2fe9ebb98aad
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}', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
358 'VarBaseQual': |
2fe9ebb98aad
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}', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
360 'Strand': |
2fe9ebb98aad
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}', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
362 'RefAvgRL': |
2fe9ebb98aad
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 < ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
364 '{min_ref_len}', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
365 'RefReadPos': |
2fe9ebb98aad
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}', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
367 'RefDist3': |
2fe9ebb98aad
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}', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
369 'RefMapQual': |
2fe9ebb98aad
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 < ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
371 '{min_ref_mapqual}', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
372 'RefBaseQual': |
2fe9ebb98aad
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 < ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
374 '{min_ref_basequal}', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
375 'RefMMQS': |
2fe9ebb98aad
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 > ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
377 '{max_ref_mmqs}', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
378 'MMQSdiff': |
2fe9ebb98aad
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) > ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
380 '{max_mmqs_diff}', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
381 'MinMMQSdiff': |
2fe9ebb98aad
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) < ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
383 '{max_mmqs_diff}', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
384 'MapQualDiff': |
2fe9ebb98aad
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}', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
386 'MaxBAQdiff': |
2fe9ebb98aad
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) > ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
388 '{max_basequal_diff}', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
389 'ReadLenDiff': |
2fe9ebb98aad
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) > ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
391 '{max_relative_len_diff}', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
392 } |
2fe9ebb98aad
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(): |
2fe9ebb98aad
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) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
395 |
2fe9ebb98aad
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): |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
397 header.info.add( |
2fe9ebb98aad
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' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
399 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
400 |
6
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
401 def _standardize_format_fields(self, header): |
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
402 """Add standard FORMAT key declarations to a VCF header.""" |
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
403 |
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
404 format_field_specs = [ |
8
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
405 # pysam will not add quotes around single-word descriptions, |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
406 # which is a violation of the VCF specification. |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
407 # To work around this we are using two words as the |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
408 # GT format description (instead of the commonly used "Genotype"). |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
409 # This could be changed once pysam learns to quote correctly. |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
410 ('GT', '1', 'String', 'Genotype code'), |
6
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
411 ('GQ', '1', 'Integer', 'Genotype quality'), |
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
412 ('DP', '1', 'Integer', 'Read depth'), |
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
413 ('AD', 'R', 'Integer', 'Read depth for each allele'), |
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
414 ('ADF', 'R', 'Integer', |
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
415 'Read depth for each allele on the forward strand'), |
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
416 ('ADR', 'R', 'Integer', |
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
417 'Read depth for each allele on the reverse strand') |
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
418 ] |
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
419 # Existing FORMAT declarations cannot be overwritten. |
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
420 # The only viable strategy is to mark them as removed, |
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
421 # then merge the header with another one containing the |
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
422 # correct declarations. This is what is implemented below. |
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
423 temp_header = pysam.VariantHeader() |
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
424 for spec in format_field_specs: |
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
425 temp_header.formats.add(*spec) |
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
426 if spec[0] in header.formats: |
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
427 header.formats.remove_header(spec[0]) |
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
428 header.merge(temp_header) |
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
429 |
2
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
430 def _compile_common_header(self, varcall_template, no_filters=False): |
8
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
431 # read the header produced by VarScan for use as a template |
2
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
432 with pysam.VariantFile(varcall_template, 'r') as original_data: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
433 varscan_header = original_data.header |
7
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
434 # don't propagate non-standard and redundant FORMAT keys written |
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
435 # by VarScan |
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
436 varscan_header.formats.remove_header('AD') |
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
437 varscan_header.formats.remove_header('FREQ') |
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
438 varscan_header.formats.remove_header('RD') |
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
439 varscan_header.formats.remove_header('DP4') |
8
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
440 # build a new header containing information not written by VarScan |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
441 common_header = pysam.VariantHeader() |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
442 # copy over sample info from the VarScan template |
2
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
443 for sample in varscan_header.samples: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
444 common_header.samples.add(sample) |
8
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
445 # add reference information |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
446 common_header.add_meta('reference', value=self.ref_genome) |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
447 # change the source information |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
448 common_header.add_meta('source', value='varscan.py') |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
449 # add contig information |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
450 self._add_ref_contigs_to_header(common_header) |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
451 # declare an INDEL flag for record INFO fields |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
452 self._add_indel_info_flag_to_header(common_header) |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
453 # merge in remaining information from the VarScan template |
2
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
454 common_header.merge(varscan_header) |
8
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
455 # add additional FILTER declarations |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
456 if not no_filters: |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
457 # add filter info |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
458 self._add_filters_to_header(common_header) |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
459 # generate standard FORMAT field declarations |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
460 # including a correct AD declaration to prevent VarScan's |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
461 # non-standard one from getting propagated |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
462 self._standardize_format_fields(common_header) |
2
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
463 return common_header |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
464 |
7
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
465 def _fix_record_gt_fields(self, record): |
6
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
466 """Migrate non-standard genotype fields to standard ones.""" |
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
467 |
7
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
468 # The key issue to consider here is that we need to modify |
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
469 # genotype field values on a per-sample basis, but htslib |
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
470 # reserves memory for the values of all samples upon the first |
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
471 # modification of the field in the variant record. |
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
472 # => We need to calculate all values first, then fill each |
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
473 # genotype field starting with the sample with the largest value. |
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
474 new_gt_fields = {'AD': [], 'ADF': [], 'ADR': []} |
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
475 # store the current genotype field contents for each sample |
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
476 per_sample_gts = record.samples.values() |
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
477 # calculate and store the new genotype field values |
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
478 for gt_field in per_sample_gts: |
6
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
479 # generate a standard AD field by combining VarScan's |
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
480 # RD and non-standard AD fields |
7
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
481 new_gt_fields['AD'].append((gt_field['RD'], gt_field['AD'][0])) |
6
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
482 # split VarScan's DP4 field into the standard fields |
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
483 # ADF and ADR |
7
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
484 new_gt_fields['ADF'].append( |
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
485 (int(gt_field['DP4'][0]), int(gt_field['DP4'][2])) |
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
486 ) |
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
487 new_gt_fields['ADR'].append( |
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
488 (int(gt_field['DP4'][1]), int(gt_field['DP4'][3])) |
6
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
489 ) |
7
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
490 # Modify the record's genotype fields. |
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
491 # For each field, modify the sample containing the largest |
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
492 # value for the field first. |
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
493 # Without this precaution we could trigger: |
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
494 # "bcf_update_format: Assertion `!fmt->p_free' failed." |
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
495 # in vcf.c of htslib resulting in a core dump. |
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
496 for field in sorted(new_gt_fields): |
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
497 for new_field, sample_fields in sorted( |
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
498 zip(new_gt_fields[field], per_sample_gts), |
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
499 key=lambda x: max(x[0]), |
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
500 reverse=True |
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
501 ): |
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
502 sample_fields[field] = new_field |
6
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
503 # remove redundant fields |
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
504 # FREQ is easy to calculate from AD |
7
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
505 del record.format['FREQ'] |
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
506 del record.format['RD'] |
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
507 del record.format['DP4'] |
6
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
508 |
2
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
509 def get_allele_specific_pileup_column_stats( |
8
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
510 self, allele, pile_column, ref_fetch, use_md=True |
2
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
511 ): |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
512 var_reads_plus = var_reads_minus = 0 |
8
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
513 sum_mapping_qualities = 0 |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
514 sum_base_qualities = 0 |
2
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
515 sum_dist_from_center = 0 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
516 sum_dist_from_3prime = 0 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
517 sum_clipped_length = 0 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
518 sum_unclipped_length = 0 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
519 sum_num_mismatches_as_fraction = 0 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
520 sum_mismatch_qualities = 0 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
521 |
8
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
522 for p in pile_column.pileups: |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
523 # skip reads that don't support the allele we're looking for |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
524 if p.query_position is None: |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
525 continue |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
526 if p.alignment.query_sequence[p.query_position] != allele: |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
527 continue |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
528 |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
529 if p.alignment.is_reverse: |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
530 var_reads_minus += 1 |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
531 else: |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
532 var_reads_plus += 1 |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
533 sum_mapping_qualities += p.alignment.mapping_quality |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
534 sum_base_qualities += p.alignment.query_qualities[p.query_position] |
2
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
535 sum_clipped_length += p.alignment.query_alignment_length |
8
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
536 unclipped_length = p.alignment.query_length |
2
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
537 sum_unclipped_length += unclipped_length |
8
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
538 # The following calculations are all in 1-based coordinates |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
539 # with respect to the physical 5'-end of the read sequence. |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
540 if p.alignment.is_reverse: |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
541 read_base_pos = unclipped_length - p.query_position |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
542 read_first_aln_pos = ( |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
543 unclipped_length - p.alignment.query_alignment_end + 1 |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
544 ) |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
545 read_last_aln_pos = ( |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
546 unclipped_length - p.alignment.query_alignment_start |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
547 ) |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
548 else: |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
549 read_base_pos = p.query_position + 1 |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
550 read_first_aln_pos = p.alignment.query_alignment_start + 1 |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
551 read_last_aln_pos = p.alignment.query_alignment_end |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
552 # Note: the original bam-readcount algorithm uses the less accurate |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
553 # p.alignment.query_alignment_length / 2 as the read center |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
554 read_center = (read_first_aln_pos + read_last_aln_pos) / 2 |
2
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
555 sum_dist_from_center += 1 - abs( |
8
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
556 read_base_pos - read_center |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
557 ) / (read_center - 1) |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
558 # Note: the original bam-readcount algorithm uses a more |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
559 # complicated definition of the 3'-end of a read sequence, which |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
560 # clips off runs of bases with a quality scores of exactly 2. |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
561 sum_dist_from_3prime += ( |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
562 read_last_aln_pos - read_base_pos |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
563 ) / (unclipped_length - 1) |
2
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
564 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
565 sum_num_mismatches = 0 |
8
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
566 if use_md: |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
567 try: |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
568 # see if the read has an MD tag, in which case pysam can |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
569 # calculate the reference sequence for us |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
570 aligned_pairs = p.alignment.get_aligned_pairs( |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
571 matches_only=True, with_seq=True |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
572 ) |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
573 except ValueError: |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
574 use_md = False |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
575 if use_md: |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
576 # The ref sequence got calculated from alignment and MD tag. |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
577 for qpos, rpos, ref_base in aligned_pairs: |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
578 # pysam uses lowercase ref bases to indicate mismatches |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
579 if ( |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
580 ref_base == 'a' or ref_base == 't' or |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
581 ref_base == 'g' or ref_base == 'c' |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
582 ): |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
583 sum_num_mismatches += 1 |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
584 sum_mismatch_qualities += p.alignment.query_qualities[ |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
585 qpos |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
586 ] |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
587 else: |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
588 # We need to obtain the aligned portion of the reference |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
589 # sequence. |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
590 aligned_pairs = p.alignment.get_aligned_pairs( |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
591 matches_only=True |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
592 ) |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
593 # note that ref bases can be lowercase |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
594 ref_seq = ref_fetch( |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
595 aligned_pairs[0][1], aligned_pairs[-1][1] + 1 |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
596 ).upper() |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
597 ref_offset = aligned_pairs[0][1] |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
598 |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
599 for qpos, rpos in p.alignment.get_aligned_pairs( |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
600 matches_only=True |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
601 ): |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
602 # see if we have a mismatch to the reference at this |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
603 # position, but note that |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
604 # - the query base may be lowercase (SAM/BAM spec) |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
605 # - an '=', if present in the query seq, indicates a match |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
606 # to the reference (SAM/BAM spec) |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
607 # - there cannot be a mismatch with an N in the reference |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
608 ref_base = ref_seq[rpos - ref_offset] |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
609 read_base = p.alignment.query_sequence[qpos].upper() |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
610 if ( |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
611 read_base != '=' and ref_base != 'N' |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
612 ) and ( |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
613 ref_base != read_base |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
614 ): |
2
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
615 sum_num_mismatches += 1 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
616 sum_mismatch_qualities += p.alignment.query_qualities[ |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
617 qpos |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
618 ] |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
619 sum_num_mismatches_as_fraction += ( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
620 sum_num_mismatches / p.alignment.query_alignment_length |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
621 ) |
8
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
622 |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
623 var_reads_total = var_reads_plus + var_reads_minus |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
624 if var_reads_total == 0: |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
625 # No stats without reads! |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
626 return None |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
627 avg_mapping_quality = sum_mapping_qualities / var_reads_total |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
628 avg_basequality = sum_base_qualities / var_reads_total |
2
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
629 avg_pos_as_fraction = sum_dist_from_center / var_reads_total |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
630 avg_num_mismatches_as_fraction = ( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
631 sum_num_mismatches_as_fraction / var_reads_total |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
632 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
633 avg_sum_mismatch_qualities = sum_mismatch_qualities / var_reads_total |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
634 avg_clipped_length = sum_clipped_length / var_reads_total |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
635 avg_distance_to_effective_3p_end = ( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
636 sum_dist_from_3prime / var_reads_total |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
637 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
638 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
639 return ( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
640 avg_mapping_quality, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
641 avg_basequality, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
642 var_reads_plus, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
643 var_reads_minus, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
644 avg_pos_as_fraction, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
645 avg_num_mismatches_as_fraction, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
646 avg_sum_mismatch_qualities, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
647 avg_clipped_length, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
648 avg_distance_to_effective_3p_end |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
649 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
650 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
651 def _postprocess_variant_records(self, invcf, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
652 min_var_count2, min_var_count2_lc, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
653 min_var_freq2, max_somatic_p, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
654 max_somatic_p_depth, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
655 min_ref_readpos, min_var_readpos, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
656 min_ref_dist3, min_var_dist3, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
657 min_ref_len, min_var_len, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
658 max_relative_len_diff, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
659 min_strandedness, min_strand_reads, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
660 min_ref_basequal, min_var_basequal, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
661 max_basequal_diff, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
662 min_ref_mapqual, min_var_mapqual, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
663 max_mapqual_diff, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
664 max_ref_mmqs, max_var_mmqs, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
665 min_mmqs_diff, max_mmqs_diff, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
666 **args): |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
667 # set FILTER field according to Varscan criteria |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
668 # multiple FILTER entries must be separated by semicolons |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
669 # No filters applied should be indicated with MISSING |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
670 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
671 # since posterior filters are always applied to just one sample, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
672 # a better place to store the info is in the FT genotype field: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
673 # can be PASS, '.' to indicate that filters have not been applied, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
674 # or a semicolon-separated list of filters that failed |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
675 # unfortunately, gemini does not support this field |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
676 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
677 with ExitStack() as io_stack: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
678 normal_reads, tumor_reads = ( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
679 io_stack.enter_context( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
680 pysam.Samfile(fn, 'rb')) for fn in self.bam_input_files |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
681 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
682 refseq = io_stack.enter_context(pysam.FastaFile(self.ref_genome)) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
683 pileup_args = self._get_pysam_pileup_args() |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
684 for record in invcf: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
685 if any(len(allele) > 1 for allele in record.alleles): |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
686 # skip indel postprocessing for the moment |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
687 yield record |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
688 continue |
8
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
689 if record.alleles[0] == 'N': |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
690 # It makes no sense to call SNPs against an unknown |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
691 # reference base |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
692 continue |
2
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
693 # get pileup for genomic region affected by this variant |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
694 if record.info['SS'] == '2': |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
695 # a somatic variant => generate pileup from tumor data |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
696 pile = tumor_reads.pileup( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
697 record.chrom, record.start, record.stop, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
698 **pileup_args |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
699 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
700 sample_of_interest = 'TUMOR' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
701 elif record.info['SS'] in ['1', '3']: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
702 # a germline or LOH variant => pileup from normal data |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
703 pile = normal_reads.pileup( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
704 record.chrom, record.start, record.stop, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
705 **pileup_args |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
706 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
707 sample_of_interest = 'NORMAL' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
708 else: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
709 # TO DO: figure out if there is anything interesting to do |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
710 # for SS status codes 0 (reference) and 5 (unknown) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
711 yield record |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
712 continue |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
713 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
714 # apply false-positive filtering a la varscan fpfilter |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
715 # find the variant site in the pileup columns |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
716 for pile_column in pile: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
717 if pile_column.reference_pos == record.start: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
718 break |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
719 # extract required information |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
720 # overall read depth at the site |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
721 read_depth = pile_column.get_num_aligned() |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
722 assert read_depth > 0 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
723 # no multiallelic sites in varscan |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
724 assert len(record.alleles) == 2 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
725 if record.samples[sample_of_interest]['RD'] > 0: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
726 ref_stats, alt_stats = [ |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
727 self.get_allele_specific_pileup_column_stats( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
728 allele, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
729 pile_column, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
730 partial( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
731 pysam.FastaFile.fetch, refseq, record.chrom |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
732 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
733 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
734 for allele in record.alleles |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
735 ] |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
736 else: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
737 ref_stats = None |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
738 alt_stats = self.get_allele_specific_pileup_column_stats( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
739 record.alleles[1], |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
740 pile_column, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
741 partial(pysam.FastaFile.fetch, refseq, record.chrom) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
742 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
743 ref_count = 0 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
744 if ref_stats: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
745 ref_count = ref_stats[2] + ref_stats[3] |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
746 if ref_stats[1] < min_ref_basequal: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
747 record.filter.add('RefBaseQual') |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
748 if ref_count >= 2: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
749 if ref_stats[0] < min_ref_mapqual: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
750 record.filter.add('RefMapQual') |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
751 if ref_stats[4] < min_ref_readpos: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
752 record.filter.add('RefReadPos') |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
753 # ref_stats[5] (avg_num_mismatches_as_fraction |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
754 # is not a filter criterion in VarScan fpfilter |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
755 if ref_stats[6] > max_ref_mmqs: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
756 record.filter.add('RefMMQS') |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
757 if ref_stats[7] < min_ref_len: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
758 # VarScan fpfilter does not apply this filter |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
759 # for indels, but there is no reason |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
760 # not to do it. |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
761 record.filter.add('RefAvgRL') |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
762 if ref_stats[8] < min_ref_dist3: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
763 record.filter.add('RefDist3') |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
764 if alt_stats: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
765 alt_count = alt_stats[2] + alt_stats[3] |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
766 if ( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
767 alt_count < min_var_count2_lc |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
768 ) or ( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
769 read_depth >= max_somatic_p_depth and |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
770 alt_count < min_var_count2 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
771 ): |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
772 record.filter.add('VarCount') |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
773 if alt_count / read_depth < min_var_freq2: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
774 record.filter.add('VarFreq') |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
775 if alt_stats[1] < min_var_basequal: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
776 record.filter.add('VarBaseQual') |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
777 if alt_count > min_strand_reads: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
778 if ( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
779 alt_stats[2] / alt_count < min_strandedness |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
780 ) or ( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
781 alt_stats[3] / alt_count < min_strandedness |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
782 ): |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
783 record.filter.add('Strand') |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
784 if alt_stats[2] + alt_stats[3] >= 2: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
785 if alt_stats[0] < min_var_mapqual: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
786 record.filter.add('VarMapQual') |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
787 if alt_stats[4] < min_var_readpos: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
788 record.filter.add('VarReadPos') |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
789 # alt_stats[5] (avg_num_mismatches_as_fraction |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
790 # is not a filter criterion in VarScan fpfilter |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
791 if alt_stats[6] > max_var_mmqs: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
792 record.filter.add('VarMMQS') |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
793 if alt_stats[7] < min_var_len: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
794 # VarScan fpfilter does not apply this filter |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
795 # for indels, but there is no reason |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
796 # not to do it. |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
797 record.filter.add('VarAvgRL') |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
798 if alt_stats[8] < min_var_dist3: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
799 record.filter.add('VarDist3') |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
800 if ref_count >= 2 and alt_count >= 2: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
801 if (ref_stats[0] - alt_stats[0]) > max_mapqual_diff: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
802 record.filter.add('MapQualDiff') |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
803 if (ref_stats[1] - alt_stats[1]) > max_basequal_diff: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
804 record.filter.add('MaxBAQdiff') |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
805 mmqs_diff = alt_stats[6] - ref_stats[6] |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
806 if mmqs_diff < min_mmqs_diff: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
807 record.filter.add('MinMMQSdiff') |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
808 if mmqs_diff > max_mmqs_diff: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
809 record.filter.add('MMQSdiff') |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
810 if ( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
811 1 - alt_stats[7] / ref_stats[7] |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
812 ) > max_relative_len_diff: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
813 record.filter.add('ReadLenDiff') |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
814 else: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
815 # No variant-supporting reads for this record! |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
816 # This can happen in rare cases because of |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
817 # samtools mpileup issues, but indicates a |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
818 # rather unreliable variant call. |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
819 record.filter.add('VarCount') |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
820 record.filter.add('VarFreq') |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
821 yield record |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
822 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
823 def _indel_flagged_records(self, vcf): |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
824 for record in vcf: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
825 record.info['INDEL'] = True |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
826 yield record |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
827 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
828 def _merge_generator(self, vcf1, vcf2): |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
829 try: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
830 record1 = next(vcf1) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
831 except StopIteration: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
832 for record2 in vcf2: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
833 yield record2 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
834 return |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
835 try: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
836 record2 = next(vcf2) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
837 except StopIteration: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
838 yield record1 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
839 for record1 in vcf1: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
840 yield record1 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
841 return |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
842 while True: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
843 if (record1.start, record1.stop) < (record2.start, record2.stop): |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
844 yield record1 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
845 try: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
846 record1 = next(vcf1) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
847 except StopIteration: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
848 yield record2 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
849 for record2 in vcf2: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
850 yield record2 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
851 return |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
852 else: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
853 yield record2 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
854 try: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
855 record2 = next(vcf2) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
856 except StopIteration: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
857 yield record1 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
858 for record1 in vcf1: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
859 yield record1 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
860 return |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
861 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
862 def merge_and_postprocess(self, snps_out, indels_out=None, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
863 no_filters=False, **filter_args): |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
864 temporary_data = self.tmpfiles |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
865 self.tmpfiles = [] |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
866 temporary_snp_files = [f + '.snp.vcf' for f in temporary_data] |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
867 temporary_indel_files = [f + '.indel.vcf' for f in temporary_data] |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
868 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
869 for f in temporary_data: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
870 try: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
871 os.remove(f) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
872 except Exception: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
873 pass |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
874 |
8
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
875 def filter_minimal(data, **kwargs): |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
876 for record in data: |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
877 if record.alleles[0] != 'N' or len(record.alleles[1]) > 1: |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
878 # Yield everything except SNPs called against an unknown |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
879 # reference base |
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
880 yield record |
2
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
881 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
882 if no_filters: |
8
b79bb8b09822
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit bd1034af3217cd9fc654d7187bf674a89465755b
iuc
parents:
7
diff
changeset
|
883 apply_filters = filter_minimal |
2
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
884 else: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
885 apply_filters = self._postprocess_variant_records |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
886 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
887 output_header = self._compile_common_header( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
888 temporary_snp_files[0], |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
889 no_filters |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
890 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
891 if indels_out is None: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
892 with open(snps_out, 'w') as o: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
893 o.write(str(output_header).format(**filter_args)) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
894 for snp_f, indel_f in zip( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
895 temporary_snp_files, temporary_indel_files |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
896 ): |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
897 with pysam.VariantFile(snp_f, 'r') as snp_invcf: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
898 # fix the input header on the fly |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
899 # to avoid Warnings from htslib about missing contig |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
900 # info |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
901 self._add_ref_contigs_to_header(snp_invcf.header) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
902 self._add_filters_to_header(snp_invcf.header) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
903 self._add_indel_info_flag_to_header(snp_invcf.header) |
6
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
904 self._standardize_format_fields(snp_invcf.header) |
2
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
905 with pysam.VariantFile(indel_f, 'r') as indel_invcf: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
906 # fix the input header on the fly |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
907 # to avoid Warnings from htslib about missing |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
908 # contig info |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
909 self._add_ref_contigs_to_header(indel_invcf.header) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
910 self._add_filters_to_header(indel_invcf.header) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
911 self._add_indel_info_flag_to_header( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
912 indel_invcf.header |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
913 ) |
6
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
914 self._standardize_format_fields(indel_invcf.header) |
2
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
915 for record in apply_filters( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
916 self._merge_generator( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
917 snp_invcf, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
918 self._indel_flagged_records(indel_invcf) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
919 ), |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
920 **filter_args |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
921 ): |
7
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
922 self._fix_record_gt_fields(record) |
2
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
923 o.write(str(record)) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
924 try: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
925 os.remove(snp_f) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
926 except Exception: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
927 pass |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
928 try: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
929 os.remove(indel_f) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
930 except Exception: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
931 pass |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
932 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
933 else: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
934 with open(snps_out, 'w') as o: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
935 o.write(str(output_header).format(**filter_args)) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
936 for f in temporary_snp_files: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
937 with pysam.VariantFile(f, 'r') as invcf: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
938 # fix the input header on the fly |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
939 # to avoid Warnings from htslib about missing |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
940 # contig info and errors because of undeclared |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
941 # filters |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
942 self._add_ref_contigs_to_header(invcf.header) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
943 self._add_filters_to_header(invcf.header) |
6
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
944 self._standardize_format_fields(invcf.header) |
2
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
945 for record in apply_filters( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
946 invcf, **filter_args |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
947 ): |
7
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
948 self._fix_record_gt_fields(record) |
2
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
949 o.write(str(record)) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
950 try: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
951 os.remove(f) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
952 except Exception: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
953 pass |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
954 with open(indels_out, 'w') as o: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
955 o.write(str(output_header)) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
956 for f in temporary_indel_files: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
957 with pysam.VariantFile(f, 'r') as invcf: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
958 # fix the input header on the fly |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
959 # to avoid Warnings from htslib about missing |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
960 # contig info and errors because of undeclared |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
961 # filters |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
962 self._add_ref_contigs_to_header(invcf.header) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
963 self._add_filters_to_header(invcf.header) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
964 self._add_indel_info_flag_to_header(invcf.header) |
6
2c66c4025db2
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 4b7660df2384d8c8c6b5a6f02a00d13211e6ff6c
iuc
parents:
2
diff
changeset
|
965 self._standardize_format_fields(invcf.header) |
2
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
966 for record in apply_filters( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
967 self._indel_flagged_records(invcf), **filter_args |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
968 ): |
7
2657ab48e16a
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit f5e4d8903b6d69b0507f6a8fc4c2533fc7a15dfa
iuc
parents:
6
diff
changeset
|
969 self._fix_record_gt_fields(record) |
2
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
970 o.write(str(record)) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
971 try: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
972 os.remove(f) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
973 except Exception: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
974 pass |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
975 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
976 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
977 def varscan_call(ref_genome, normal, tumor, output_path, **args): |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
978 """Preparse arguments and orchestrate calling and postprocessing.""" |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
979 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
980 if args.pop('split_output'): |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
981 if '%T' in output_path: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
982 out = ( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
983 output_path.replace('%T', 'snp'), |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
984 output_path.replace('%T', 'indel') |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
985 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
986 else: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
987 out = ( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
988 output_path + '.snp', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
989 output_path + '.indel' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
990 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
991 else: |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
992 out = (output_path, None) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
993 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
994 instance_args = { |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
995 k: args.pop(k) for k in [ |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
996 'max_depth', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
997 'min_mapqual', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
998 'min_basequal', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
999 'threads', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1000 'verbose', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1001 'quiet' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1002 ] |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1003 } |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1004 varscan_somatic_args = { |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1005 k: args.pop(k) for k in [ |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1006 'normal_purity', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1007 'tumor_purity', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1008 'min_coverage', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1009 'min_var_count', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1010 'min_var_freq', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1011 'min_hom_freq', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1012 'somatic_p_value', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1013 'p_value' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1014 ] |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1015 } |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1016 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1017 v = VarScanCaller(ref_genome, [normal, tumor], **instance_args) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1018 v.varcall_parallel(**varscan_somatic_args) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1019 v.merge_and_postprocess(*out, **args) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1020 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1021 |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1022 if __name__ == '__main__': |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1023 p = argparse.ArgumentParser() |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1024 p.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1025 'ref_genome', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1026 metavar='reference_genome', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1027 help='the reference genome (in fasta format)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1028 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1029 p.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1030 '--normal', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1031 metavar='BAM_file', required=True, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1032 help='the BAM input file of aligned reads from the normal sample' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1033 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1034 p.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1035 '--tumor', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1036 metavar='BAM_file', required=True, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1037 help='the BAM input file of aligned reads from the tumor sample' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1038 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1039 p.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1040 '-o', '--ofile', required=True, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1041 metavar='OFILE', dest='output_path', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1042 help='Name of the variant output file. With --split-output, the name ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1043 'may use the %%T replacement token or will be used as the ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1044 'basename for the two output files to be generated (see ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1045 '-s|--split-output below).' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1046 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1047 p.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1048 '-s', '--split-output', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1049 dest='split_output', action='store_true', default=False, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1050 help='indicate that separate output files for SNPs and indels ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1051 'should be generated (original VarScan behavior). If specified, ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1052 '%%T in the --ofile file name will be replaced with "snp" and ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1053 '"indel" to generate the names of the SNP and indel output ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1054 'files, respectively. If %%T is not found in the file name, it ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1055 'will get interpreted as a basename to which ".snp"/".indel" ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1056 'will be appended.' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1057 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1058 p.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1059 '-t', '--threads', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1060 type=int, default=1, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1061 help='level of parallelism' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1062 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1063 p.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1064 '-v', '--verbose', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1065 action='store_true', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1066 help='be verbose about progress' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1067 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1068 p.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1069 '-q', '--quiet', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1070 action='store_true', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1071 help='suppress output from wrapped tools' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1072 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1073 call_group = p.add_argument_group('Variant calling parameters') |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1074 call_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1075 '--normal-purity', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1076 dest='normal_purity', type=float, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1077 default=1.0, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1078 help='Estimated purity of the normal sample (default: 1.0)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1079 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1080 call_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1081 '--tumor-purity', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1082 dest='tumor_purity', type=float, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1083 default=1.0, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1084 help='Estimated purity of the tumor sample (default: 1.0)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1085 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1086 call_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1087 '--max-pileup-depth', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1088 dest='max_depth', type=int, default=8000, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1089 help='Maximum depth of generated pileups (samtools mpileup -d option; ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1090 'default: 8000)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1091 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1092 call_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1093 '--min-basequal', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1094 dest='min_basequal', type=int, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1095 default=13, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1096 help='Minimum base quality at the variant position to use a read ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1097 '(default: 13)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1098 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1099 call_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1100 '--min-mapqual', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1101 dest='min_mapqual', type=int, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1102 default=0, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1103 help='Minimum mapping quality required to use a read ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1104 '(default: 0)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1105 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1106 call_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1107 '--min-coverage', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1108 dest='min_coverage', type=int, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1109 default=8, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1110 help='Minimum site coverage required in the normal and in the tumor ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1111 'sample to call a variant (default: 8)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1112 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1113 call_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1114 '--min-var-count', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1115 dest='min_var_count', type=int, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1116 default=2, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1117 help='Minimum number of variant-supporting reads required to call a ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1118 'variant (default: 2)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1119 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1120 call_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1121 '--min-var-freq', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1122 dest='min_var_freq', type=float, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1123 default=0.1, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1124 help='Minimum variant allele frequency for calling (default: 0.1)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1125 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1126 call_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1127 '--min-hom-freq', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1128 dest='min_hom_freq', type=float, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1129 default=0.75, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1130 help='Minimum variant allele frequency for homozygous call ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1131 '(default: 0.75)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1132 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1133 call_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1134 '--p-value', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1135 dest='p_value', type=float, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1136 default=0.99, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1137 help='P-value threshold for heterozygous call (default: 0.99)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1138 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1139 call_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1140 '--somatic-p-value', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1141 dest='somatic_p_value', type=float, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1142 default=0.05, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1143 help='P-value threshold for somatic call (default: 0.05)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1144 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1145 filter_group = p.add_argument_group('Posterior variant filter parameters') |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1146 filter_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1147 '--no-filters', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1148 dest='no_filters', action='store_true', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1149 help='Disable all posterior variant filters. ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1150 'If specified, all following options will be ignored' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1151 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1152 filter_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1153 '--min-var-count2', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1154 dest='min_var_count2', type=int, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1155 default=4, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1156 help='Minimum number of variant-supporting reads (default: 4)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1157 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1158 filter_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1159 '--min-var-count2-lc', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1160 dest='min_var_count2_lc', type=int, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1161 default=2, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1162 help='Minimum number of variant-supporting reads when depth below ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1163 '--somatic-p-depth (default: 2)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1164 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1165 filter_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1166 '--min-var-freq2', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1167 dest='min_var_freq2', type=float, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1168 default=0.05, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1169 help='Minimum variant allele frequency (default: 0.05)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1170 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1171 filter_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1172 '--max-somatic-p', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1173 dest='max_somatic_p', type=float, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1174 default=0.05, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1175 help='Maximum somatic p-value (default: 0.05)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1176 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1177 filter_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1178 '--max-somatic-p-depth', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1179 dest='max_somatic_p_depth', type=int, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1180 default=10, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1181 help='Depth required to run --max-somatic-p filter (default: 10)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1182 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1183 filter_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1184 '--min-ref-readpos', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1185 dest='min_ref_readpos', type=float, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1186 default=0.1, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1187 help='Minimum average relative distance of site from the ends of ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1188 'ref-supporting reads (default: 0.1)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1189 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1190 filter_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1191 '--min-var-readpos', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1192 dest='min_var_readpos', type=float, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1193 default=0.1, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1194 help='Minimum average relative distance of site from the ends of ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1195 'variant-supporting reads (default: 0.1)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1196 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1197 filter_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1198 '--min-ref-dist3', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1199 dest='min_ref_dist3', type=float, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1200 default=0.1, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1201 help='Minimum average relative distance of site from the effective ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1202 '3\'end of ref-supporting reads (default: 0.1)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1203 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1204 filter_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1205 '--min-var-dist3', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1206 dest='min_var_dist3', type=float, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1207 default=0.1, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1208 help='Minimum average relative distance of site from the effective ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1209 '3\'end of variant-supporting reads (default: 0.1)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1210 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1211 filter_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1212 '--min-ref-len', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1213 dest='min_ref_len', type=int, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1214 default=90, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1215 help='Minimum average trimmed length of reads supporting the ref ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1216 'allele (default: 90)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1217 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1218 filter_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1219 '--min-var-len', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1220 dest='min_var_len', type=int, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1221 default=90, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1222 help='Minimum average trimmed length of reads supporting the variant ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1223 'allele (default: 90)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1224 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1225 filter_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1226 '--max-len-diff', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1227 dest='max_relative_len_diff', type=float, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1228 default=0.25, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1229 help='Maximum average relative read length difference (ref - var; ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1230 'default: 0.25)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1231 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1232 filter_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1233 '--min-strandedness', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1234 dest='min_strandedness', type=float, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1235 default=0.01, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1236 help='Minimum fraction of variant reads from each strand ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1237 '(default: 0.01)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1238 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1239 filter_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1240 '--min-strand-reads', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1241 dest='min_strand_reads', type=int, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1242 default=5, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1243 help='Minimum allele depth required to run --min-strandedness filter ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1244 '(default: 5)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1245 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1246 filter_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1247 '--min-ref-basequal', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1248 dest='min_ref_basequal', type=int, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1249 default=15, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1250 help='Minimum average base quality for the ref allele (default: 15)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1251 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1252 filter_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1253 '--min-var-basequal', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1254 dest='min_var_basequal', type=int, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1255 default=15, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1256 help='Minimum average base quality for the variant allele ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1257 '(default: 15)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1258 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1259 filter_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1260 '--max-basequal-diff', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1261 dest='max_basequal_diff', type=int, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1262 default=50, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1263 help='Maximum average base quality diff (ref - var; default: 50)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1264 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1265 filter_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1266 '--min-ref-mapqual', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1267 dest='min_ref_mapqual', type=int, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1268 default=15, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1269 help='Minimum average mapping quality of reads supporting the ref ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1270 'allele (default: 15)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1271 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1272 filter_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1273 '--min-var-mapqual', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1274 dest='min_var_mapqual', type=int, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1275 default=15, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1276 help='Minimum average mapping quality of reads supporting the variant ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1277 'allele (default: 15)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1278 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1279 filter_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1280 '--max-mapqual-diff', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1281 dest='max_mapqual_diff', type=int, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1282 default=50, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1283 help='Maximum average mapping quality difference (ref - var; ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1284 'default: 50)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1285 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1286 filter_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1287 '--max-ref-mmqs', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1288 dest='max_ref_mmqs', type=int, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1289 default=100, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1290 help='Maximum mismatch quality sum of reads supporting the ref ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1291 'allele (default: 100)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1292 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1293 filter_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1294 '--max-var-mmqs', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1295 dest='max_var_mmqs', type=int, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1296 default=100, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1297 help='Maximum mismatch quality sum of reads supporting the variant ' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1298 'allele (default: 100)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1299 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1300 filter_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1301 '--min-mmqs-diff', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1302 dest='min_mmqs_diff', type=int, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1303 default=0, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1304 help='Minimum mismatch quality sum difference (var - ref; default: 0)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1305 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1306 filter_group.add_argument( |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1307 '--max-mmqs-diff', |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1308 dest='max_mmqs_diff', type=int, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1309 default=50, |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1310 help='Maximum mismatch quality sum difference (var - ref; default: 50)' |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1311 ) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1312 args = vars(p.parse_args()) |
2fe9ebb98aad
planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/varscan commit 30867f1f022bed18ba1c3b8dc9c54226890b3a9c
iuc
parents:
diff
changeset
|
1313 varscan_call(**args) |