Mercurial > repos > bgruening > bismark
annotate old/bismark_methylation_extractor @ 7:fcadce4d9a06 draft
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
author | bgruening |
---|---|
date | Sat, 06 May 2017 13:18:09 -0400 |
parents | |
children |
rev | line source |
---|---|
7
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1 #!/usr/bin/perl |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2 use warnings; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3 use strict; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4 $|++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
5 use Getopt::Long; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
6 use Cwd; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
7 use Carp; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
8 use FindBin qw($Bin); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
9 use lib "$Bin/../lib"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
10 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
11 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
12 ## This program is Copyright (C) 2010-13, Felix Krueger (felix.krueger@babraham.ac.uk) |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
13 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
14 ## This program is free software: you can redistribute it and/or modify |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
15 ## it under the terms of the GNU General Public License as published by |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
16 ## the Free Software Foundation, either version 3 of the License, or |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
17 ## (at your option) any later version. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
18 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
19 ## This program is distributed in the hope that it will be useful, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
20 ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
21 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
22 ## GNU General Public License for more details. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
23 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
24 ## You should have received a copy of the GNU General Public License |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
25 ## along with this program. If not, see <http://www.gnu.org/licenses/>. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
26 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
27 my @filenames; # input files |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
28 my %counting; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
29 my $parent_dir = getcwd(); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
30 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
31 my %fhs; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
32 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
33 my $version = 'v0.10.1'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
34 my ($ignore,$genomic_fasta,$single,$paired,$full,$report,$no_overlap,$merge_non_CpG,$vanilla,$output_dir,$no_header,$bedGraph,$remove,$coverage_threshold,$counts,$cytosine_report,$genome_folder,$zero,$CpG_only,$CX_context,$split_by_chromosome,$sort_size,$samtools_path,$gzip,$ignore_r2,$mbias_only,$gazillion,$ample_mem) = process_commandline(); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
35 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
36 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
37 ### only needed for bedGraph output |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
38 my @sorting_files; # if files are to be written to bedGraph format, these are the methylation extractor output files |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
39 my @methylcalls = qw (0 0 0); # [0] = methylated, [1] = unmethylated, [2] = total |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
40 my @bedfiles; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
41 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
42 ### only needed for genome-wide cytosine methylation report |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
43 my %chromosomes; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
44 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
45 my %mbias_1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
46 my %mbias_2; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
47 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
48 ############################################################################################## |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
49 ### Summarising Run Parameters |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
50 ############################################################################################## |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
51 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
52 ### METHYLATION EXTRACTOR |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
53 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
54 warn "Summarising Bismark methylation extractor parameters:\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
55 warn '='x63,"\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
56 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
57 if ($single){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
58 if ($vanilla){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
59 warn "Bismark single-end vanilla format specified\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
60 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
61 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
62 warn "Bismark single-end SAM format specified (default)\n"; # default |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
63 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
64 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
65 elsif ($paired){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
66 if ($vanilla){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
67 warn "Bismark paired-end vanilla format specified\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
68 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
69 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
70 warn "Bismark paired-end SAM format specified (default)\n"; # default |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
71 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
72 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
73 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
74 if ($single){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
75 if ($ignore){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
76 warn "First $ignore bp will be disregarded when processing the methylation call string\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
77 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
78 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
79 else{ ## paired-end |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
80 if ($ignore){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
81 warn "First $ignore bp will be disregarded when processing the methylation call string of Read 1\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
82 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
83 if ($ignore_r2){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
84 warn "First $ignore_r2 bp will be disregarded when processing the methylation call string of Read 2\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
85 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
86 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
87 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
88 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
89 if ($full){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
90 warn "Strand-specific outputs will be skipped. Separate output files for cytosines in CpG, CHG and CHH context will be generated\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
91 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
92 if ($merge_non_CpG){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
93 warn "Merge CHG and CHH context to non-CpG context specified\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
94 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
95 ### output directory |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
96 if ($output_dir eq ''){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
97 warn "Output will be written to the current directory ('$parent_dir')\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
98 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
99 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
100 warn "Output path specified as: $output_dir\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
101 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
102 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
103 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
104 sleep (1); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
105 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
106 ### BEDGRAPH |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
107 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
108 if ($bedGraph){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
109 warn "\n\nSummarising bedGraph parameters:\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
110 warn '='x63,"\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
111 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
112 if ($counts){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
113 warn "Generating additional output in bedGraph and coverage format\nbedGraph format:\t<Chromosome> <Start Position> <End Position> <Methylation Percentage>\ncoverage format:\t<Chromosome> <Start Position> <End Position> <Methylation Percentage> <count methylated> <count non-methylated>\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
114 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
115 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
116 warn "Generating additional sorted output in bedGraph format (output format: <Chromosome> <Start Position> <End Position> <Methylation Percentage>)\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
117 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
118 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
119 warn "Using a cutoff of $coverage_threshold read(s) to report cytosine positions\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
120 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
121 if ($CX_context){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
122 warn "Reporting and sorting methylation information for all cytosine context (sorting may take a long time, you have been warned ...)\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
123 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
124 else{ # default |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
125 $CpG_only = 1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
126 warn "Reporting and sorting cytosine methylation information in CpG context only (default)\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
127 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
128 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
129 if ($remove){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
130 warn "White spaces in read ID names will be removed prior to sorting\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
131 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
132 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
133 if ($ample_mem){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
134 warn "Sorting chromosomal postions for the bedGraph step using arrays instead of using UNIX sort\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
135 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
136 elsif (defined $sort_size){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
137 warn "The bedGraph UNIX sort command will use the following memory setting:\t'$sort_size'. Temporary directory used for sorting is the output directory\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
138 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
139 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
140 warn "Setting a default memory usage for the bedGraph UNIX sort command to 2GB\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
141 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
142 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
143 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
144 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
145 sleep (1); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
146 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
147 if ($cytosine_report){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
148 warn "\n\nSummarising genome-wide cytosine methylation report parameters:\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
149 warn '='x63,"\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
150 warn "Generating comprehensive genome-wide cytosine report\n(output format: <Chromosome> <Position> <Strand> <count methylated> <count non-methylated> <C-context> <trinucleotide context> )\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
151 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
152 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
153 if ($CX_context){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
154 warn "Reporting methylation for all cytosine contexts. Be aware that this will generate enormous files\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
155 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
156 else{ # default |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
157 $CpG_only = 1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
158 warn "Reporting cytosine methylation in CpG context only (default)\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
159 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
160 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
161 if ($split_by_chromosome){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
162 warn "Splitting the cytosine report output up into individual files for each chromosome\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
163 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
164 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
165 ### Zero-based coordinates |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
166 if ($zero){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
167 warn "Using zero-based genomic coordinates (user-defined)\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
168 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
169 else{ # default, 1-based coords |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
170 warn "Using 1-based genomic coordinates (default)\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
171 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
172 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
173 ### GENOME folder |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
174 if ($genome_folder){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
175 unless ($genome_folder =~/\/$/){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
176 $genome_folder =~ s/$/\//; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
177 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
178 warn "Genome folder was specified as $genome_folder\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
179 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
180 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
181 $genome_folder = '/data/public/Genomes/Mouse/NCBIM37/'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
182 warn "Using the default genome folder /data/public/Genomes/Mouse/NCBIM37/\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
183 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
184 sleep (1); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
185 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
186 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
187 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
188 warn "\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
189 sleep (5); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
190 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
191 ###################################################### |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
192 ### PROCESSING FILES |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
193 ###################################################### |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
194 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
195 foreach my $filename (@filenames){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
196 # resetting counters and filehandles |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
197 %fhs = (); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
198 %counting =( |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
199 total_meCHG_count => 0, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
200 total_meCHH_count => 0, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
201 total_meCpG_count => 0, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
202 total_unmethylated_CHG_count => 0, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
203 total_unmethylated_CHH_count => 0, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
204 total_unmethylated_CpG_count => 0, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
205 sequences_count => 0, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
206 ); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
207 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
208 @sorting_files = (); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
209 @bedfiles = (); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
210 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
211 %mbias_1 = (); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
212 %mbias_2 = (); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
213 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
214 ### performing a quick check to see if a paired-end SAM file has been sorted by positions which does interfere with the logic used by the extractor |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
215 unless ($vanilla){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
216 if ($paired){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
217 test_positional_sorting($filename); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
218 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
219 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
220 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
221 process_Bismark_results_file($filename); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
222 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
223 ### Closing all filehandles so that the Bismark methylation extractor output doesn't get truncated due to buffering issues |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
224 foreach my $fh (keys %fhs) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
225 if ($fh =~ /^[1230]$/) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
226 foreach my $context (keys %{$fhs{$fh}}) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
227 close $fhs{$fh}->{$context} or die $!; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
228 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
229 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
230 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
231 close $fhs{$fh} or die $!; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
232 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
233 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
234 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
235 ### printing out all M-Bias data |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
236 produce_mbias_plots ($filename); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
237 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
238 delete_unused_files(); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
239 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
240 if ($bedGraph){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
241 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
242 my $out = (split (/\//,$filename))[-1]; # extracting the filename if a full path was specified |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
243 $out =~ s/gz$//; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
244 $out =~ s/sam$//; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
245 $out =~ s/bam$//; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
246 $out =~ s/txt$//; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
247 $out =~ s/$/bedGraph/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
248 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
249 my $bedGraph_output = $out; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
250 my @args; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
251 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
252 if ($remove){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
253 push @args, '--remove'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
254 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
255 if ($CX_context){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
256 push @args, '--CX_context'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
257 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
258 if ($no_header){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
259 push @args, '--no_header'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
260 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
261 if ($gazillion){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
262 push @args, '--gazillion'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
263 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
264 if ($ample_mem){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
265 push @args, '--ample_memory'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
266 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
267 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
268 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
269 # if ($counts){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
270 # push @args, "--counts"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
271 # } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
272 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
273 push @args, "--buffer_size $sort_size"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
274 push @args, "--cutoff $coverage_threshold"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
275 push @args, "--output $bedGraph_output"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
276 push @args, "--dir '$output_dir'"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
277 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
278 ### adding all files to be sorted to @args |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
279 foreach my $f (@sorting_files){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
280 push @args, $f; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
281 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
282 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
283 # print join "\t",@args,"\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
284 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
285 system ("$Bin/bismark2bedGraph @args"); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
286 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
287 warn "Finished BedGraph conversion ...\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
288 sleep(3); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
289 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
290 # open (OUT,'>',$output_dir.$bedGraph_output) or die "Problems with the bedGraph output filename detected: file path: '$output_dir'\tfile name: '$bedGraph_output' $!"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
291 # warn "Writing bedGraph to file: $bedGraph_output\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
292 # process_bedGraph_output(); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
293 # close OUT or die $!; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
294 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
295 ### genome-wide cytosine methylation report requires bedGraph processing anyway |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
296 if ($cytosine_report){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
297 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
298 @args = (); # resetting @args |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
299 my $cytosine_out = $out; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
300 $cytosine_out =~ s/bedGraph$//; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
301 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
302 if ($CX_context){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
303 $cytosine_out =~ s/$/CX_report.txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
304 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
305 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
306 $cytosine_out =~ s/$/CpG_report.txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
307 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
308 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
309 push @args, "--output $cytosine_out"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
310 push @args, "--dir '$output_dir'"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
311 push @args, "--genome '$genome_folder'"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
312 push @args, "--parent_dir '$parent_dir'"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
313 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
314 if ($zero){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
315 push @args, "--zero"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
316 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
317 if ($CX_context){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
318 push @args, '--CX_context'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
319 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
320 if ($split_by_chromosome){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
321 push @args, '--split_by_chromosome'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
322 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
323 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
324 my $coverage_output = $bedGraph_output; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
325 $coverage_output =~ s/bedGraph$/bismark.cov/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
326 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
327 push @args, $output_dir . $coverage_output; # this will be the infile |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
328 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
329 system ("$Bin/coverage2cytosine @args"); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
330 # generate_genome_wide_cytosine_report($bedGraph_output,$cytosine_out); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
331 warn "\n\nFinished generating genome-wide cytosine report\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
332 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
333 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
334 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
335 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
336 sub delete_unused_files{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
337 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
338 warn "Deleting unused files ...\n\n"; sleep(1); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
339 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
340 my $index = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
341 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
342 while ($index <= $#sorting_files){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
343 if ($sorting_files[$index] =~ /gz$/){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
344 open (USED,"zcat $sorting_files[$index] |") or die "Failed to read from methylation extractor output file $sorting_files[$index]: $!\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
345 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
346 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
347 open (USED,$sorting_files[$index]) or die "Failed to read from methylation extractor output file $sorting_files[$index]: $!\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
348 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
349 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
350 my $used = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
351 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
352 while (<USED>){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
353 next if (/^Bismark/); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
354 if ($_){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
355 $used = 1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
356 last; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
357 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
358 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
359 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
360 if ($used){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
361 warn "$sorting_files[$index] contains data ->\tkept\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
362 ++$index; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
363 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
364 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
365 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
366 my $delete = unlink $sorting_files[$index]; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
367 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
368 if ($delete){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
369 warn "$sorting_files[$index] was empty ->\tdeleted\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
370 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
371 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
372 warn "$sorting_files[$index] was empty, however deletion was unsuccessful: $!\n" |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
373 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
374 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
375 ### we also need to remove the element from @sorting_files |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
376 splice @sorting_files, $index, 1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
377 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
378 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
379 warn "\n\n"; ## can't close the piped filehandles at this point because it will die (unfortunately) |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
380 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
381 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
382 sub produce_mbias_plots{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
383 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
384 my $filename = shift; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
385 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
386 my $mbias = (split (/\//,$filename))[-1]; # extracting the filename if a full path was specified |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
387 $mbias =~ s/gz$//; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
388 $mbias =~ s/sam$//; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
389 $mbias =~ s/bam$//; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
390 $mbias =~ s/txt$//; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
391 my $mbias_graph_1 = my $mbias_graph_2 = $mbias; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
392 $mbias_graph_1 = $output_dir . $mbias_graph_1 . 'M-bias_R1.png'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
393 $mbias_graph_2 = $output_dir . $mbias_graph_2 . 'M-bias_R2.png'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
394 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
395 $mbias =~ s/$/M-bias.txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
396 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
397 open (MBIAS,'>',"$output_dir$mbias") or die "Failed to open file for the M-bias data\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
398 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
399 # determining maximum read length |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
400 my $max_length_1 = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
401 my $max_length_2 = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
402 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
403 foreach my $context (keys %mbias_1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
404 foreach my $pos (sort {$a<=>$b} keys %{$mbias_1{$context}}){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
405 $max_length_1 = $pos unless ($max_length_1 >= $pos); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
406 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
407 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
408 if ($paired){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
409 foreach my $context (keys %mbias_2){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
410 foreach my $pos (sort {$a<=>$b} keys %{$mbias_2{$context}}){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
411 $max_length_2 = $pos unless ($max_length_2 >= $pos); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
412 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
413 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
414 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
415 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
416 if ($single){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
417 warn "Determining maximum read length for M-Bias plot\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
418 warn "Maximum read length of Read 1: $max_length_1\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
419 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
420 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
421 warn "Determining maximum read lengths for M-Bias plots\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
422 warn "Maximum read length of Read 1: $max_length_1\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
423 warn "Maximum read length of Read 2: $max_length_2\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
424 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
425 # sleep(3); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
426 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
427 my @mbias_read1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
428 my @mbias_read2; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
429 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
430 #Check whether the module GD::Graph:lines is installed |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
431 my $gd_graph_installed = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
432 eval{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
433 require GD::Graph::lines; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
434 GD::Graph::lines->import(); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
435 }; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
436 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
437 unless($@) { # syntax or routine error variable, set if something goes wron in the last eval{ require ...} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
438 $gd_graph_installed = 1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
439 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
440 #Check whether the module GD::Graph::colour is installed |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
441 eval{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
442 require GD::Graph::colour; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
443 GD::Graph::colour->import(qw(:colours :lists :files :convert)); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
444 }; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
445 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
446 if ($@) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
447 warn "Perl module GD::Graph::colour not found, skipping drawing M-bias plots (only writing out M-bias plot table)\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
448 sleep(2); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
449 $gd_graph_installed = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
450 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
451 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
452 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
453 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
454 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
455 warn "Perl module GD::Graph::lines is not installed, skipping drawing M-bias plots (only writing out M-bias plot table)\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
456 sleep(2); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
457 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
458 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
459 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
460 my $graph_title; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
461 my $graph1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
462 my $graph2; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
463 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
464 if ( $gd_graph_installed){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
465 $graph1 = GD::Graph::lines->new(800,600); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
466 if ($paired){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
467 $graph2 = GD::Graph::lines->new(800,600); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
468 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
469 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
470 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
471 foreach my $context (qw(CpG CHG CHH)){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
472 @{$mbias_read1[0]} = (); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
473 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
474 if ($paired){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
475 print MBIAS "$context context (R1)\n================\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
476 $graph_title = 'M-bias (Read 1)'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
477 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
478 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
479 print MBIAS "$context context\n===========\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
480 $graph_title = 'M-bias'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
481 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
482 print MBIAS "position\tcount methylated\tcount unmethylated\t% methylation\tcoverage\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
483 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
484 foreach my $pos (1..$max_length_1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
485 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
486 unless (defined $mbias_1{$context}->{$pos}->{meth}){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
487 $mbias_1{$context}->{$pos}->{meth} = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
488 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
489 unless (defined $mbias_1{$context}->{$pos}->{un}){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
490 $mbias_1{$context}->{$pos}->{un} = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
491 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
492 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
493 my $percent = ''; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
494 if (($mbias_1{$context}->{$pos}->{meth} + $mbias_1{$context}->{$pos}->{un}) > 0){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
495 $percent = sprintf("%.2f",$mbias_1{$context}->{$pos}->{meth} * 100/ ( $mbias_1{$context}->{$pos}->{meth} + $mbias_1{$context}->{$pos}->{un}) ); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
496 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
497 my $coverage = $mbias_1{$context}->{$pos}->{un} + $mbias_1{$context}->{$pos}->{meth}; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
498 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
499 print MBIAS "$pos\t$mbias_1{$context}->{$pos}->{meth}\t$mbias_1{$context}->{$pos}->{un}\t$percent\t$coverage\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
500 push @{$mbias_read1[0]},$pos; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
501 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
502 if ($context eq 'CpG'){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
503 push @{$mbias_read1[1]},$percent; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
504 push @{$mbias_read1[4]},$coverage; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
505 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
506 elsif ($context eq 'CHG'){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
507 push @{$mbias_read1[2]},$percent; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
508 push @{$mbias_read1[5]},$coverage; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
509 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
510 elsif ($context eq 'CHH'){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
511 push @{$mbias_read1[3]},$percent; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
512 push @{$mbias_read1[6]},$coverage; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
513 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
514 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
515 print MBIAS "\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
516 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
517 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
518 if ( $gd_graph_installed){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
519 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
520 add_colour(nice_blue => [31,120,180]); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
521 add_colour(nice_orange => [255,127,0]); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
522 add_colour(nice_green => [51,160,44]); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
523 add_colour(pale_blue => [153,206,227]); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
524 add_colour(pale_orange => [253,204,138]); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
525 add_colour(pale_green => [191,230,207]); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
526 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
527 $graph1->set( |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
528 x_label => 'position (bp)', |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
529 y1_label => '% methylation', |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
530 y2_label => '# methylation calls', |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
531 title => $graph_title, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
532 line_width => 2, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
533 x_max_value => $max_length_1, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
534 x_min_value => 0, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
535 y_tick_number => 10, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
536 y_label_skip => 2, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
537 y1_max_value => 100, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
538 y1_min_value => 0, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
539 y_label_skip => 2, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
540 y2_min_value => 0, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
541 x_label_skip => 5, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
542 x_label_position => 0.5, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
543 x_tick_offset => -1, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
544 bgclr => 'white', |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
545 transparent => 0, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
546 two_axes => 1, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
547 use_axis => [1,1,1,2,2,2], |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
548 legend_placement => 'RC', |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
549 legend_spacing => 6, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
550 legend_marker_width => 24, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
551 legend_marker_height => 18, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
552 dclrs => [ qw(nice_blue nice_orange nice_green pale_blue pale_orange pale_green)], |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
553 ) or die $graph1->error; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
554 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
555 $graph1->set_legend('CpG methylation','CHG methylation','CHH methylation','CpG total calls','CHG total calls','CHH total calls'); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
556 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
557 my $gd1 = $graph1->plot(\@mbias_read1) or die $graph1->error; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
558 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
559 open (MBIAS_G1,'>',$mbias_graph_1) or die "Failed to write to file for M-bias plot 1: $!\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
560 binmode MBIAS_G1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
561 print MBIAS_G1 $gd1->png; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
562 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
563 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
564 if ($paired){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
565 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
566 foreach my $context (qw(CpG CHG CHH)){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
567 @{$mbias_read2[0]} = (); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
568 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
569 print MBIAS "$context context (R2)\n================\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
570 print MBIAS "position\tcount methylated\tcount unmethylated\t% methylation\tcoverage\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
571 foreach my $pos (1..$max_length_2){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
572 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
573 unless (defined $mbias_2{$context}->{$pos}->{meth}){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
574 $mbias_2{$context}->{$pos}->{meth} = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
575 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
576 unless (defined $mbias_2{$context}->{$pos}->{un}){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
577 $mbias_2{$context}->{$pos}->{un} = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
578 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
579 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
580 my $percent = ''; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
581 if (($mbias_2{$context}->{$pos}->{meth} + $mbias_2{$context}->{$pos}->{un}) > 0){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
582 $percent = sprintf("%.2f",$mbias_2{$context}->{$pos}->{meth} * 100/ ($mbias_2{$context}->{$pos}->{meth} + $mbias_2{$context}->{$pos}->{un}) ); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
583 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
584 my $coverage = $mbias_2{$context}->{$pos}->{un} + $mbias_2{$context}->{$pos}->{meth}; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
585 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
586 print MBIAS "$pos\t$mbias_2{$context}->{$pos}->{meth}\t$mbias_2{$context}->{$pos}->{un}\t$percent\t$coverage\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
587 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
588 push @{$mbias_read2[0]},$pos; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
589 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
590 if ($context eq 'CpG'){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
591 push @{$mbias_read2[1]},$percent; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
592 push @{$mbias_read2[4]},$coverage; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
593 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
594 elsif ($context eq 'CHG'){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
595 push @{$mbias_read2[2]},$percent; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
596 push @{$mbias_read2[5]},$coverage; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
597 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
598 elsif ($context eq 'CHH'){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
599 push @{$mbias_read2[3]},$percent; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
600 push @{$mbias_read2[6]},$coverage; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
601 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
602 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
603 print MBIAS "\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
604 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
605 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
606 if ( $gd_graph_installed){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
607 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
608 add_colour(nice_blue => [31,120,180]); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
609 add_colour(nice_orange => [255,127,0]); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
610 add_colour(nice_green => [51,160,44]); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
611 add_colour(pale_blue => [153,206,227]); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
612 add_colour(pale_orange => [253,204,138]); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
613 add_colour(pale_green => [191,230,207]); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
614 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
615 $graph2->set( |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
616 x_label => 'position (bp)', |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
617 line_width => 2, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
618 x_max_value => $max_length_1, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
619 x_min_value => 0, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
620 y_tick_number => 10, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
621 y_label_skip => 2, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
622 y1_max_value => 100, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
623 y1_min_value => 0, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
624 y_label_skip => 2, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
625 y2_min_value => 0, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
626 x_label_skip => 5, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
627 x_label_position => 0.5, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
628 x_tick_offset => -1, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
629 bgclr => 'white', |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
630 transparent => 0, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
631 two_axes => 1, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
632 use_axis => [1,1,1,2,2,2], |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
633 legend_placement => 'RC', |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
634 legend_spacing => 6, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
635 legend_marker_width => 24, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
636 legend_marker_height => 18, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
637 dclrs => [ qw(nice_blue nice_orange nice_green pale_blue pale_orange pale_green)], |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
638 x_label => 'position (bp)', |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
639 y1_label => '% methylation', |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
640 y2_label => '# calls', |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
641 title => 'M-bias (Read 2)', |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
642 ) or die $graph2->error; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
643 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
644 $graph2->set_legend('CpG methylation','CHG methylation','CHH methylation','CpG total calls','CHG total calls','CHH total calls'); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
645 my $gd2 = $graph2->plot(\@mbias_read2) or die $graph2->error; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
646 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
647 open (MBIAS_G2,'>',$mbias_graph_2) or die "Failed to write to file for M-bias plot 2: $!\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
648 binmode MBIAS_G2; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
649 print MBIAS_G2 $gd2->png; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
650 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
651 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
652 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
653 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
654 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
655 sub process_commandline{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
656 my $help; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
657 my $single_end; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
658 my $paired_end; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
659 my $ignore; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
660 my $ignore_r2; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
661 my $genomic_fasta; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
662 my $full; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
663 my $report; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
664 my $extractor_version; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
665 my $no_overlap; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
666 my $merge_non_CpG; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
667 my $vanilla; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
668 my $output_dir; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
669 my $no_header; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
670 my $bedGraph; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
671 my $coverage_threshold = 1; # Minimum number of reads covering before calling methylation status |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
672 my $remove; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
673 my $counts; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
674 my $cytosine_report; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
675 my $genome_folder; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
676 my $zero; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
677 my $CpG_only; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
678 my $CX_context; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
679 my $split_by_chromosome; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
680 my $sort_size; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
681 my $samtools_path; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
682 my $gzip; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
683 my $mbias_only; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
684 my $gazillion; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
685 my $ample_mem; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
686 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
687 my $command_line = GetOptions ('help|man' => \$help, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
688 'p|paired-end' => \$paired_end, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
689 's|single-end' => \$single_end, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
690 'fasta' => \$genomic_fasta, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
691 'ignore=i' => \$ignore, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
692 'ignore_r2=i' => \$ignore_r2, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
693 'comprehensive' => \$full, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
694 'report' => \$report, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
695 'version' => \$extractor_version, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
696 'no_overlap' => \$no_overlap, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
697 'merge_non_CpG' => \$merge_non_CpG, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
698 'vanilla' => \$vanilla, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
699 'o|output=s' => \$output_dir, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
700 'no_header' => \$no_header, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
701 'bedGraph' => \$bedGraph, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
702 "cutoff=i" => \$coverage_threshold, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
703 "remove_spaces" => \$remove, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
704 "counts" => \$counts, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
705 "cytosine_report" => \$cytosine_report, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
706 'g|genome_folder=s' => \$genome_folder, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
707 "zero_based" => \$zero, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
708 "CX|CX_context" => \$CX_context, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
709 "split_by_chromosome" => \$split_by_chromosome, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
710 "buffer_size=s" => \$sort_size, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
711 'samtools_path=s' => \$samtools_path, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
712 "gzip" => \$gzip, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
713 "mbias_only" => \$mbias_only, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
714 "gazillion|scaffolds" => \$gazillion, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
715 "ample_memory" => \$ample_mem, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
716 ); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
717 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
718 ### EXIT ON ERROR if there were errors with any of the supplied options |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
719 unless ($command_line){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
720 die "Please respecify command line options\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
721 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
722 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
723 ### HELPFILE |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
724 if ($help){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
725 print_helpfile(); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
726 exit; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
727 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
728 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
729 if ($extractor_version){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
730 print << "VERSION"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
731 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
732 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
733 Bismark Methylation Extractor |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
734 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
735 Bismark Extractor Version: $version |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
736 Copyright 2010-13 Felix Krueger, Babraham Bioinformatics |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
737 www.bioinformatics.babraham.ac.uk/projects/bismark/ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
738 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
739 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
740 VERSION |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
741 exit; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
742 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
743 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
744 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
745 ### no files provided |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
746 unless (@ARGV){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
747 die "You need to provide one or more Bismark files to create an individual C methylation output. Please respecify!\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
748 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
749 @filenames = @ARGV; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
750 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
751 warn "\n *** Bismark methylation extractor version $version ***\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
752 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
753 ### M-BIAS ONLY |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
754 if ($mbias_only){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
755 if ($bedGraph){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
756 die "Option '--mbias_only' skips all sorts of methylation extraction, including the bedGraph generation. Please respecify!\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
757 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
758 if ($cytosine_report){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
759 die "Option '--mbias_only' skips all sorts of methylation extraction, including the genome-wide cytosine methylation report generation. Please respecify!\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
760 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
761 if ($merge_non_CpG){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
762 warn "Option '--mbias_only' skips all sorts of methylation extraction, thus '--merge' won't have any effect\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
763 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
764 if ($full){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
765 warn "Option '--mbias_only' skips all sorts of methylation extraction, thus '--comprehensive' won't have any effect\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
766 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
767 sleep(3); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
768 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
769 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
770 ### PRINT A REPORT |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
771 unless ($report){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
772 $report = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
773 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
774 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
775 ### OUTPUT DIR PATH |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
776 if ($output_dir){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
777 unless ($output_dir =~ /\/$/){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
778 $output_dir =~ s/$/\//; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
779 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
780 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
781 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
782 $output_dir = ''; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
783 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
784 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
785 ### NO HEADER |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
786 unless ($no_header){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
787 $no_header = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
788 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
789 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
790 ### OLD (VANILLA) OUTPUT FORMAT |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
791 unless ($vanilla){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
792 $vanilla = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
793 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
794 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
795 if ($single_end){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
796 $paired_end = 0; ### SINGLE END ALIGNMENTS |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
797 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
798 elsif ($paired_end){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
799 $single_end = 0; ### PAIRED-END ALIGNMENTS |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
800 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
801 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
802 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
803 ### we will try to determine whether the input file was a single-end or paired-end sequencing run from the SAM header |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
804 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
805 if ($vanilla){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
806 die "Please specify whether the supplied file(s) are in Bismark single-end or paired-end format with '-s' or '-p'\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
807 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
808 else{ # SAM/BAM format |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
809 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
810 my $file = $filenames[0]; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
811 warn "Trying to determine the type of mapping from the SAM header line of file $file\n"; sleep(1); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
812 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
813 ### if the user did not specify whether the alignment file was single-end or paired-end we are trying to get this information from the @PG header line in the SAM/BAM file |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
814 if ($file =~ /\.gz$/){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
815 open (DETERMINE,"zcat $file |") or die "Unable to read from gzipped file $file: $!\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
816 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
817 elsif ($file =~ /\.bam$/ || `file -b $file` =~ /^gzip/){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
818 open (DETERMINE,"samtools view -h $file |") or die "Unable to read from BAM file $file: $!\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
819 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
820 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
821 open (DETERMINE,$file) or die "Unable to read from $file: $!\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
822 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
823 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
824 while (<DETERMINE>){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
825 last unless (/^\@/); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
826 if ($_ =~ /^\@PG/){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
827 # warn "found the \@PG line:\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
828 # warn "$_"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
829 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
830 if ($_ =~ /-1/ and $_ =~ /-2/){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
831 warn "Treating file(s) as paired-end data (as extracted from \@PG line)\n\n"; sleep(1); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
832 $paired_end = 1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
833 $single_end = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
834 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
835 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
836 warn "Treating file(s) as single-end data (as extracted from \@PG line)\n\n"; sleep(1); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
837 $paired_end = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
838 $single_end = 1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
839 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
840 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
841 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
842 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
843 close DETERMINE or warn $!; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
844 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
845 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
846 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
847 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
848 ### IGNORING <INT> bases at the start of the read when processing the methylation call string |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
849 unless ($ignore){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
850 $ignore = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
851 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
852 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
853 if (defined $ignore_r2){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
854 die "You can only specify --ignore_r2 for paired-end result files\n" unless ($paired_end); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
855 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
856 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
857 $ignore_r2 = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
858 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
859 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
860 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
861 ### NO OVERLAP |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
862 if ($no_overlap){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
863 die "The option '--no_overlap' can only be specified for paired-end input!\n" unless ($paired_end); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
864 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
865 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
866 $no_overlap = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
867 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
868 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
869 ### COMPREHENSIVE OUTPUT |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
870 unless ($full){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
871 $full = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
872 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
873 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
874 ### MERGE NON-CpG context |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
875 unless ($merge_non_CpG){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
876 $merge_non_CpG = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
877 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
878 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
879 ### remove white spaces in read ID (needed for sorting using the sort command |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
880 unless ($remove){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
881 $remove = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
882 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
883 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
884 ### COVERAGE THRESHOLD FOR bedGraph OUTPUT |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
885 if (defined $coverage_threshold){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
886 unless ($coverage_threshold > 0){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
887 die "Please select a coverage greater than 0 (positive integers only)\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
888 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
889 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
890 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
891 $coverage_threshold = 1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
892 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
893 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
894 ### SORT buffer size |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
895 if (defined $sort_size){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
896 unless ($sort_size =~ /^\d+\%$/ or $sort_size =~ /^\d+(K|M|G|T)$/){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
897 die "Please select a buffer size as percentage (e.g. --buffer_size 20%) or a number to be multiplied with K, M, G, T etc. (e.g. --buffer_size 20G). For more information on sort type 'info sort' on a command line\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
898 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
899 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
900 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
901 $sort_size = '2G'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
902 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
903 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
904 if ($zero){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
905 die "Option '--zero' is only available if '--cytosine_report' is specified as well. Please respecify\n" unless ($cytosine_report); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
906 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
907 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
908 if ($CX_context){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
909 die "Option '--CX_context' is only available if '--cytosine_report' or '--bedGraph' is specified as well. Please respecify\n" unless ($cytosine_report or $bedGraph); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
910 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
911 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
912 $CX_context = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
913 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
914 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
915 unless ($counts){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
916 $counts = 1; # counts will always be set |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
917 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
918 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
919 if ($cytosine_report){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
920 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
921 ### GENOME folder |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
922 if ($genome_folder){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
923 unless ($genome_folder =~/\/$/){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
924 $genome_folder =~ s/$/\//; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
925 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
926 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
927 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
928 die "Please specify a genome folder to proceed (full path only)\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
929 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
930 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
931 unless ($bedGraph){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
932 warn "Setting the option '--bedGraph' since this is required for the genome-wide cytosine report\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
933 $bedGraph = 1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
934 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
935 unless ($counts){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
936 # warn "Setting the option '--counts' since this is required for the genome-wide cytosine report\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
937 $counts = 1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
938 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
939 warn "\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
940 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
941 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
942 ### PATH TO SAMTOOLS |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
943 if (defined $samtools_path){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
944 # if Samtools was specified as full command |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
945 if ($samtools_path =~ /samtools$/){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
946 if (-e $samtools_path){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
947 # Samtools executable found |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
948 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
949 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
950 die "Could not find an installation of Samtools at the location $samtools_path. Please respecify\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
951 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
952 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
953 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
954 unless ($samtools_path =~ /\/$/){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
955 $samtools_path =~ s/$/\//; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
956 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
957 $samtools_path .= 'samtools'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
958 if (-e $samtools_path){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
959 # Samtools executable found |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
960 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
961 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
962 die "Could not find an installation of Samtools at the location $samtools_path. Please respecify\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
963 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
964 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
965 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
966 # Check whether Samtools is in the PATH if no path was supplied by the user |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
967 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
968 if (!system "which samtools >/dev/null 2>&1"){ # STDOUT is binned, STDERR is redirected to STDOUT. Returns 0 if Samtools is in the PATH |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
969 $samtools_path = `which samtools`; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
970 chomp $samtools_path; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
971 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
972 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
973 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
974 unless (defined $samtools_path){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
975 $samtools_path = ''; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
976 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
977 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
978 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
979 if ($gazillion){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
980 if ($ample_mem){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
981 die "You can't currently select '--ample_mem' together with '--gazillion'. Make your pick!\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
982 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
983 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
984 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
985 return ($ignore,$genomic_fasta,$single_end,$paired_end,$full,$report,$no_overlap,$merge_non_CpG,$vanilla,$output_dir,$no_header,$bedGraph,$remove,$coverage_threshold,$counts,$cytosine_report,$genome_folder,$zero,$CpG_only,$CX_context,$split_by_chromosome,$sort_size,$samtools_path,$gzip,$ignore_r2,$mbias_only,$gazillion,$ample_mem); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
986 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
987 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
988 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
989 sub test_positional_sorting{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
990 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
991 my $filename = shift; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
992 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
993 print "\nNow testing Bismark result file $filename for positional sorting (which would be bad...)\t"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
994 sleep(1); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
995 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
996 if ($filename =~ /\.gz$/) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
997 open (TEST,"zcat $filename |") or die "Can't open gzipped file $filename: $!\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
998 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
999 elsif ($filename =~ /bam$/ || `file -b $filename` =~ /^gzip/) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1000 if ($samtools_path){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1001 open (TEST,"$samtools_path view -h $filename |") or die "Can't open BAM file $filename: $!\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1002 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1003 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1004 die "Sorry couldn't find an installation of Samtools. Either specifiy an alternative path using the option '--samtools_path /your/path/', or use a SAM file instead\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1005 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1006 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1007 else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1008 open (TEST,$filename) or die "Can't open file $filename: $!\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1009 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1010 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1011 my $count = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1012 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1013 while (<TEST>) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1014 if (/^\@/) { # testing header lines if they contain the @SO flag (for being sorted) |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1015 if (/^\@SO/) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1016 die "SAM/BAM header line '$_' indicates that the Bismark aligment file has been sorted by chromosomal positions which is is incompatible with correct methylation extraction. Please use an unsorted file instead\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1017 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1018 next; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1019 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1020 $count++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1021 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1022 last if ($count > 100000); # else we test the first 100000 sequences if they start with the same read ID |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1023 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1024 my ($id_1) = (split (/\t/)); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1025 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1026 ### reading the next line which should be read 2 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1027 $_ = <TEST>; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1028 my ($id_2) = (split (/\t/)); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1029 last unless ($id_2); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1030 ++$count; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1031 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1032 if ($id_1 eq $id_2){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1033 ### ids are the same |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1034 next; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1035 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1036 else{ ### in previous versions of Bismark we appended /1 and /2 to the read IDs for easier eyeballing which read is which. These tags need to be removed first |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1037 my $id_1_trunc = $id_1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1038 $id_1_trunc =~ s/\/1$//; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1039 my $id_2_trunc = $id_2; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1040 $id_2_trunc =~ s/\/2$//; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1041 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1042 unless ($id_1_trunc eq $id_2_trunc){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1043 die "The IDs of Read 1 ($id_1) and Read 2 ($id_2) are not the same. This might be a result of sorting the paired-end SAM/BAM files by chromosomal position which is not compatible with correct methylation extraction. Please use an unsorted file instead\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1044 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1045 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1046 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1047 # close TEST or die $!; somehow fails on our cluster... |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1048 ### If it hasen't died so far then it seems the file is in the correct Bismark format (read 1 and read 2 of a pair directly following each other) |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1049 warn "...passed!\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1050 sleep(1); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1051 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1052 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1053 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1054 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1055 sub process_Bismark_results_file{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1056 my $filename = shift; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1057 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1058 warn "\nNow reading in Bismark result file $filename\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1059 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1060 if ($filename =~ /\.gz$/) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1061 open (IN,"zcat $filename |") or die "Can't open gzipped file $filename: $!\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1062 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1063 elsif ($filename =~ /bam$/ || `file -b $filename` =~ /^gzip/) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1064 if ($samtools_path){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1065 open (IN,"$samtools_path view -h $filename |") or die "Can't open BAM file $filename: $!\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1066 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1067 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1068 die "Sorry couldn't find an installation of Samtools. Either specifiy an alternative path using the option '--samtools_path /your/path/', or use a SAM file instead\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1069 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1070 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1071 else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1072 open (IN,$filename) or die "Can't open file $filename: $!\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1073 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1074 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1075 ### Vanilla and SAM output need to read different numbers of header lines |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1076 if ($vanilla) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1077 my $bismark_version = <IN>; ## discarding the Bismark version info |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1078 chomp $bismark_version; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1079 $bismark_version =~ s/\r//; # replaces \r line feed |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1080 $bismark_version =~ s/Bismark version: //; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1081 if ($bismark_version =~ /^\@/) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1082 warn "Detected \@ as the first character of the version information. Is it possible that the file is in SAM format?\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1083 sleep (2); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1084 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1085 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1086 unless ($version eq $bismark_version){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1087 die "The methylation extractor and Bismark itself need to be of the same version!\n\nVersions used:\nmethylation extractor: '$version'\nBismark: '$bismark_version'\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1088 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1089 } else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1090 # If the read is in SAM format (default) it can either start with @ header lines or start with alignments directly. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1091 # We are reading from it further down |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1092 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1093 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1094 my $output_filename = (split (/\//,$filename))[-1]; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1095 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1096 ### OPENING OUTPUT-FILEHANDLES |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1097 if ($report) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1098 my $report_filename = $output_filename; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1099 $report_filename =~ s/\.sam$//; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1100 $report_filename =~ s/\.txt$//; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1101 $report_filename =~ s/$/_splitting_report.txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1102 $report_filename = $output_dir . $report_filename; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1103 open (REPORT,'>',$report_filename) or die "Failed to write to file $report_filename $!\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1104 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1105 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1106 if ($report) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1107 print REPORT "$output_filename\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1108 print REPORT "Parameters used to extract methylation information:\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1109 if ($paired) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1110 if ($vanilla) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1111 print REPORT "Bismark result file: paired-end (vanilla Bismark format)\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1112 } else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1113 print REPORT "Bismark result file: paired-end (SAM format)\n"; # default |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1114 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1115 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1116 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1117 if ($single) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1118 if ($vanilla) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1119 print REPORT "Bismark result file: single-end (vanilla Bismark format)\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1120 } else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1121 print REPORT "Bismark result file: single-end (SAM format)\n"; # default |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1122 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1123 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1124 if ($single){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1125 if ($ignore) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1126 print REPORT "Ignoring first $ignore bp\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1127 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1128 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1129 else{ # paired-end |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1130 if ($ignore) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1131 print REPORT "Ignoring first $ignore bp of Read 1\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1132 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1133 if ($ignore_r2){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1134 print REPORT "Ignoring first $ignore_r2 bp of Read 2\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1135 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1136 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1137 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1138 if ($full) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1139 print REPORT "Output specified: comprehensive\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1140 } else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1141 print REPORT "Output specified: strand-specific (default)\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1142 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1143 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1144 if ($no_overlap) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1145 print REPORT "No overlapping methylation calls specified\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1146 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1147 if ($genomic_fasta) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1148 print REPORT "Genomic equivalent sequences will be printed out in FastA format\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1149 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1150 if ($merge_non_CpG) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1151 print REPORT "Methylation in CHG and CHH context will be merged into \"non-CpG context\" output\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1152 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1153 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1154 print REPORT "\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1155 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1156 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1157 ##### open (OUT,"| gzip -c - > $output_dir$outfile") or die "Failed to write to $outfile: $!\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1158 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1159 ### CpG-context and non-CpG context. THIS SECTION IS OPTIONAL |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1160 ### if --comprehensive AND --merge_non_CpG was specified we are only writing out one CpG-context and one Any-Other-context result file |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1161 if ($full and $merge_non_CpG) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1162 my $cpg_output = my $other_c_output = $output_filename; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1163 ### C in CpG context |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1164 $cpg_output =~ s/^/CpG_context_/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1165 $cpg_output =~ s/sam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1166 $cpg_output =~ s/bam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1167 $cpg_output =~ s/$/.txt/ unless ($cpg_output =~ /\.txt$/); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1168 $cpg_output = $output_dir . $cpg_output; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1169 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1170 if ($gzip){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1171 $cpg_output .= '.gz'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1172 open ($fhs{CpG_context},"| gzip -c - > $cpg_output") or die "Failed to write to $cpg_output $! \n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1173 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1174 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1175 open ($fhs{CpG_context},'>',$cpg_output) or die "Failed to write to $cpg_output $! \n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1176 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1177 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1178 warn "Writing result file containing methylation information for C in CpG context to $cpg_output\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1179 push @sorting_files,$cpg_output; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1180 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1181 unless ($no_header) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1182 print {$fhs{CpG_context}} "Bismark methylation extractor version $version\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1183 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1184 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1185 ### C in any other context than CpG |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1186 $other_c_output =~ s/^/Non_CpG_context_/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1187 $other_c_output =~ s/sam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1188 $other_c_output =~ s/bam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1189 $other_c_output =~ s/$/.txt/ unless ($other_c_output =~ /\.txt$/); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1190 $other_c_output = $output_dir . $other_c_output; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1191 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1192 if ($gzip){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1193 $other_c_output .= '.gz'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1194 open ($fhs{other_context},"| gzip -c - > $other_c_output") or die "Failed to write to $other_c_output $! \n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1195 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1196 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1197 open ($fhs{other_context},'>',$other_c_output) or die "Failed to write to $other_c_output $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1198 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1199 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1200 warn "Writing result file containing methylation information for C in any other context to $other_c_output\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1201 push @sorting_files,$other_c_output; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1202 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1203 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1204 unless ($no_header) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1205 print {$fhs{other_context}} "Bismark methylation extractor version $version\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1206 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1207 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1208 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1209 ### if only --merge_non_CpG was specified we will write out 8 different output files, depending on where the (first) unique best alignment has been found |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1210 elsif ($merge_non_CpG) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1211 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1212 my $cpg_ot = my $cpg_ctot = my $cpg_ctob = my $cpg_ob = $output_filename; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1213 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1214 ### For cytosines in CpG context |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1215 $cpg_ot =~ s/^/CpG_OT_/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1216 $cpg_ot =~ s/sam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1217 $cpg_ot =~ s/bam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1218 $cpg_ot =~ s/$/.txt/ unless ($cpg_ot =~ /\.txt$/); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1219 $cpg_ot = $output_dir . $cpg_ot; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1220 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1221 if ($gzip){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1222 $cpg_ot .= '.gz'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1223 open ($fhs{0}->{CpG},"| gzip -c - > $cpg_ot") or die "Failed to write to $cpg_ot $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1224 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1225 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1226 open ($fhs{0}->{CpG},'>',$cpg_ot) or die "Failed to write to $cpg_ot $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1227 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1228 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1229 warn "Writing result file containing methylation information for C in CpG context from the original top strand to $cpg_ot\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1230 push @sorting_files,$cpg_ot; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1231 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1232 unless($no_header){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1233 print {$fhs{0}->{CpG}} "Bismark methylation extractor version $version\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1234 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1235 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1236 $cpg_ctot =~ s/^/CpG_CTOT_/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1237 $cpg_ctot =~ s/sam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1238 $cpg_ctot =~ s/bam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1239 $cpg_ctot =~ s/$/.txt/ unless ($cpg_ctot =~ /\.txt$/); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1240 $cpg_ctot = $output_dir . $cpg_ctot; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1241 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1242 if ($gzip){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1243 $cpg_ctot .= '.gz'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1244 open ($fhs{1}->{CpG},"| gzip -c - > $cpg_ctot") or die "Failed to write to $cpg_ctot $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1245 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1246 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1247 open ($fhs{1}->{CpG},'>',$cpg_ctot) or die "Failed to write to $cpg_ctot $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1248 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1249 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1250 warn "Writing result file containing methylation information for C in CpG context from the complementary to original top strand to $cpg_ctot\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1251 push @sorting_files,$cpg_ctot; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1252 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1253 unless($no_header){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1254 print {$fhs{1}->{CpG}} "Bismark methylation extractor version $version\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1255 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1256 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1257 $cpg_ctob =~ s/^/CpG_CTOB_/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1258 $cpg_ctob =~ s/sam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1259 $cpg_ctob =~ s/bam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1260 $cpg_ctob =~ s/$/.txt/ unless ($cpg_ctob =~ /\.txt$/); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1261 $cpg_ctob = $output_dir . $cpg_ctob; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1262 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1263 if ($gzip){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1264 $cpg_ctob .= '.gz'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1265 open ($fhs{2}->{CpG},"| gzip -c - > $cpg_ctob") or die "Failed to write to $cpg_ctob $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1266 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1267 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1268 open ($fhs{2}->{CpG},'>',$cpg_ctob) or die "Failed to write to $cpg_ctob $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1269 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1270 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1271 warn "Writing result file containing methylation information for C in CpG context from the complementary to original bottom strand to $cpg_ctob\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1272 push @sorting_files,$cpg_ctob; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1273 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1274 unless($no_header){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1275 print {$fhs{2}->{CpG}} "Bismark methylation extractor version $version\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1276 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1277 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1278 $cpg_ob =~ s/^/CpG_OB_/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1279 $cpg_ob =~ s/sam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1280 $cpg_ob =~ s/bam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1281 $cpg_ob =~ s/$/.txt/ unless ($cpg_ob =~ /\.txt$/); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1282 $cpg_ob = $output_dir . $cpg_ob; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1283 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1284 if ($gzip){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1285 $cpg_ob .= '.gz'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1286 open ($fhs{3}->{CpG},"| gzip -c - > $cpg_ob") or die "Failed to write to $cpg_ob $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1287 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1288 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1289 open ($fhs{3}->{CpG},'>',$cpg_ob) or die "Failed to write to $cpg_ob $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1290 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1291 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1292 warn "Writing result file containing methylation information for C in CpG context from the original bottom strand to $cpg_ob\n\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1293 push @sorting_files,$cpg_ob; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1294 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1295 unless($no_header){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1296 print {$fhs{3}->{CpG}} "Bismark methylation extractor version $version\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1297 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1298 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1299 ### For cytosines in Non-CpG (CC, CT or CA) context |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1300 my $other_c_ot = my $other_c_ctot = my $other_c_ctob = my $other_c_ob = $output_filename; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1301 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1302 $other_c_ot =~ s/^/Non_CpG_OT_/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1303 $other_c_ot =~ s/sam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1304 $other_c_ot =~ s/bam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1305 $other_c_ot =~ s/$/.txt/ unless ($other_c_ot =~ /\.txt$/); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1306 $other_c_ot = $output_dir . $other_c_ot; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1307 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1308 if ($gzip){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1309 $other_c_ot .= '.gz'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1310 open ($fhs{0}->{other_c},"| gzip -c - > $other_c_ot") or die "Failed to write to $other_c_ot $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1311 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1312 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1313 open ($fhs{0}->{other_c},'>',$other_c_ot) or die "Failed to write to $other_c_ot $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1314 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1315 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1316 warn "Writing result file containing methylation information for C in any other context from the original top strand to $other_c_ot\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1317 push @sorting_files,$other_c_ot; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1318 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1319 unless($no_header){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1320 print {$fhs{0}->{other_c}} "Bismark methylation extractor version $version\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1321 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1322 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1323 $other_c_ctot =~ s/^/Non_CpG_CTOT_/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1324 $other_c_ctot =~ s/sam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1325 $other_c_ctot =~ s/bam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1326 $other_c_ctot =~ s/$/.txt/ unless ($other_c_ctot =~ /\.txt$/); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1327 $other_c_ctot = $output_dir . $other_c_ctot; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1328 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1329 if ($gzip){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1330 $other_c_ctot .= '.gz'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1331 open ($fhs{1}->{other_c},"| gzip -c - > $other_c_ctot") or die "Failed to write to $other_c_ctot $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1332 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1333 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1334 open ($fhs{1}->{other_c},'>',$other_c_ctot) or die "Failed to write to $other_c_ctot $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1335 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1336 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1337 warn "Writing result file containing methylation information for C in any other context from the complementary to original top strand to $other_c_ctot\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1338 push @sorting_files,$other_c_ctot; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1339 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1340 unless($no_header){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1341 print {$fhs{1}->{other_c}} "Bismark methylation extractor version $version\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1342 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1343 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1344 $other_c_ctob =~ s/^/Non_CpG_CTOB_/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1345 $other_c_ctob =~ s/sam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1346 $other_c_ctob =~ s/bam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1347 $other_c_ctob =~ s/$/.txt/ unless ($other_c_ctob =~ /\.txt$/); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1348 $other_c_ctob = $output_dir . $other_c_ctob; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1349 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1350 if ($gzip){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1351 $other_c_ctob .= '.gz'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1352 open ($fhs{2}->{other_c},"| gzip -c - > $other_c_ctob") or die "Failed to write to $other_c_ctob $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1353 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1354 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1355 open ($fhs{2}->{other_c},'>',$other_c_ctob) or die "Failed to write to $other_c_ctob $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1356 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1357 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1358 warn "Writing result file containing methylation information for C in any other context from the complementary to original bottom strand to $other_c_ctob\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1359 push @sorting_files,$other_c_ctob; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1360 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1361 unless($no_header){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1362 print {$fhs{2}->{other_c}} "Bismark methylation extractor version $version\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1363 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1364 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1365 $other_c_ob =~ s/^/Non_CpG_OB_/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1366 $other_c_ob =~ s/sam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1367 $other_c_ob =~ s/sam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1368 $other_c_ob =~ s/$/.txt/ unless ($other_c_ob =~ /\.txt$/); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1369 $other_c_ob = $output_dir . $other_c_ob; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1370 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1371 if ($gzip){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1372 $other_c_ob .= '.gz'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1373 open ($fhs{3}->{other_c},"| gzip -c - > $other_c_ob") or die "Failed to write to $other_c_ob $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1374 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1375 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1376 open ($fhs{3}->{other_c},'>',$other_c_ob) or die "Failed to write to $other_c_ob $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1377 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1378 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1379 warn "Writing result file containing methylation information for C in any other context from the original bottom strand to $other_c_ob\n\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1380 push @sorting_files,$other_c_ob; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1381 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1382 unless($no_header){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1383 print {$fhs{3}->{other_c}} "Bismark methylation extractor version $version\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1384 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1385 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1386 ### THIS SECTION IS THE DEFAULT (CpG, CHG and CHH context) |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1387 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1388 ### if --comprehensive was specified we are only writing one file per context |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1389 elsif ($full) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1390 my $cpg_output = my $chg_output = my $chh_output = $output_filename; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1391 ### C in CpG context |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1392 $cpg_output =~ s/^/CpG_context_/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1393 $cpg_output =~ s/sam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1394 $cpg_output =~ s/bam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1395 $cpg_output =~ s/$/.txt/ unless ($cpg_output =~ /\.txt$/); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1396 $cpg_output = $output_dir . $cpg_output; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1397 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1398 if ($gzip){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1399 $cpg_output .= '.gz'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1400 open ($fhs{CpG_context},"| gzip -c - > $cpg_output") or die "Failed to write to $cpg_output $! \n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1401 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1402 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1403 open ($fhs{CpG_context},'>',$cpg_output) or die "Failed to write to $cpg_output $! \n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1404 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1405 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1406 warn "Writing result file containing methylation information for C in CpG context to $cpg_output\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1407 push @sorting_files,$cpg_output; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1408 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1409 unless($no_header){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1410 print {$fhs{CpG_context}} "Bismark methylation extractor version $version\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1411 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1412 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1413 ### C in CHG context |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1414 $chg_output =~ s/^/CHG_context_/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1415 $chg_output =~ s/sam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1416 $chg_output =~ s/bam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1417 $chg_output =~ s/$/.txt/ unless ($chg_output =~ /\.txt$/); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1418 $chg_output = $output_dir . $chg_output; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1419 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1420 if ($gzip){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1421 $chg_output .= '.gz'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1422 open ($fhs{CHG_context},"| gzip -c - > $chg_output") or die "Failed to write to $chg_output $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1423 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1424 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1425 open ($fhs{CHG_context},'>',$chg_output) or die "Failed to write to $chg_output $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1426 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1427 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1428 warn "Writing result file containing methylation information for C in CHG context to $chg_output\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1429 push @sorting_files,$chg_output; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1430 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1431 unless($no_header){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1432 print {$fhs{CHG_context}} "Bismark methylation extractor version $version\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1433 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1434 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1435 ### C in CHH context |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1436 $chh_output =~ s/^/CHH_context_/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1437 $chh_output =~ s/sam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1438 $chh_output =~ s/bam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1439 $chh_output =~ s/$/.txt/ unless ($chh_output =~ /\.txt$/); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1440 $chh_output = $output_dir . $chh_output; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1441 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1442 if ($gzip){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1443 $chh_output .= '.gz'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1444 open ($fhs{CHH_context},"| gzip -c - > $chh_output") or die "Failed to write to $chh_output $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1445 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1446 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1447 open ($fhs{CHH_context},'>',$chh_output) or die "Failed to write to $chh_output $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1448 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1449 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1450 warn "Writing result file containing methylation information for C in CHH context to $chh_output\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1451 push @sorting_files, $chh_output; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1452 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1453 unless($no_header){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1454 print {$fhs{CHH_context}} "Bismark methylation extractor version $version\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1455 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1456 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1457 ### else we will write out 12 different output files, depending on where the (first) unique best alignment was found |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1458 else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1459 my $cpg_ot = my $cpg_ctot = my $cpg_ctob = my $cpg_ob = $output_filename; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1460 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1461 ### For cytosines in CpG context |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1462 $cpg_ot =~ s/^/CpG_OT_/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1463 $cpg_ot =~ s/sam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1464 $cpg_ot =~ s/bam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1465 $cpg_ot =~ s/$/.txt/ unless ($cpg_ot =~ /\.txt$/); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1466 $cpg_ot = $output_dir . $cpg_ot; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1467 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1468 if ($gzip){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1469 $cpg_ot .= '.gz'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1470 open ($fhs{0}->{CpG},"| gzip -c - > $cpg_ot") or die "Failed to write to $cpg_ot $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1471 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1472 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1473 open ($fhs{0}->{CpG},'>',$cpg_ot) or die "Failed to write to $cpg_ot $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1474 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1475 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1476 warn "Writing result file containing methylation information for C in CpG context from the original top strand to $cpg_ot\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1477 push @sorting_files,$cpg_ot; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1478 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1479 unless($no_header){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1480 print {$fhs{0}->{CpG}} "Bismark methylation extractor version $version\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1481 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1482 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1483 $cpg_ctot =~ s/^/CpG_CTOT_/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1484 $cpg_ctot =~ s/sam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1485 $cpg_ctot =~ s/bam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1486 $cpg_ctot =~ s/$/.txt/ unless ($cpg_ctot =~ /\.txt$/); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1487 $cpg_ctot = $output_dir . $cpg_ctot; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1488 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1489 if ($gzip){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1490 $cpg_ctot .= '.gz'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1491 open ($fhs{1}->{CpG},"| gzip -c - > $cpg_ctot") or die "Failed to write to $cpg_ctot $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1492 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1493 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1494 open ($fhs{1}->{CpG},'>',$cpg_ctot) or die "Failed to write to $cpg_ctot $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1495 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1496 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1497 warn "Writing result file containing methylation information for C in CpG context from the complementary to original top strand to $cpg_ctot\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1498 push @sorting_files,$cpg_ctot; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1499 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1500 unless($no_header){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1501 print {$fhs{1}->{CpG}} "Bismark methylation extractor version $version\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1502 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1503 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1504 $cpg_ctob =~ s/^/CpG_CTOB_/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1505 $cpg_ctob =~ s/sam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1506 $cpg_ctob =~ s/bam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1507 $cpg_ctob =~ s/$/.txt/ unless ($cpg_ctob =~ /\.txt$/); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1508 $cpg_ctob = $output_dir . $cpg_ctob; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1509 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1510 if ($gzip){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1511 $cpg_ctob .= '.gz'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1512 open ($fhs{2}->{CpG},"| gzip -c - > $cpg_ctob") or die "Failed to write to $cpg_ctob $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1513 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1514 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1515 open ($fhs{2}->{CpG},'>',$cpg_ctob) or die "Failed to write to $cpg_ctob $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1516 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1517 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1518 warn "Writing result file containing methylation information for C in CpG context from the complementary to original bottom strand to $cpg_ctob\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1519 push @sorting_files,$cpg_ctob; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1520 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1521 unless($no_header){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1522 print {$fhs{2}->{CpG}} "Bismark methylation extractor version $version\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1523 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1524 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1525 $cpg_ob =~ s/^/CpG_OB_/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1526 $cpg_ob =~ s/sam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1527 $cpg_ob =~ s/bam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1528 $cpg_ob =~ s/$/.txt/ unless ($cpg_ob =~ /\.txt$/); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1529 $cpg_ob = $output_dir . $cpg_ob; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1530 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1531 if ($gzip){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1532 $cpg_ob .= '.gz'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1533 open ($fhs{3}->{CpG},"| gzip -c - > $cpg_ob") or die "Failed to write to $cpg_ob $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1534 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1535 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1536 open ($fhs{3}->{CpG},'>',$cpg_ob) or die "Failed to write to $cpg_ob $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1537 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1538 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1539 warn "Writing result file containing methylation information for C in CpG context from the original bottom strand to $cpg_ob\n\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1540 push @sorting_files,$cpg_ob; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1541 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1542 unless($no_header){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1543 print {$fhs{3}->{CpG}} "Bismark methylation extractor version $version\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1544 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1545 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1546 ### For cytosines in CHG context |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1547 my $chg_ot = my $chg_ctot = my $chg_ctob = my $chg_ob = $output_filename; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1548 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1549 $chg_ot =~ s/^/CHG_OT_/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1550 $chg_ot =~ s/sam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1551 $chg_ot =~ s/bam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1552 $chg_ot =~ s/$/.txt/ unless ($chg_ot =~ /\.txt$/); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1553 $chg_ot = $output_dir . $chg_ot; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1554 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1555 if ($gzip){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1556 $chg_ot .= '.gz'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1557 open ($fhs{0}->{CHG},"| gzip -c - > $chg_ot") or die "Failed to write to $chg_ot $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1558 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1559 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1560 open ($fhs{0}->{CHG},'>',$chg_ot) or die "Failed to write to $chg_ot $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1561 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1562 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1563 warn "Writing result file containing methylation information for C in CHG context from the original top strand to $chg_ot\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1564 push @sorting_files,$chg_ot; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1565 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1566 unless($no_header){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1567 print {$fhs{0}->{CHG}} "Bismark methylation extractor version $version\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1568 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1569 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1570 $chg_ctot =~ s/^/CHG_CTOT_/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1571 $chg_ctot =~ s/sam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1572 $chg_ctot =~ s/bam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1573 $chg_ctot =~ s/$/.txt/ unless ($chg_ctot =~ /\.txt$/); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1574 $chg_ctot = $output_dir . $chg_ctot; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1575 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1576 if ($gzip){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1577 $chg_ctot .= '.gz'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1578 open ($fhs{1}->{CHG},"| gzip -c - > $chg_ctot") or die "Failed to write to $chg_ctot $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1579 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1580 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1581 open ($fhs{1}->{CHG},'>',$chg_ctot) or die "Failed to write to $chg_ctot $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1582 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1583 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1584 warn "Writing result file containing methylation information for C in CHG context from the complementary to original top strand to $chg_ctot\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1585 push @sorting_files,$chg_ctot; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1586 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1587 unless($no_header){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1588 print {$fhs{1}->{CHG}} "Bismark methylation extractor version $version\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1589 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1590 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1591 $chg_ctob =~ s/^/CHG_CTOB_/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1592 $chg_ctob =~ s/sam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1593 $chg_ctob =~ s/bam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1594 $chg_ctob =~ s/$/.txt/ unless ($chg_ctob =~ /\.txt$/); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1595 $chg_ctob = $output_dir . $chg_ctob; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1596 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1597 if ($gzip){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1598 $chg_ctob .= '.gz'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1599 open ($fhs{2}->{CHG},"| gzip -c - > $chg_ctob") or die "Failed to write to $chg_ctob $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1600 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1601 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1602 open ($fhs{2}->{CHG},'>',$chg_ctob) or die "Failed to write to $chg_ctob $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1603 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1604 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1605 warn "Writing result file containing methylation information for C in CHG context from the complementary to original bottom strand to $chg_ctob\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1606 push @sorting_files,$chg_ctob; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1607 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1608 unless($no_header){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1609 print {$fhs{2}->{CHG}} "Bismark methylation extractor version $version\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1610 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1611 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1612 $chg_ob =~ s/^/CHG_OB_/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1613 $chg_ob =~ s/sam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1614 $chg_ob =~ s/bam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1615 $chg_ob =~ s/$/.txt/ unless ($chg_ob =~ /\.txt$/); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1616 $chg_ob = $output_dir . $chg_ob; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1617 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1618 if ($gzip){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1619 $chg_ob .= '.gz'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1620 open ($fhs{3}->{CHG},"| gzip -c - > $chg_ob") or die "Failed to write to $chg_ob $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1621 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1622 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1623 open ($fhs{3}->{CHG},'>',$chg_ob) or die "Failed to write to $chg_ob $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1624 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1625 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1626 warn "Writing result file containing methylation information for C in CHG context from the original bottom strand to $chg_ob\n\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1627 push @sorting_files,$chg_ob; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1628 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1629 unless($no_header){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1630 print {$fhs{3}->{CHG}} "Bismark methylation extractor version $version\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1631 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1632 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1633 ### For cytosines in CHH context |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1634 my $chh_ot = my $chh_ctot = my $chh_ctob = my $chh_ob = $output_filename; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1635 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1636 $chh_ot =~ s/^/CHH_OT_/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1637 $chh_ot =~ s/sam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1638 $chh_ot =~ s/bam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1639 $chh_ot =~ s/$/.txt/ unless ($chh_ot =~ /\.txt$/); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1640 $chh_ot = $output_dir . $chh_ot; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1641 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1642 if ($gzip){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1643 $chh_ot .= '.gz'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1644 open ($fhs{0}->{CHH},"| gzip -c - > $chh_ot") or die "Failed to write to $chh_ot $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1645 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1646 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1647 open ($fhs{0}->{CHH},'>',$chh_ot) or die "Failed to write to $chh_ot $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1648 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1649 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1650 warn "Writing result file containing methylation information for C in CHH context from the original top strand to $chh_ot\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1651 push @sorting_files,$chh_ot; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1652 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1653 unless($no_header){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1654 print {$fhs{0}->{CHH}} "Bismark methylation extractor version $version\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1655 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1656 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1657 $chh_ctot =~ s/^/CHH_CTOT_/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1658 $chh_ctot =~ s/sam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1659 $chh_ctot =~ s/bam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1660 $chh_ctot =~ s/$/.txt/ unless ($chh_ctot =~ /\.txt$/); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1661 $chh_ctot = $output_dir . $chh_ctot; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1662 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1663 if ($gzip){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1664 $chh_ctot .= '.gz'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1665 open ($fhs{1}->{CHH},"| gzip -c - > $chh_ctot") or die "Failed to write to $chh_ctot $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1666 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1667 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1668 open ($fhs{1}->{CHH},'>',$chh_ctot) or die "Failed to write to $chh_ctot $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1669 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1670 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1671 warn "Writing result file containing methylation information for C in CHH context from the complementary to original top strand to $chh_ctot\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1672 push @sorting_files,$chh_ctot; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1673 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1674 unless($no_header){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1675 print {$fhs{1}->{CHH}} "Bismark methylation extractor version $version\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1676 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1677 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1678 $chh_ctob =~ s/^/CHH_CTOB_/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1679 $chh_ctob =~ s/sam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1680 $chh_ctob =~ s/bam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1681 $chh_ctob =~ s/$/.txt/ unless ($chh_ctob =~ /\.txt$/); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1682 $chh_ctob = $output_dir . $chh_ctob; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1683 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1684 if ($gzip){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1685 $chh_ctob .= '.gz'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1686 open ($fhs{2}->{CHH},"| gzip -c - > $chh_ctob") or die "Failed to write to $chh_ctob $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1687 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1688 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1689 open ($fhs{2}->{CHH},'>',$chh_ctob) or die "Failed to write to $chh_ctob $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1690 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1691 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1692 warn "Writing result file containing methylation information for C in CHH context from the complementary to original bottom strand to $chh_ctob\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1693 push @sorting_files,$chh_ctob; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1694 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1695 unless($no_header){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1696 print {$fhs{2}->{CHH}} "Bismark methylation extractor version $version\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1697 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1698 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1699 $chh_ob =~ s/^/CHH_OB_/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1700 $chh_ob =~ s/sam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1701 $chh_ob =~ s/bam$/txt/; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1702 $chh_ob =~ s/$/.txt/ unless ($chh_ob =~ /\.txt$/); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1703 $chh_ob = $output_dir . $chh_ob; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1704 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1705 if ($gzip){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1706 $chh_ob .= '.gz'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1707 open ($fhs{3}->{CHH},"| gzip -c - > $chh_ob") or die "Failed to write to $chh_ob $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1708 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1709 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1710 open ($fhs{3}->{CHH},'>',$chh_ob) or die "Failed to write to $chh_ob $!\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1711 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1712 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1713 warn "Writing result file containing methylation information for C in CHH context from the original bottom strand to $chh_ob\n\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1714 push @sorting_files,$chh_ob; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1715 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1716 unless($no_header){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1717 print {$fhs{3}->{CHH}} "Bismark methylation extractor version $version\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1718 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1719 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1720 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1721 my $methylation_call_strings_processed = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1722 my $line_count = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1723 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1724 ### proceeding differently now for single-end or paired-end Bismark files |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1725 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1726 ### PROCESSING SINGLE-END RESULT FILES |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1727 if ($single) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1728 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1729 ### also proceeding differently now for SAM format or vanilla Bismark format files |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1730 if ($vanilla) { # old vanilla Bismark output format |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1731 while (<IN>) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1732 ++$line_count; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1733 warn "Processed lines: $line_count\n" if ($line_count%500000==0); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1734 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1735 ### $seq here is the chromosomal sequence (to use for the repeat analysis for example) |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1736 my ($id,$strand,$chrom,$start,$seq,$meth_call,$read_conversion,$genome_conversion) = (split("\t"))[0,1,2,3,6,7,8,9]; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1737 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1738 ### we need to remove 2 bp of the genomic sequence as we were extracting read + 2bp long fragments to make a methylation call at the first or |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1739 ### last position |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1740 chomp $genome_conversion; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1741 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1742 my $index; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1743 if ($meth_call) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1744 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1745 if ($read_conversion eq 'CT' and $genome_conversion eq 'CT') { ## original top strand |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1746 $index = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1747 } elsif ($read_conversion eq 'GA' and $genome_conversion eq 'CT') { ## complementary to original top strand |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1748 $index = 1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1749 } elsif ($read_conversion eq 'CT' and $genome_conversion eq 'GA') { ## original bottom strand |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1750 $index = 3; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1751 } elsif ($read_conversion eq 'GA' and $genome_conversion eq 'GA') { ## complementary to original bottom strand |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1752 $index = 2; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1753 } else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1754 die "Unexpected combination of read and genome conversion: '$read_conversion' / '$genome_conversion'\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1755 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1756 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1757 ### Clipping off the first <int> number of bases from the methylation call string as specified with --ignore <int> |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1758 if ($ignore) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1759 $meth_call = substr($meth_call,$ignore,length($meth_call)-$ignore); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1760 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1761 ### If we are clipping off some bases at the start we need to adjust the start position of the alignments accordingly! |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1762 if ($strand eq '+') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1763 $start += $ignore; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1764 } elsif ($strand eq '-') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1765 $start += length($meth_call)-1; ## $meth_call is already shortened! |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1766 } else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1767 die "Alignment did not have proper strand information: $strand\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1768 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1769 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1770 ### printing out the methylation state of every C in the read |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1771 print_individual_C_methylation_states_single_end($meth_call,$chrom,$start,$id,$strand,$index); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1772 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1773 ++$methylation_call_strings_processed; # 1 per single-end result |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1774 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1775 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1776 } else { # processing single-end SAM format (default) |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1777 while (<IN>) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1778 ### SAM format can either start with header lines (starting with @) or start with alignments directly |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1779 if (/^\@/) { # skipping header lines (starting with @) |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1780 warn "skipping SAM header line:\t$_"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1781 next; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1782 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1783 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1784 ++$line_count; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1785 warn "Processed lines: $line_count\n" if ($line_count%500000==0); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1786 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1787 # example read in SAM format |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1788 # 1_R1/1 67 5 103172224 255 40M = 103172417 233 AATATTTTTTTTATTTTAAAATGTGTATTGATTTAAATTT IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII NM:i:4 XX:Z:4T1T24TT7 XM:Z:....h.h........................hh....... XR:Z:CT XG:Z:CT |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1789 ### |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1790 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1791 # < 0.7.6 my ($id,$chrom,$start,$meth_call,$read_conversion,$genome_conversion) = (split("\t"))[0,2,3,13,14,15]; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1792 # < 0.7.6 $meth_call =~ s/^XM:Z://; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1793 # < 0.7.6 $read_conversion =~ s/^XR:Z://; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1794 # < 0.7.6 $genome_conversion =~ s/^XG:Z://; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1795 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1796 my ($id,$chrom,$start,$cigar) = (split("\t"))[0,2,3,5]; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1797 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1798 ### detecting the following SAM flags in case the SAM entry was shuffled by CRAM or Goby compression/decompression |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1799 my $meth_call; ### Thanks to Zachary Zeno for this solution |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1800 my $read_conversion; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1801 my $genome_conversion; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1802 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1803 while ( /(XM|XR|XG):Z:([^\t]+)/g ) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1804 my $tag = $1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1805 my $value = $2; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1806 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1807 if ($tag eq "XM") { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1808 $meth_call = $value; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1809 $meth_call =~ s/\r//; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1810 } elsif ($tag eq "XR") { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1811 $read_conversion = $value; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1812 $read_conversion =~ s/\r//; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1813 } elsif ($tag eq "XG") { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1814 $genome_conversion = $value; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1815 $genome_conversion =~ s/\r//; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1816 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1817 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1818 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1819 my $strand; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1820 chomp $genome_conversion; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1821 # print "$meth_call\n$read_conversion\n$genome_conversion\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1822 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1823 my $index; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1824 if ($meth_call) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1825 if ($read_conversion eq 'CT' and $genome_conversion eq 'CT') { ## original top strand |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1826 $index = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1827 $strand = '+'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1828 } elsif ($read_conversion eq 'GA' and $genome_conversion eq 'CT') { ## complementary to original top strand |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1829 $index = 1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1830 $strand = '-'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1831 } elsif ($read_conversion eq 'GA' and $genome_conversion eq 'GA') { ## complementary to original bottom strand |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1832 $index = 2; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1833 $strand = '+'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1834 } elsif ($read_conversion eq 'CT' and $genome_conversion eq 'GA') { ## original bottom strand |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1835 $index = 3; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1836 $strand = '-'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1837 } else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1838 die "Unexpected combination of read and genome conversion: '$read_conversion' / '$genome_conversion'\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1839 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1840 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1841 ### If the read is in SAM format we need to reverse the methylation call if the read has been reverse-complemented for the output |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1842 if ($strand eq '-') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1843 $meth_call = reverse $meth_call; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1844 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1845 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1846 ### Clipping off the first <int> number of bases from the methylation call string as specified with --ignore <int> |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1847 if ($ignore) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1848 # print "\n\n$meth_call\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1849 $meth_call = substr($meth_call,$ignore,length($meth_call)-$ignore); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1850 # print "$meth_call\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1851 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1852 ### If we are ignoring a part of the sequence we also need to adjust the cigar string accordingly |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1853 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1854 my @len = split (/\D+/,$cigar); # storing the length per operation |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1855 my @ops = split (/\d+/,$cigar); # storing the operation |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1856 shift @ops; # remove the empty first element |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1857 die "CIGAR string contained a non-matching number of lengths and operations\n" unless (scalar @len == scalar @ops); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1858 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1859 my @comp_cigar; # building an array with all CIGAR operations |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1860 foreach my $index (0..$#len) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1861 foreach (1..$len[$index]) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1862 # print "$ops[$index]"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1863 push @comp_cigar, $ops[$index]; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1864 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1865 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1866 # print "original CIGAR: $cigar\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1867 # print "original CIGAR: @comp_cigar\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1868 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1869 ### If we are clipping off some bases at the start we need to adjust the start position of the alignments accordingly! |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1870 if ($strand eq '+') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1871 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1872 my $D_count = 0; # counting all deletions that affect the ignored genomic position, i.e. Deletions and insertions |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1873 my $I_count = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1874 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1875 for (1..$ignore) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1876 my $op = shift @comp_cigar; # adjusting composite CIGAR string by removing $ignore operations from the start |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1877 # print "$_ deleted $op\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1878 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1879 while ($op eq 'D') { # repeating this for deletions (D) |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1880 $D_count++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1881 $op = shift @comp_cigar; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1882 # print "$_ deleted $op\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1883 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1884 if ($op eq 'I') { # adjusting the genomic position for insertions (I) |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1885 $I_count++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1886 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1887 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1888 $start += $ignore + $D_count - $I_count; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1889 # print "start $start\t ignore: $ignore\t D count: $D_count I_count: $I_count\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1890 } elsif ($strand eq '-') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1891 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1892 for (1..$ignore) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1893 my $op = pop @comp_cigar; # adjusting composite CIGAR string by removing $ignore operations, here the last value of the array |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1894 while ($op eq 'D') { # repeating this for deletions (D) |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1895 $op = pop @comp_cigar; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1896 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1897 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1898 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1899 ### For reverse strand alignments we need to determine the number of matching bases (M) or deletions (D) in the read from the CIGAR |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1900 ### string to be able to work out the starting position of the read which is on the 3' end of the sequence |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1901 my $MD_count = 0; # counting all operations that affect the genomic position, i.e. M and D. Insertions do not affect the start position |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1902 foreach (@comp_cigar) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1903 ++$MD_count if ($_ eq 'M' or $_ eq 'D'); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1904 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1905 $start += $MD_count - 1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1906 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1907 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1908 ### reconstituting shortened CIGAR string |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1909 my $new_cigar; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1910 my $count = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1911 my $last_op; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1912 # print "ignore adjusted: @comp_cigar\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1913 foreach my $op (@comp_cigar) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1914 unless (defined $last_op){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1915 $last_op = $op; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1916 ++$count; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1917 next; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1918 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1919 if ($last_op eq $op) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1920 ++$count; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1921 } else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1922 $new_cigar .= "$count$last_op"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1923 $last_op = $op; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1924 $count = 1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1925 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1926 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1927 $new_cigar .= "$count$last_op"; # appending the last operation and count |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1928 $cigar = $new_cigar; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1929 # print "ignore adjusted scalar: $cigar\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1930 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1931 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1932 ### printing out the methylation state of every C in the read |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1933 print_individual_C_methylation_states_single_end($meth_call,$chrom,$start,$id,$strand,$index,$cigar); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1934 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1935 ++$methylation_call_strings_processed; # 1 per single-end result |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1936 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1937 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1938 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1939 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1940 ### PROCESSING PAIRED-END RESULT FILES |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1941 elsif ($paired) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1942 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1943 ### proceeding differently now for SAM format or vanilla Bismark format files |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1944 if ($vanilla) { # old vanilla Bismark paired-end output format |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1945 while (<IN>) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1946 ++$line_count; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1947 warn "processed line: $line_count\n" if ($line_count%500000==0); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1948 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1949 ### $seq here is the chromosomal sequence (to use for the repeat analysis for example) |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1950 my ($id,$strand,$chrom,$start_read_1,$end_read_2,$seq_1,$meth_call_1,$seq_2,$meth_call_2,$first_read_conversion,$genome_conversion) = (split("\t"))[0,1,2,3,4,6,7,9,10,11,12,13]; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1951 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1952 my $index; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1953 chomp $genome_conversion; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1954 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1955 if ($first_read_conversion eq 'CT' and $genome_conversion eq 'CT') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1956 $index = 0; ## this is OT |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1957 } elsif ($first_read_conversion eq 'GA' and $genome_conversion eq 'GA') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1958 $index = 2; ## this is CTOB!!! |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1959 } elsif ($first_read_conversion eq 'GA' and $genome_conversion eq 'CT') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1960 $index = 1; ## this is CTOT!!! |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1961 } elsif ($first_read_conversion eq 'CT' and $genome_conversion eq 'GA') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1962 $index = 3; ## this is OB |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1963 } else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1964 die "Unexpected combination of read and genome conversion: $first_read_conversion / $genome_conversion\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1965 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1966 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1967 if ($meth_call_1 and $meth_call_2) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1968 ### Clipping off the first <int> number of bases from the methylation call strings as specified with '--ignore <int>' |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1969 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1970 if ($ignore) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1971 $meth_call_1 = substr($meth_call_1,$ignore,length($meth_call_1)-$ignore); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1972 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1973 ### we also need to adjust the start and end positions of the alignments accordingly if '--ignore' was specified |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1974 $start_read_1 += $ignore; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1975 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1976 if ($ignore_r2) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1977 $meth_call_2 = substr($meth_call_2,$ignore_r2,length($meth_call_2)-$ignore_r2); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1978 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1979 ### we also need to adjust the start and end positions of the alignments accordingly if '--ignore_r2' was specified |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1980 $end_read_2 -= $ignore_r2; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1981 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1982 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1983 my $end_read_1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1984 my $start_read_2; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1985 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1986 if ($strand eq '+') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1987 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1988 $end_read_1 = $start_read_1+length($meth_call_1)-1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1989 $start_read_2 = $end_read_2-length($meth_call_2)+1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1990 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1991 ## we first pass the first read which is in + orientation on the forward strand |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1992 print_individual_C_methylation_states_paired_end_files($meth_call_1,$chrom,$start_read_1,$id,'+',$index,0,0,undef,1); # the last two values are CIGAR string and read identity |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1993 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1994 # we next pass the second read which is in - orientation on the reverse strand |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1995 ### if --no_overlap was specified we also pass the end of read 1. If read 2 starts to overlap with read 1 we can stop extracting methylation calls from read 2 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1996 print_individual_C_methylation_states_paired_end_files($meth_call_2,$chrom,$end_read_2,$id,'-',$index,$no_overlap,$end_read_1,undef,2); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1997 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1998 else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
1999 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2000 $end_read_1 = $start_read_1+length($meth_call_2)-1; # read 1 is the second reported read! |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2001 $start_read_2 = $end_read_2-length($meth_call_1)+1; # read 2 is the first reported read! |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2002 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2003 ## we first pass the first read which is in - orientation on the reverse strand |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2004 print_individual_C_methylation_states_paired_end_files($meth_call_1,$chrom,$end_read_2,$id,'-',$index,0,0,undef,1); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2005 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2006 # we next pass the second read which is in + orientation on the forward strand |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2007 ### if --no_overlap was specified we also pass the end of read 2. If read 2 starts to overlap with read 1 we will stop extracting methylation calls from read 2 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2008 print_individual_C_methylation_states_paired_end_files($meth_call_2,$chrom,$start_read_1,$id,'+',$index,$no_overlap,$start_read_2,undef,2); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2009 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2010 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2011 $methylation_call_strings_processed += 2; # paired-end = 2 methylation calls |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2012 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2013 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2014 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2015 else { # Bismark paired-end SAM output format (default) |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2016 while (<IN>) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2017 ### SAM format can either start with header lines (starting with @) or start with alignments directly |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2018 if (/^\@/) { # skipping header lines (starting with @) |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2019 warn "skipping SAM header line:\t$_"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2020 next; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2021 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2022 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2023 ++$line_count; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2024 warn "Processed lines: $line_count\n" if ($line_count%500000==0); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2025 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2026 # example paired-end reads in SAM format (2 consecutive lines) |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2027 # 1_R1/1 67 5 103172224 255 40M = 103172417 233 AATATTTTTTTTATTTTAAAATGTGTATTGATTTAAATTT IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII NM:i:4 XX:Z:4T1T24TT7 XM:Z:....h.h........................hh....... XR:Z:CT XG:Z:CT |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2028 # 1_R1/2 131 5 103172417 255 40M = 103172224 -233 TATTTTTTTTTAGAGTATTTTTTAATGGTTATTAGATTTT IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII NM:i:6 XX:Z:T5T1T9T9T7T3 XM:Z:h.....h.h.........h.........h.......h... XR:Z:GA XG:Z:CT |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2029 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2030 # < version 0.7.6 my ($id_1,$chrom,$start_read_1,$meth_call_1,$first_read_conversion,$genome_conversion) = (split("\t"))[0,2,3,13,14,15]; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2031 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2032 my ($id_1,$chrom,$start_read_1,$cigar_1) = (split("\t"))[0,2,3,5]; ### detecting the following SAM flags in case the SAM entry was shuffled by CRAM or Goby compression/decompression |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2033 my $meth_call_1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2034 my $first_read_conversion; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2035 my $genome_conversion; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2036 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2037 while ( /(XM|XR|XG):Z:([^\t]+)/g ) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2038 my $tag = $1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2039 my $value = $2; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2040 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2041 if ($tag eq "XM") { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2042 $meth_call_1 = $value; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2043 $meth_call_1 =~ s/\r//; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2044 } elsif ($tag eq "XR") { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2045 $first_read_conversion = $value; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2046 $first_read_conversion =~ s/\r//; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2047 } elsif ($tag eq "XG") { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2048 $genome_conversion = $value; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2049 $genome_conversion =~ s/\r//; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2050 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2051 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2052 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2053 $_ = <IN>; # reading in the paired read |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2054 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2055 # < version 0.7.6 my ($id_2,$start_read_2,$meth_call_2,$second_read_conversion) = (split("\t"))[0,3,13,14]; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2056 # < version 0.7.6 $meth_call_1 =~ s/^XM:Z://; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2057 # < version 0.7.6 $meth_call_2 =~ s/^XM:Z://; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2058 # < version 0.7.6 $first_read_conversion =~ s/^XR:Z://; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2059 # < version 0.7.6 $second_read_conversion =~ s/^XR:Z://; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2060 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2061 my ($id_2,$start_read_2,$cigar_2) = (split("\t"))[0,3,5]; ### detecting the following SAM flags in case the SAM entry was shuffled by CRAM or Goby compression/decompression |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2062 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2063 my $meth_call_2; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2064 my $second_read_conversion; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2065 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2066 while ( /(XM|XR):Z:([^\t]+)/g ) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2067 my $tag = $1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2068 my $value = $2; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2069 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2070 if ($tag eq "XM") { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2071 $meth_call_2 = $value; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2072 $meth_call_2 =~ s/\r//; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2073 } elsif ($tag eq "XR") { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2074 $second_read_conversion = $value; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2075 $second_read_conversion = s/\r//; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2076 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2077 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2078 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2079 # < version 0.7.6 $genome_conversion =~ s/^XG:Z://; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2080 chomp $genome_conversion; # in case it captured a new line character |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2081 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2082 # print join ("\t",$meth_call_1,$meth_call_2,$first_read_conversion,$second_read_conversion,$genome_conversion),"\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2083 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2084 my $index; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2085 my $strand; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2086 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2087 if ($first_read_conversion eq 'CT' and $genome_conversion eq 'CT') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2088 $index = 0; ## this is OT |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2089 $strand = '+'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2090 } elsif ($first_read_conversion eq 'GA' and $genome_conversion eq 'CT') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2091 $index = 1; ## this is CTOT |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2092 $strand = '-'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2093 } elsif ($first_read_conversion eq 'GA' and $genome_conversion eq 'GA') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2094 $index = 2; ## this is CTOB |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2095 $strand = '+'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2096 } elsif ($first_read_conversion eq 'CT' and $genome_conversion eq 'GA') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2097 $index = 3; ## this is OB |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2098 $strand = '-'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2099 } else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2100 die "Unexpected combination of read and genome conversion: $first_read_conversion / $genome_conversion\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2101 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2102 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2103 ### reversing the methylation call of the read that was reverse-complemented |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2104 if ($strand eq '+') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2105 $meth_call_2 = reverse $meth_call_2; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2106 } else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2107 $meth_call_1 = reverse $meth_call_1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2108 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2109 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2110 if ($meth_call_1 and $meth_call_2) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2111 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2112 my $end_read_1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2113 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2114 ### READ 1 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2115 my @len_1 = split (/\D+/,$cigar_1); # storing the length per operation |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2116 my @ops_1 = split (/\d+/,$cigar_1); # storing the operation |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2117 shift @ops_1; # remove the empty first element |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2118 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2119 die "CIGAR string contained a non-matching number of lengths and operations: $cigar_1\n".join(" ",@len_1)."\n".join(" ",@ops_1)."\n" unless (scalar @len_1 == scalar @ops_1); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2120 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2121 my @comp_cigar_1; # building an array with all CIGAR operations |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2122 foreach my $index (0..$#len_1) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2123 foreach (1..$len_1[$index]) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2124 # print "$ops_1[$index]"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2125 push @comp_cigar_1, $ops_1[$index]; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2126 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2127 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2128 # print "original CIGAR read 1: $cigar_1\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2129 # print "original CIGAR read 1: @comp_cigar_1\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2130 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2131 ### READ 2 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2132 my @len_2 = split (/\D+/,$cigar_2); # storing the length per operation |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2133 my @ops_2 = split (/\d+/,$cigar_2); # storing the operation |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2134 shift @ops_2; # remove the empty first element |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2135 die "CIGAR string contained a non-matching number of lengths and operations\n" unless (scalar @len_2 == scalar @ops_2); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2136 my @comp_cigar_2; # building an array with all CIGAR operations for read 2 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2137 foreach my $index (0..$#len_2) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2138 foreach (1..$len_2[$index]) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2139 # print "$ops_2[$index]"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2140 push @comp_cigar_2, $ops_2[$index]; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2141 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2142 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2143 # print "original CIGAR read 2: $cigar_2\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2144 # print "original CIGAR read 2: @comp_cigar_2\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2145 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2146 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2147 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2148 if ($ignore) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2149 ### Clipping off the first <int> number of bases from the methylation call strings as specified with '--ignore <int>' for read 1 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2150 ### the methylation calls have already been reversed where necessary |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2151 $meth_call_1 = substr($meth_call_1,$ignore,length($meth_call_1)-$ignore); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2152 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2153 if ($strand eq '+') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2154 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2155 ### if the (read 1) strand information is '+', read 1 needs to be trimmed from the start |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2156 my $D_count_1 = 0; # counting all deletions that affect the ignored genomic position for read 1, i.e. Deletions and insertions |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2157 my $I_count_1 = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2158 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2159 for (1..$ignore) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2160 my $op = shift @comp_cigar_1; # adjusting composite CIGAR string of read 1 by removing $ignore operations from the start |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2161 # print "$_ deleted $op\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2162 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2163 while ($op eq 'D') { # repeating this for deletions (D) |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2164 $D_count_1++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2165 $op = shift @comp_cigar_1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2166 # print "$_ deleted $op\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2167 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2168 if ($op eq 'I') { # adjusting the genomic position for insertions (I) |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2169 $I_count_1++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2170 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2171 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2172 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2173 $start_read_1 += $ignore + $D_count_1 - $I_count_1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2174 # print "start read 1 $start_read_1\t ignore: $ignore\t D count 1: $D_count_1\tI_count 1: $I_count_1\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2175 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2176 # the start position of reads mapping to the reverse strand is being adjusted further below |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2177 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2178 elsif ($strand eq '-') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2179 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2180 ### if the (read 1) strand information is '-', read 1 needs to be trimmed from the back |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2181 for (1..$ignore) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2182 my $op = pop @comp_cigar_1; # adjusting composite CIGAR string by removing $ignore operations, here the last value of the array |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2183 while ($op eq 'D') { # repeating this for deletions (D) |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2184 $op = pop @comp_cigar_1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2185 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2186 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2187 # the start position of reads mapping to the reverse strand is being adjusted further below |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2188 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2189 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2190 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2191 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2192 if ($ignore_r2) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2193 ### Clipping off the first <int> number of bases from the methylation call string as specified with '--ignore_r2 <int>' for read 2 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2194 ### the methylation calls have already been reversed where necessary |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2195 $meth_call_2 = substr($meth_call_2,$ignore_r2,length($meth_call_2)-$ignore_r2); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2196 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2197 ### If we are ignoring a part of the sequence we also need to adjust the cigar string accordingly |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2198 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2199 if ($strand eq '+') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2200 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2201 ### if the (read 1) strand information is '+', read 2 needs to be trimmed from the back |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2202 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2203 for (1..$ignore_r2) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2204 my $op = pop @comp_cigar_2; # adjusting composite CIGAR string by removing $ignore operations, here the last value of the array |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2205 while ($op eq 'D') { # repeating this for deletions (D) |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2206 $op = pop @comp_cigar_2; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2207 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2208 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2209 # the start position of reads mapping to the reverse strand is being adjusted further below |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2210 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2211 elsif ($strand eq '-') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2212 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2213 ### if the (read 1) strand information is '-', read 2 needs to be trimmed from the start |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2214 my $D_count_2 = 0; # counting all deletions that affect the ignored genomic position for read 2, i.e. Deletions and insertions |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2215 my $I_count_2 = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2216 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2217 for (1..$ignore_r2) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2218 my $op = shift @comp_cigar_2; # adjusting composite CIGAR string of read 2 by removing $ignore operations from the start |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2219 # print "$_ deleted $op\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2220 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2221 while ($op eq 'D') { # repeating this for deletions (D) |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2222 $D_count_2++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2223 $op = shift @comp_cigar_2; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2224 # print "$_ deleted $op\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2225 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2226 if ($op eq 'I') { # adjusting the genomic position for insertions (I) |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2227 $I_count_2++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2228 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2229 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2230 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2231 $start_read_2 += $ignore_r2 + $D_count_2 - $I_count_2; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2232 # print "start read 2 $start_read_2\t ignore R2: $ignore_r2\t D count 2: $D_count_2\tI_count 2: $I_count_2\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2233 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2234 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2235 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2236 if ($ignore){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2237 ### reconstituting shortened CIGAR string 1 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2238 my $new_cigar_1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2239 my $count_1 = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2240 my $last_op_1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2241 # print "ignore adjusted CIGAR 1: @comp_cigar_1\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2242 foreach my $op (@comp_cigar_1) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2243 unless (defined $last_op_1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2244 $last_op_1 = $op; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2245 ++$count_1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2246 next; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2247 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2248 if ($last_op_1 eq $op) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2249 ++$count_1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2250 } else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2251 $new_cigar_1 .= "$count_1$last_op_1"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2252 $last_op_1 = $op; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2253 $count_1 = 1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2254 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2255 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2256 $new_cigar_1 .= "$count_1$last_op_1"; # appending the last operation and count |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2257 $cigar_1 = $new_cigar_1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2258 # print "ignore adjusted CIGAR 1 scalar: $cigar_1\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2259 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2260 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2261 if ($ignore_r2){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2262 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2263 ### reconstituting shortened CIGAR string 2 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2264 my $new_cigar_2; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2265 my $count_2 = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2266 my $last_op_2; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2267 # print "ignore adjusted CIGAR 2: @comp_cigar_2\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2268 foreach my $op (@comp_cigar_2) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2269 unless (defined $last_op_2){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2270 $last_op_2 = $op; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2271 ++$count_2; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2272 next; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2273 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2274 if ($last_op_2 eq $op) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2275 ++$count_2; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2276 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2277 else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2278 $new_cigar_2 .= "$count_2$last_op_2"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2279 $last_op_2 = $op; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2280 $count_2 = 1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2281 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2282 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2283 $new_cigar_2 .= "$count_2$last_op_2"; # appending the last operation and count |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2284 $cigar_2 = $new_cigar_2; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2285 # print "ignore_r2 adjusted CIGAR 2 scalar: $cigar_2\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2286 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2287 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2288 ### Adjusting CIGAR string and starting position of reads in reverse orientation which we will pass to the extraction subroutine later on |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2289 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2290 if ($strand eq '+') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2291 ### adjusting the start position for all reads mapping to the reverse strand, in this case read 2 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2292 @comp_cigar_2 = reverse@comp_cigar_2; # the CIGAR string needs to be reversed for all reads aligning to the reverse strand, too |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2293 # print "reverse: @comp_cigar_2\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2294 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2295 my $MD_count_1 = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2296 foreach (@comp_cigar_1) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2297 ++$MD_count_1 if ($_ eq 'M' or $_ eq 'D'); # Matching bases or deletions affect the genomic position of the 3' ends of reads, insertions don't |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2298 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2299 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2300 my $MD_count_2 = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2301 foreach (@comp_cigar_2) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2302 ++$MD_count_2 if ($_ eq 'M' or $_ eq 'D'); # Matching bases or deletions affect the genomic position of the 3' ends of reads, insertions don't |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2303 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2304 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2305 $end_read_1 = $start_read_1 + $MD_count_1 - 1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2306 $start_read_2 += $MD_count_2 - 1; ## Passing on the start position on the reverse strand |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2307 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2308 else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2309 ### adjusting the start position for all reads mapping to the reverse strand, in this case read 1 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2310 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2311 @comp_cigar_1 = reverse@comp_cigar_1; # the CIGAR string needs to be reversed for all reads aligning to the reverse strand, too |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2312 # print "reverse: @comp_cigar_1\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2313 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2314 my $MD_count_1 = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2315 foreach (@comp_cigar_1) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2316 ++$MD_count_1 if ($_ eq 'M' or $_ eq 'D'); # Matching bases or deletions affect the genomic position of the 3' ends of reads, insertions don't |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2317 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2318 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2319 $end_read_1 = $start_read_1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2320 $start_read_1 += $MD_count_1 - 1; ### Passing on the start position on the reverse strand |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2321 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2322 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2323 if ($strand eq '+') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2324 ## we first pass the first read which is in + orientation on the forward strand; the last value is the read identity |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2325 print_individual_C_methylation_states_paired_end_files($meth_call_1,$chrom,$start_read_1,$id_1,'+',$index,0,0,$cigar_1,1); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2326 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2327 # we next pass the second read which is in - orientation on the reverse strand |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2328 ### if --no_overlap was specified we also pass the end of read 1. If read 2 starts to overlap with read 1 we can stop extracting methylation calls from read 2 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2329 print_individual_C_methylation_states_paired_end_files($meth_call_2,$chrom,$start_read_2,$id_2,'-',$index,$no_overlap,$end_read_1,$cigar_2,2); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2330 } else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2331 ## we first pass the first read which is in - orientation on the reverse strand |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2332 print_individual_C_methylation_states_paired_end_files($meth_call_1,$chrom,$start_read_1,$id_1,'-',$index,0,0,$cigar_1,1); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2333 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2334 # we next pass the second read which is in + orientation on the forward strand |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2335 ### if --no_overlap was specified we also pass the end of read 1. If read 2 starts to overlap with read 1 we will stop extracting methylation calls from read 2 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2336 print_individual_C_methylation_states_paired_end_files($meth_call_2,$chrom,$start_read_2,$id_2,'+',$index,$no_overlap,$end_read_1,$cigar_2,2); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2337 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2338 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2339 $methylation_call_strings_processed += 2; # paired-end = 2 methylation calls |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2340 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2341 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2342 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2343 } else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2344 die "Single-end or paired-end reads not specified properly\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2345 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2346 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2347 warn "\n\nProcessed $line_count lines from $filename in total\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2348 warn "Total number of methylation call strings processed: $methylation_call_strings_processed\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2349 if ($report) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2350 print REPORT "\n\nProcessed $line_count lines from $filename in total\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2351 print REPORT "Total number of methylation call strings processed: $methylation_call_strings_processed\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2352 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2353 print_splitting_report (); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2354 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2355 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2356 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2357 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2358 sub print_splitting_report{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2359 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2360 ### Calculating methylation percentages if applicable |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2361 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2362 my $percent_meCpG; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2363 if (($counting{total_meCpG_count}+$counting{total_unmethylated_CpG_count}) > 0){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2364 $percent_meCpG = sprintf("%.1f",100*$counting{total_meCpG_count}/($counting{total_meCpG_count}+$counting{total_unmethylated_CpG_count})); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2365 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2366 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2367 my $percent_meCHG; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2368 if (($counting{total_meCHG_count}+$counting{total_unmethylated_CHG_count}) > 0){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2369 $percent_meCHG = sprintf("%.1f",100*$counting{total_meCHG_count}/($counting{total_meCHG_count}+$counting{total_unmethylated_CHG_count})); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2370 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2371 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2372 my $percent_meCHH; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2373 if (($counting{total_meCHH_count}+$counting{total_unmethylated_CHH_count}) > 0){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2374 $percent_meCHH = sprintf("%.1f",100*$counting{total_meCHH_count}/($counting{total_meCHH_count}+$counting{total_unmethylated_CHH_count})); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2375 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2376 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2377 my $percent_non_CpG_methylation; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2378 if ($merge_non_CpG){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2379 if ( ($counting{total_meCHH_count}+$counting{total_unmethylated_CHH_count}+$counting{total_meCHG_count}+$counting{total_unmethylated_CHG_count}) > 0){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2380 $percent_non_CpG_methylation = sprintf("%.1f",100* ( $counting{total_meCHH_count}+$counting{total_meCHG_count} ) / ( $counting{total_meCHH_count}+$counting{total_unmethylated_CHH_count}+$counting{total_meCHG_count}+$counting{total_unmethylated_CHG_count} ) ); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2381 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2382 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2383 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2384 if ($report){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2385 ### detailed information about Cs analysed |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2386 print REPORT "Final Cytosine Methylation Report\n",'='x33,"\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2387 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2388 my $total_number_of_C = $counting{total_meCHG_count}+$counting{total_meCHH_count}+$counting{total_meCpG_count}+$counting{total_unmethylated_CHG_count}+$counting{total_unmethylated_CHH_count}+$counting{total_unmethylated_CpG_count}; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2389 print REPORT "Total number of C's analysed:\t$total_number_of_C\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2390 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2391 print REPORT "Total methylated C's in CpG context:\t$counting{total_meCpG_count}\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2392 print REPORT "Total methylated C's in CHG context:\t$counting{total_meCHG_count}\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2393 print REPORT "Total methylated C's in CHH context:\t$counting{total_meCHH_count}\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2394 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2395 print REPORT "Total C to T conversions in CpG context:\t$counting{total_unmethylated_CpG_count}\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2396 print REPORT "Total C to T conversions in CHG context:\t$counting{total_unmethylated_CHG_count}\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2397 print REPORT "Total C to T conversions in CHH context:\t$counting{total_unmethylated_CHH_count}\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2398 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2399 ### calculating methylated CpG percentage if applicable |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2400 if ($percent_meCpG){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2401 print REPORT "C methylated in CpG context:\t${percent_meCpG}%\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2402 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2403 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2404 print REPORT "Can't determine percentage of methylated Cs in CpG context if value was 0\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2405 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2406 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2407 ### 2-Context Output |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2408 if ($merge_non_CpG){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2409 if ($percent_non_CpG_methylation){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2410 print REPORT "C methylated in non-CpG context:\t${percent_non_CpG_methylation}%\n\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2411 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2412 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2413 print REPORT "Can't determine percentage of methylated Cs in non-CpG context if value was 0\n\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2414 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2415 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2416 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2417 ### 3 Context Output |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2418 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2419 ### calculating methylated CHG percentage if applicable |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2420 if ($percent_meCHG){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2421 print REPORT "C methylated in CHG context:\t${percent_meCHG}%\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2422 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2423 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2424 print REPORT "Can't determine percentage of methylated Cs in CHG context if value was 0\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2425 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2426 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2427 ### calculating methylated CHH percentage if applicable |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2428 if ($percent_meCHH){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2429 print REPORT "C methylated in CHH context:\t${percent_meCHH}%\n\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2430 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2431 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2432 print REPORT "Can't determine percentage of methylated Cs in CHH context if value was 0\n\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2433 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2434 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2435 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2436 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2437 ### detailed information about Cs analysed for on-screen report |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2438 print "Final Cytosine Methylation Report\n",'='x33,"\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2439 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2440 my $total_number_of_C = $counting{total_meCHG_count}+$counting{total_meCHH_count}+$counting{total_meCpG_count}+$counting{total_unmethylated_CHG_count}+$counting{total_unmethylated_CHH_count}+$counting{total_unmethylated_CpG_count}; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2441 print "Total number of C's analysed:\t$total_number_of_C\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2442 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2443 print "Total methylated C's in CpG context:\t$counting{total_meCpG_count}\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2444 print "Total methylated C's in CHG context:\t$counting{total_meCHG_count}\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2445 print "Total methylated C's in CHH context:\t$counting{total_meCHH_count}\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2446 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2447 print "Total C to T conversions in CpG context:\t$counting{total_unmethylated_CpG_count}\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2448 print "Total C to T conversions in CHG context:\t$counting{total_unmethylated_CHG_count}\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2449 print "Total C to T conversions in CHH context:\t$counting{total_unmethylated_CHH_count}\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2450 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2451 ### printing methylated CpG percentage if applicable |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2452 if ($percent_meCpG){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2453 print "C methylated in CpG context:\t${percent_meCpG}%\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2454 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2455 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2456 print "Can't determine percentage of methylated Cs in CpG context if value was 0\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2457 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2458 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2459 ### 2-Context Output |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2460 if ($merge_non_CpG){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2461 if ($percent_non_CpG_methylation){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2462 print "C methylated in non-CpG context:\t${percent_non_CpG_methylation}%\n\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2463 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2464 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2465 print "Can't determine percentage of methylated Cs in non-CpG context if value was 0\n\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2466 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2467 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2468 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2469 ### 3-Context Output |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2470 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2471 ### printing methylated CHG percentage if applicable |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2472 if ($percent_meCHG){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2473 print "C methylated in CHG context:\t${percent_meCHG}%\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2474 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2475 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2476 print "Can't determine percentage of methylated Cs in CHG context if value was 0\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2477 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2478 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2479 ### printing methylated CHH percentage if applicable |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2480 if ($percent_meCHH){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2481 print "C methylated in CHH context:\t${percent_meCHH}%\n\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2482 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2483 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2484 print "Can't determine percentage of methylated Cs in CHH context if value was 0\n\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2485 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2486 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2487 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2488 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2489 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2490 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2491 sub print_individual_C_methylation_states_paired_end_files{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2492 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2493 my ($meth_call,$chrom,$start,$id,$strand,$filehandle_index,$no_overlap,$end_read_1,$cigar,$read_identity) = @_; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2494 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2495 ### we will use the read identity for the M-bias plot to discriminate read 1 and read 2 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2496 die "Read identity was neither 1 nor 2: $read_identity\n\n" unless ($read_identity == 1 or $read_identity == 2); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2497 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2498 my @methylation_calls = split(//,$meth_call); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2499 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2500 ################################################################# |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2501 ### . for bases not involving cytosines ### |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2502 ### X for methylated C in CHG context (was protected) ### |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2503 ### x for not methylated C in CHG context (was converted) ### |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2504 ### H for methylated C in CHH context (was protected) ### |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2505 ### h for not methylated C in CHH context (was converted) ### |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2506 ### Z for methylated C in CpG context (was protected) ### |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2507 ### z for not methylated C in CpG context (was converted) ### |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2508 ### U for methylated C in Unknown context (was protected) ### |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2509 ### u for not methylated C in Unknown context (was converted) ### |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2510 ################################################################# |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2511 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2512 my $methyl_CHG_count = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2513 my $methyl_CHH_count = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2514 my $methyl_CpG_count = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2515 my $unmethylated_CHG_count = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2516 my $unmethylated_CHH_count = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2517 my $unmethylated_CpG_count = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2518 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2519 my $pos_offset = 0; # this is only relevant for SAM reads with insertions or deletions |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2520 my $cigar_offset = 0; # again, this is only relevant for SAM reads containing indels |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2521 my @comp_cigar; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2522 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2523 ### Checking whether the CIGAR string is a linear genomic match or whether if requires indel processing |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2524 if ($cigar =~ /^\d+M$/){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2525 # this check speeds up the extraction process by up to 60%!!! |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2526 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2527 else{ # parsing CIGAR string |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2528 my @len; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2529 my @ops; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2530 @len = split (/\D+/,$cigar); # storing the length per operation |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2531 @ops = split (/\d+/,$cigar); # storing the operation |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2532 shift @ops; # remove the empty first element |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2533 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2534 die "CIGAR string contained a non-matching number of lengths and operations\n" unless (scalar @len == scalar @ops); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2535 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2536 foreach my $index (0..$#len){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2537 foreach (1..$len[$index]){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2538 # print "$ops[$index]"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2539 push @comp_cigar, $ops[$index]; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2540 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2541 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2542 # warn "\nDetected CIGAR string: $cigar\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2543 # warn "Length of methylation call: ",length $meth_call,"\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2544 # warn "number of operations: ",scalar @ops,"\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2545 # warn "number of length digits: ",scalar @len,"\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2546 # print @comp_cigar,"\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2547 # print "$meth_call\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2548 # sleep (1); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2549 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2550 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2551 if ($strand eq '-') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2552 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2553 ### the CIGAR string needs to be reversed, the methylation call has already been reversed above |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2554 if (@comp_cigar){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2555 @comp_cigar = reverse@comp_cigar; # the CIGAR string needs to be reversed for all reads aligning to the reverse strand, too |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2556 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2557 # print "reverse CIGAR string: @comp_cigar\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2558 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2559 ### the start position of paired-end files has already been corrected, see above |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2560 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2561 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2562 ### THIS IS AN OPTIONAL 2-CONTEXT (CpG and non-CpG) SECTION IF --merge_non_CpG was specified |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2563 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2564 if ($merge_non_CpG) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2565 if ($no_overlap) { # this has to be read 2... |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2566 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2567 ### single-file CpG and non-CpG context output |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2568 if ($full) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2569 if ($strand eq '+') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2570 for my $index (0..$#methylation_calls) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2571 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2572 if ($cigar and @comp_cigar){ # only needed for SAM reads with InDels |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2573 my ($cigar_mod,$pos_mod) = check_cigar_string($index,$cigar_offset,$pos_offset,$strand,\@comp_cigar); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2574 # print "index: $index\tmethylation_call: $methylation_calls[$index]\tposition+index: ",$start+$index,"\t"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2575 $cigar_offset += $cigar_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2576 $pos_offset += $pos_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2577 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2578 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2579 ### Returning as soon as the methylation calls start overlapping |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2580 if ($start+$index+$pos_offset >= $end_read_1) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2581 return; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2582 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2583 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2584 if ($methylation_calls[$index] eq 'X') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2585 $counting{total_meCHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2586 print {$fhs{other_context}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2587 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2588 $mbias_1{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2589 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2590 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2591 $mbias_2{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2592 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2593 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2594 elsif ($methylation_calls[$index] eq 'x') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2595 $counting{total_unmethylated_CHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2596 print {$fhs{other_context}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2597 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2598 $mbias_1{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2599 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2600 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2601 $mbias_2{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2602 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2603 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2604 elsif ($methylation_calls[$index] eq 'Z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2605 $counting{total_meCpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2606 print {$fhs{CpG_context}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2607 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2608 $mbias_1{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2609 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2610 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2611 $mbias_2{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2612 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2613 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2614 elsif ($methylation_calls[$index] eq 'z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2615 $counting{total_unmethylated_CpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2616 print {$fhs{CpG_context}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2617 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2618 $mbias_1{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2619 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2620 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2621 $mbias_2{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2622 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2623 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2624 elsif ($methylation_calls[$index] eq 'H') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2625 $counting{total_meCHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2626 print {$fhs{other_context}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2627 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2628 $mbias_1{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2629 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2630 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2631 $mbias_2{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2632 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2633 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2634 elsif ($methylation_calls[$index] eq 'h') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2635 $counting{total_unmethylated_CHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2636 print {$fhs{other_context}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2637 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2638 $mbias_1{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2639 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2640 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2641 $mbias_2{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2642 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2643 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2644 elsif ($methylation_calls[$index] eq '.'){} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2645 elsif (lc$methylation_calls[$index] eq 'u'){} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2646 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2647 die "The methylation call string contained the following unrecognised character: $methylation_calls[$index]\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2648 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2649 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2650 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2651 elsif ($strand eq '-') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2652 for my $index (0..$#methylation_calls) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2653 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2654 if ($cigar and @comp_cigar){ # only needed for SAM reads with InDels |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2655 # print "index: $index\tmethylation_call: $methylation_calls[$index]\tposition-index: ",$start-$index,"\t"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2656 my ($cigar_mod,$pos_mod) = check_cigar_string($index,$cigar_offset,$pos_offset,$strand,\@comp_cigar); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2657 $cigar_offset += $cigar_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2658 $pos_offset += $pos_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2659 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2660 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2661 ### Returning as soon as the methylation calls start overlapping |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2662 if ($start-$index+$pos_offset <= $end_read_1) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2663 return; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2664 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2665 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2666 if ($methylation_calls[$index] eq 'X') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2667 $counting{total_meCHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2668 print {$fhs{other_context}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2669 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2670 $mbias_1{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2671 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2672 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2673 $mbias_2{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2674 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2675 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2676 elsif ($methylation_calls[$index] eq 'x') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2677 $counting{total_unmethylated_CHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2678 print {$fhs{other_context}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2679 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2680 $mbias_1{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2681 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2682 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2683 $mbias_2{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2684 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2685 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2686 elsif ($methylation_calls[$index] eq 'Z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2687 $counting{total_meCpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2688 print {$fhs{CpG_context}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2689 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2690 $mbias_1{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2691 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2692 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2693 $mbias_2{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2694 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2695 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2696 elsif ($methylation_calls[$index] eq 'z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2697 $counting{total_unmethylated_CpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2698 print {$fhs{CpG_context}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2699 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2700 $mbias_1{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2701 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2702 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2703 $mbias_2{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2704 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2705 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2706 elsif ($methylation_calls[$index] eq 'H') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2707 $counting{total_meCHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2708 print {$fhs{other_context}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2709 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2710 $mbias_1{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2711 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2712 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2713 $mbias_2{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2714 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2715 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2716 elsif ($methylation_calls[$index] eq 'h') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2717 $counting{total_unmethylated_CHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2718 print {$fhs{other_context}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2719 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2720 $mbias_1{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2721 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2722 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2723 $mbias_2{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2724 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2725 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2726 elsif ($methylation_calls[$index] eq '.') {} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2727 elsif (lc$methylation_calls[$index] eq 'u'){} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2728 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2729 die "The methylation call string contained the following unrecognised character: $methylation_calls[$index]\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2730 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2731 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2732 } else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2733 die "The read orientation was neither + nor -: '$strand'\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2734 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2735 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2736 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2737 ### strand-specific methylation output |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2738 else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2739 if ($strand eq '+') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2740 for my $index (0..$#methylation_calls) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2741 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2742 if ($cigar and @comp_cigar){ # only needed for SAM reads with InDels |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2743 my ($cigar_mod,$pos_mod) = check_cigar_string($index,$cigar_offset,$pos_offset,$strand,\@comp_cigar); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2744 # print "index: $index\tmethylation_call: $methylation_calls[$index]\tposition+index: ",$start+$index,"\t"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2745 $cigar_offset += $cigar_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2746 $pos_offset += $pos_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2747 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2748 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2749 ### Returning as soon as the methylation calls start overlapping |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2750 if ($start+$index+$pos_offset >= $end_read_1) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2751 return; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2752 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2753 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2754 if ($methylation_calls[$index] eq 'X') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2755 $counting{total_meCHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2756 print {$fhs{$filehandle_index}->{other_c}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2757 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2758 $mbias_1{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2759 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2760 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2761 $mbias_2{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2762 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2763 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2764 elsif ($methylation_calls[$index] eq 'x') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2765 $counting{total_unmethylated_CHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2766 print {$fhs{$filehandle_index}->{other_c}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2767 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2768 $mbias_1{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2769 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2770 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2771 $mbias_2{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2772 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2773 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2774 elsif ($methylation_calls[$index] eq 'Z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2775 $counting{total_meCpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2776 print {$fhs{$filehandle_index}->{CpG}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2777 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2778 $mbias_1{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2779 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2780 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2781 $mbias_2{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2782 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2783 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2784 elsif ($methylation_calls[$index] eq 'z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2785 $counting{total_unmethylated_CpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2786 print {$fhs{$filehandle_index}->{CpG}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2787 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2788 $mbias_1{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2789 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2790 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2791 $mbias_2{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2792 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2793 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2794 elsif ($methylation_calls[$index] eq 'H') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2795 $counting{total_meCHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2796 print {$fhs{$filehandle_index}->{other_c}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2797 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2798 $mbias_1{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2799 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2800 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2801 $mbias_2{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2802 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2803 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2804 elsif ($methylation_calls[$index] eq 'h') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2805 $counting{total_unmethylated_CHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2806 print {$fhs{$filehandle_index}->{other_c}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2807 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2808 $mbias_1{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2809 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2810 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2811 $mbias_2{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2812 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2813 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2814 elsif ($methylation_calls[$index] eq '.') {} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2815 elsif (lc$methylation_calls[$index] eq 'u'){} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2816 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2817 die "The methylation call string contained the following unrecognised character: $methylation_calls[$index]\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2818 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2819 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2820 } elsif ($strand eq '-') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2821 for my $index (0..$#methylation_calls) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2822 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2823 if ($cigar and @comp_cigar){ # only needed for SAM reads with InDels |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2824 # print "index: $index\tmethylation_call: $methylation_calls[$index]\tposition-index: ",$start-$index,"\t"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2825 my ($cigar_mod,$pos_mod) = check_cigar_string($index,$cigar_offset,$pos_offset,$strand,\@comp_cigar); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2826 $cigar_offset += $cigar_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2827 $pos_offset += $pos_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2828 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2829 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2830 ### Returning as soon as the methylation calls start overlapping |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2831 if ($start-$index+$pos_offset <= $end_read_1) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2832 return; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2833 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2834 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2835 if ($methylation_calls[$index] eq 'X') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2836 $counting{total_meCHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2837 print {$fhs{$filehandle_index}->{other_c}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2838 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2839 $mbias_1{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2840 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2841 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2842 $mbias_2{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2843 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2844 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2845 elsif ($methylation_calls[$index] eq 'x') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2846 $counting{total_unmethylated_CHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2847 print {$fhs{$filehandle_index}->{other_c}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2848 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2849 $mbias_1{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2850 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2851 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2852 $mbias_2{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2853 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2854 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2855 elsif ($methylation_calls[$index] eq 'Z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2856 $counting{total_meCpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2857 print {$fhs{$filehandle_index}->{CpG}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2858 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2859 $mbias_1{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2860 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2861 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2862 $mbias_2{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2863 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2864 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2865 elsif ($methylation_calls[$index] eq 'z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2866 $counting{total_unmethylated_CpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2867 print {$fhs{$filehandle_index}->{CpG}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2868 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2869 $mbias_1{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2870 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2871 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2872 $mbias_2{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2873 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2874 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2875 elsif ($methylation_calls[$index] eq 'H') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2876 $counting{total_meCHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2877 print {$fhs{$filehandle_index}->{other_c}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2878 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2879 $mbias_1{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2880 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2881 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2882 $mbias_2{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2883 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2884 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2885 elsif ($methylation_calls[$index] eq 'h') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2886 $counting{total_unmethylated_CHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2887 print {$fhs{$filehandle_index}->{other_c}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2888 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2889 $mbias_1{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2890 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2891 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2892 $mbias_2{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2893 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2894 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2895 elsif ($methylation_calls[$index] eq '.') {} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2896 elsif (lc$methylation_calls[$index] eq 'u'){} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2897 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2898 die "The methylation call string contained the following unrecognised character: $methylation_calls[$index]\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2899 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2900 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2901 } else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2902 die "The strand orientation was neither + nor -: '$strand'/n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2903 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2904 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2905 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2906 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2907 ### this is the default paired-end procedure allowing overlaps and using every single C position |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2908 ### Still within the 2-CONTEXT ONLY optional section |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2909 else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2910 ### single-file CpG and non-CpG context output |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2911 if ($full) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2912 if ($strand eq '+') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2913 for my $index (0..$#methylation_calls) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2914 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2915 if ($cigar and @comp_cigar){ # only needed for SAM reads with InDels |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2916 my ($cigar_mod,$pos_mod) = check_cigar_string($index,$cigar_offset,$pos_offset,$strand,\@comp_cigar); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2917 # print "index: $index\tmethylation_call: $methylation_calls[$index]\tposition+index: ",$start+$index,"\t"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2918 $cigar_offset += $cigar_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2919 $pos_offset += $pos_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2920 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2921 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2922 if ($methylation_calls[$index] eq 'X') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2923 $counting{total_meCHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2924 print {$fhs{other_context}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2925 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2926 $mbias_1{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2927 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2928 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2929 $mbias_2{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2930 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2931 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2932 elsif ($methylation_calls[$index] eq 'x') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2933 $counting{total_unmethylated_CHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2934 print {$fhs{other_context}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2935 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2936 $mbias_1{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2937 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2938 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2939 $mbias_2{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2940 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2941 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2942 elsif ($methylation_calls[$index] eq 'Z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2943 $counting{total_meCpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2944 print {$fhs{CpG_context}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2945 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2946 $mbias_1{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2947 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2948 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2949 $mbias_2{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2950 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2951 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2952 elsif ($methylation_calls[$index] eq 'z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2953 $counting{total_unmethylated_CpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2954 print {$fhs{CpG_context}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2955 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2956 $mbias_1{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2957 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2958 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2959 $mbias_2{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2960 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2961 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2962 elsif ($methylation_calls[$index] eq 'H') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2963 $counting{total_meCHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2964 print {$fhs{other_context}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2965 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2966 $mbias_1{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2967 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2968 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2969 $mbias_2{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2970 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2971 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2972 elsif ($methylation_calls[$index] eq 'h') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2973 $counting{total_unmethylated_CHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2974 print {$fhs{other_context}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2975 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2976 $mbias_1{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2977 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2978 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2979 $mbias_2{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2980 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2981 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2982 elsif ($methylation_calls[$index] eq '.') {} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2983 elsif (lc$methylation_calls[$index] eq 'u'){} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2984 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2985 die "The methylation call string contained the following unrecognised character: $methylation_calls[$index]\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2986 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2987 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2988 } elsif ($strand eq '-') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2989 for my $index (0..$#methylation_calls) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2990 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2991 if ($cigar and @comp_cigar){ # only needed for SAM reads with InDels |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2992 # print "index: $index\tmethylation_call: $methylation_calls[$index]\tposition-index: ",$start-$index,"\t"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2993 my ($cigar_mod,$pos_mod) = check_cigar_string($index,$cigar_offset,$pos_offset,$strand,\@comp_cigar); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2994 $cigar_offset += $cigar_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2995 $pos_offset += $pos_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2996 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2997 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2998 if ($methylation_calls[$index] eq 'X') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
2999 $counting{total_meCHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3000 print {$fhs{other_context}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3001 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3002 $mbias_1{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3003 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3004 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3005 $mbias_2{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3006 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3007 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3008 elsif ($methylation_calls[$index] eq 'x') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3009 $counting{total_unmethylated_CHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3010 print {$fhs{other_context}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3011 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3012 $mbias_1{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3013 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3014 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3015 $mbias_2{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3016 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3017 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3018 elsif ($methylation_calls[$index] eq 'Z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3019 $counting{total_meCpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3020 print {$fhs{CpG_context}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3021 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3022 $mbias_1{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3023 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3024 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3025 $mbias_2{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3026 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3027 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3028 elsif ($methylation_calls[$index] eq 'z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3029 $counting{total_unmethylated_CpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3030 print {$fhs{CpG_context}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3031 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3032 $mbias_1{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3033 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3034 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3035 $mbias_2{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3036 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3037 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3038 elsif ($methylation_calls[$index] eq 'H') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3039 $counting{total_meCHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3040 print {$fhs{other_context}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3041 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3042 $mbias_1{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3043 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3044 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3045 $mbias_2{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3046 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3047 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3048 elsif ($methylation_calls[$index] eq 'h') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3049 $counting{total_unmethylated_CHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3050 print {$fhs{other_context}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3051 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3052 $mbias_1{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3053 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3054 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3055 $mbias_2{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3056 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3057 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3058 elsif ($methylation_calls[$index] eq '.') {} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3059 elsif (lc$methylation_calls[$index] eq 'u'){} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3060 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3061 die "The methylation call string contained the following unrecognised character: $methylation_calls[$index]\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3062 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3063 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3064 } else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3065 die "The strand orientation as neither + nor -: '$strand'\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3066 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3067 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3068 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3069 ### strand-specific methylation output |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3070 ### still within the 2-CONTEXT optional section |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3071 else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3072 if ($strand eq '+') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3073 for my $index (0..$#methylation_calls) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3074 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3075 if ($cigar and @comp_cigar){ # only needed for SAM reads with InDels |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3076 my ($cigar_mod,$pos_mod) = check_cigar_string($index,$cigar_offset,$pos_offset,$strand,\@comp_cigar); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3077 # print "index: $index\tmethylation_call: $methylation_calls[$index]\tposition+index: ",$start+$index,"\t"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3078 $cigar_offset += $cigar_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3079 $pos_offset += $pos_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3080 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3081 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3082 if ($methylation_calls[$index] eq 'X') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3083 $counting{total_meCHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3084 print {$fhs{$filehandle_index}->{other_c}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3085 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3086 $mbias_1{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3087 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3088 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3089 $mbias_2{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3090 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3091 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3092 elsif ($methylation_calls[$index] eq 'x') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3093 $counting{total_unmethylated_CHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3094 print {$fhs{$filehandle_index}->{other_c}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3095 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3096 $mbias_1{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3097 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3098 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3099 $mbias_2{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3100 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3101 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3102 elsif ($methylation_calls[$index] eq 'Z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3103 $counting{total_meCpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3104 print {$fhs{$filehandle_index}->{CpG}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3105 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3106 $mbias_1{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3107 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3108 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3109 $mbias_2{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3110 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3111 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3112 elsif ($methylation_calls[$index] eq 'z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3113 $counting{total_unmethylated_CpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3114 print {$fhs{$filehandle_index}->{CpG}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3115 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3116 $mbias_1{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3117 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3118 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3119 $mbias_2{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3120 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3121 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3122 elsif ($methylation_calls[$index] eq 'H') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3123 $counting{total_meCHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3124 print {$fhs{$filehandle_index}->{other_c}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3125 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3126 $mbias_1{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3127 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3128 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3129 $mbias_2{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3130 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3131 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3132 elsif ($methylation_calls[$index] eq 'h') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3133 $counting{total_unmethylated_CHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3134 print {$fhs{$filehandle_index}->{other_c}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3135 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3136 $mbias_1{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3137 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3138 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3139 $mbias_2{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3140 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3141 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3142 elsif ($methylation_calls[$index] eq '.') {} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3143 elsif (lc$methylation_calls[$index] eq 'u'){} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3144 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3145 die "The methylation call string contained the following unrecognised character: $methylation_calls[$index]\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3146 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3147 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3148 } elsif ($strand eq '-') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3149 for my $index (0..$#methylation_calls) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3150 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3151 if ($cigar and @comp_cigar){ # only needed for SAM reads with InDels |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3152 # print "index: $index\tmethylation_call: $methylation_calls[$index]\tposition-index: ",$start-$index,"\t"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3153 my ($cigar_mod,$pos_mod) = check_cigar_string($index,$cigar_offset,$pos_offset,$strand,\@comp_cigar); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3154 $cigar_offset += $cigar_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3155 $pos_offset += $pos_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3156 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3157 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3158 if ($methylation_calls[$index] eq 'X') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3159 $counting{total_meCHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3160 print {$fhs{$filehandle_index}->{other_c}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3161 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3162 $mbias_1{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3163 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3164 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3165 $mbias_2{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3166 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3167 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3168 elsif ($methylation_calls[$index] eq 'x') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3169 $counting{total_unmethylated_CHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3170 print {$fhs{$filehandle_index}->{other_c}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3171 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3172 $mbias_1{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3173 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3174 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3175 $mbias_2{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3176 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3177 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3178 elsif ($methylation_calls[$index] eq 'Z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3179 $counting{total_meCpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3180 print {$fhs{$filehandle_index}->{CpG}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3181 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3182 $mbias_1{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3183 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3184 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3185 $mbias_2{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3186 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3187 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3188 elsif ($methylation_calls[$index] eq 'z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3189 $counting{total_unmethylated_CpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3190 print {$fhs{$filehandle_index}->{CpG}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3191 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3192 $mbias_1{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3193 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3194 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3195 $mbias_2{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3196 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3197 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3198 elsif ($methylation_calls[$index] eq 'H') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3199 $counting{total_meCHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3200 print {$fhs{$filehandle_index}->{other_c}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3201 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3202 $mbias_1{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3203 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3204 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3205 $mbias_2{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3206 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3207 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3208 elsif ($methylation_calls[$index] eq 'h') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3209 $counting{total_unmethylated_CHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3210 print {$fhs{$filehandle_index}->{other_c}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3211 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3212 $mbias_1{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3213 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3214 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3215 $mbias_2{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3216 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3217 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3218 elsif ($methylation_calls[$index] eq '.') {} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3219 elsif (lc$methylation_calls[$index] eq 'u'){} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3220 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3221 die "The methylation call string contained the following unrecognised character: $methylation_calls[$index]\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3222 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3223 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3224 } else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3225 die "The strand orientation as neither + nor -: '$strand'\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3226 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3227 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3228 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3229 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3230 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3231 ############################################ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3232 ### THIS IS THE DEFAULT 3-CONTEXT OUTPUT ### |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3233 ############################################ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3234 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3235 elsif ($no_overlap) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3236 ### single-file CpG, CHG and CHH context output |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3237 if ($full) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3238 if ($strand eq '+') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3239 for my $index (0..$#methylation_calls) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3240 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3241 if ($cigar and @comp_cigar){ # only needed for SAM reads with InDels |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3242 my ($cigar_mod,$pos_mod) = check_cigar_string($index,$cigar_offset,$pos_offset,$strand,\@comp_cigar); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3243 # print "index: $index\tmethylation_call: $methylation_calls[$index]\tposition+index: ",$start+$index,"\t"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3244 $cigar_offset += $cigar_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3245 $pos_offset += $pos_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3246 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3247 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3248 ### Returning as soon as the methylation calls start overlapping |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3249 if ($start+$index+$pos_offset >= $end_read_1) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3250 return; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3251 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3252 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3253 if ($methylation_calls[$index] eq 'X') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3254 $counting{total_meCHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3255 print {$fhs{CHG_context}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3256 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3257 $mbias_1{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3258 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3259 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3260 $mbias_2{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3261 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3262 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3263 elsif ($methylation_calls[$index] eq 'x') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3264 $counting{total_unmethylated_CHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3265 print {$fhs{CHG_context}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3266 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3267 $mbias_1{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3268 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3269 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3270 $mbias_2{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3271 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3272 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3273 elsif ($methylation_calls[$index] eq 'Z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3274 $counting{total_meCpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3275 print {$fhs{CpG_context}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3276 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3277 $mbias_1{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3278 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3279 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3280 $mbias_2{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3281 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3282 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3283 elsif ($methylation_calls[$index] eq 'z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3284 $counting{total_unmethylated_CpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3285 print {$fhs{CpG_context}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3286 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3287 $mbias_1{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3288 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3289 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3290 $mbias_2{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3291 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3292 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3293 elsif ($methylation_calls[$index] eq 'H') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3294 $counting{total_meCHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3295 print {$fhs{CHH_context}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3296 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3297 $mbias_1{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3298 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3299 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3300 $mbias_2{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3301 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3302 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3303 elsif ($methylation_calls[$index] eq 'h') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3304 $counting{total_unmethylated_CHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3305 print {$fhs{CHH_context}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3306 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3307 $mbias_1{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3308 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3309 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3310 $mbias_2{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3311 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3312 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3313 elsif ($methylation_calls[$index] eq '.') {} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3314 elsif (lc$methylation_calls[$index] eq 'u'){} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3315 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3316 die "The methylation call string contained the following unrecognised character: $methylation_calls[$index]\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3317 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3318 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3319 } elsif ($strand eq '-') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3320 for my $index (0..$#methylation_calls) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3321 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3322 if ($cigar and @comp_cigar){ # only needed for SAM reads with InDels |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3323 # print "index: $index\tmethylation_call: $methylation_calls[$index]\tposition-index: ",$start-$index,"\t"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3324 my ($cigar_mod,$pos_mod) = check_cigar_string($index,$cigar_offset,$pos_offset,$strand,\@comp_cigar); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3325 $cigar_offset += $cigar_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3326 $pos_offset += $pos_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3327 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3328 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3329 ### Returning as soon as the methylation calls start overlapping |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3330 if ($start-$index+$pos_offset <= $end_read_1) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3331 return; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3332 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3333 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3334 if ($methylation_calls[$index] eq 'X') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3335 $counting{total_meCHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3336 print {$fhs{CHG_context}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3337 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3338 $mbias_1{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3339 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3340 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3341 $mbias_2{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3342 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3343 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3344 elsif ($methylation_calls[$index] eq 'x') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3345 $counting{total_unmethylated_CHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3346 print {$fhs{CHG_context}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3347 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3348 $mbias_1{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3349 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3350 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3351 $mbias_2{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3352 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3353 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3354 elsif ($methylation_calls[$index] eq 'Z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3355 $counting{total_meCpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3356 print {$fhs{CpG_context}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3357 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3358 $mbias_1{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3359 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3360 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3361 $mbias_2{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3362 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3363 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3364 elsif ($methylation_calls[$index] eq 'z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3365 $counting{total_unmethylated_CpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3366 print {$fhs{CpG_context}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3367 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3368 $mbias_1{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3369 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3370 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3371 $mbias_2{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3372 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3373 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3374 elsif ($methylation_calls[$index] eq 'H') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3375 $counting{total_meCHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3376 print {$fhs{CHH_context}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3377 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3378 $mbias_1{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3379 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3380 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3381 $mbias_2{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3382 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3383 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3384 elsif ($methylation_calls[$index] eq 'h') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3385 $counting{total_unmethylated_CHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3386 print {$fhs{CHH_context}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3387 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3388 $mbias_1{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3389 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3390 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3391 $mbias_2{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3392 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3393 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3394 elsif ($methylation_calls[$index] eq '.') {} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3395 elsif (lc$methylation_calls[$index] eq 'u'){} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3396 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3397 die "The methylation call string contained the following unrecognised character: $methylation_calls[$index]\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3398 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3399 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3400 } else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3401 die "The strand orientation as neither + nor -: '$strand'\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3402 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3403 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3404 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3405 ### strand-specific methylation output |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3406 else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3407 if ($strand eq '+') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3408 for my $index (0..$#methylation_calls) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3409 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3410 if ($cigar and @comp_cigar){ # only needed for SAM reads with InDels |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3411 my ($cigar_mod,$pos_mod) = check_cigar_string($index,$cigar_offset,$pos_offset,$strand,\@comp_cigar); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3412 # print "index: $index\tmethylation_call: $methylation_calls[$index]\tposition+index: ",$start+$index,"\t"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3413 $cigar_offset += $cigar_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3414 $pos_offset += $pos_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3415 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3416 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3417 ### Returning as soon as the methylation calls start overlapping |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3418 if ($start+$index+$pos_offset >= $end_read_1) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3419 return; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3420 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3421 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3422 if ($methylation_calls[$index] eq 'X') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3423 $counting{total_meCHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3424 print {$fhs{$filehandle_index}->{CHG}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3425 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3426 $mbias_1{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3427 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3428 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3429 $mbias_2{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3430 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3431 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3432 elsif ($methylation_calls[$index] eq 'x') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3433 $counting{total_unmethylated_CHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3434 print {$fhs{$filehandle_index}->{CHG}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3435 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3436 $mbias_1{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3437 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3438 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3439 $mbias_2{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3440 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3441 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3442 elsif ($methylation_calls[$index] eq 'Z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3443 $counting{total_meCpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3444 print {$fhs{$filehandle_index}->{CpG}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3445 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3446 $mbias_1{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3447 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3448 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3449 $mbias_2{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3450 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3451 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3452 elsif ($methylation_calls[$index] eq 'z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3453 $counting{total_unmethylated_CpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3454 print {$fhs{$filehandle_index}->{CpG}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3455 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3456 $mbias_1{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3457 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3458 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3459 $mbias_2{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3460 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3461 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3462 elsif ($methylation_calls[$index] eq 'H') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3463 $counting{total_meCHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3464 print {$fhs{$filehandle_index}->{CHH}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3465 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3466 $mbias_1{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3467 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3468 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3469 $mbias_2{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3470 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3471 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3472 elsif ($methylation_calls[$index] eq 'h') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3473 $counting{total_unmethylated_CHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3474 print {$fhs{$filehandle_index}->{CHH}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3475 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3476 $mbias_1{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3477 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3478 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3479 $mbias_2{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3480 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3481 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3482 elsif ($methylation_calls[$index] eq '.') {} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3483 elsif (lc$methylation_calls[$index] eq 'u'){} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3484 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3485 die "The methylation call string contained the following unrecognised character: $methylation_calls[$index]\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3486 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3487 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3488 } elsif ($strand eq '-') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3489 for my $index (0..$#methylation_calls) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3490 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3491 if ($cigar and @comp_cigar){ # only needed for SAM reads with InDels |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3492 # print "index: $index\tmethylation_call: $methylation_calls[$index]\tposition-index: ",$start-$index,"\t"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3493 my ($cigar_mod,$pos_mod) = check_cigar_string($index,$cigar_offset,$pos_offset,$strand,\@comp_cigar); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3494 $cigar_offset += $cigar_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3495 $pos_offset += $pos_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3496 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3497 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3498 ### Returning as soon as the methylation calls start overlapping |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3499 if ($start-$index+$pos_offset <= $end_read_1) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3500 return; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3501 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3502 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3503 if ($methylation_calls[$index] eq 'X') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3504 $counting{total_meCHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3505 print {$fhs{$filehandle_index}->{CHG}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3506 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3507 $mbias_1{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3508 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3509 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3510 $mbias_2{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3511 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3512 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3513 elsif ($methylation_calls[$index] eq 'x') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3514 $counting{total_unmethylated_CHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3515 print {$fhs{$filehandle_index}->{CHG}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3516 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3517 $mbias_1{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3518 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3519 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3520 $mbias_2{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3521 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3522 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3523 elsif ($methylation_calls[$index] eq 'Z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3524 $counting{total_meCpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3525 print {$fhs{$filehandle_index}->{CpG}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3526 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3527 $mbias_1{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3528 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3529 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3530 $mbias_2{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3531 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3532 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3533 elsif ($methylation_calls[$index] eq 'z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3534 $counting{total_unmethylated_CpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3535 print {$fhs{$filehandle_index}->{CpG}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3536 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3537 $mbias_1{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3538 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3539 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3540 $mbias_2{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3541 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3542 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3543 elsif ($methylation_calls[$index] eq 'H') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3544 $counting{total_meCHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3545 print {$fhs{$filehandle_index}->{CHH}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3546 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3547 $mbias_1{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3548 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3549 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3550 $mbias_2{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3551 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3552 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3553 elsif ($methylation_calls[$index] eq 'h') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3554 $counting{total_unmethylated_CHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3555 print {$fhs{$filehandle_index}->{CHH}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3556 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3557 $mbias_1{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3558 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3559 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3560 $mbias_2{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3561 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3562 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3563 elsif ($methylation_calls[$index] eq '.') {} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3564 elsif (lc$methylation_calls[$index] eq 'u'){} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3565 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3566 die "The methylation call string contained the following unrecognised character: $methylation_calls[$index]\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3567 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3568 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3569 } else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3570 die "The strand orientation as neither + nor -: '$strand'\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3571 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3572 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3573 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3574 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3575 ### this is the default paired-end procedure allowing overlaps and using every single C position |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3576 else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3577 ### single-file CpG, CHG and CHH context output |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3578 if ($full) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3579 if ($strand eq '+') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3580 for my $index (0..$#methylation_calls) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3581 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3582 if ($cigar and @comp_cigar){ # only needed for SAM reads with InDels |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3583 my ($cigar_mod,$pos_mod) = check_cigar_string($index,$cigar_offset,$pos_offset,$strand,\@comp_cigar); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3584 # print "index: $index\tmethylation_call: $methylation_calls[$index]\tposition+index: ",$start+$index,"\t"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3585 $cigar_offset += $cigar_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3586 $pos_offset += $pos_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3587 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3588 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3589 if ($methylation_calls[$index] eq 'X') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3590 $counting{total_meCHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3591 print {$fhs{CHG_context}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3592 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3593 $mbias_1{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3594 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3595 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3596 $mbias_2{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3597 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3598 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3599 elsif ($methylation_calls[$index] eq 'x') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3600 $counting{total_unmethylated_CHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3601 print {$fhs{CHG_context}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3602 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3603 $mbias_1{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3604 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3605 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3606 $mbias_2{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3607 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3608 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3609 elsif ($methylation_calls[$index] eq 'Z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3610 $counting{total_meCpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3611 print {$fhs{CpG_context}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3612 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3613 $mbias_1{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3614 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3615 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3616 $mbias_2{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3617 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3618 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3619 elsif ($methylation_calls[$index] eq 'z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3620 $counting{total_unmethylated_CpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3621 print {$fhs{CpG_context}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3622 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3623 $mbias_1{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3624 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3625 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3626 $mbias_2{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3627 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3628 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3629 elsif ($methylation_calls[$index] eq 'H') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3630 $counting{total_meCHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3631 print {$fhs{CHH_context}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3632 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3633 $mbias_1{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3634 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3635 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3636 $mbias_2{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3637 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3638 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3639 elsif ($methylation_calls[$index] eq 'h') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3640 $counting{total_unmethylated_CHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3641 print {$fhs{CHH_context}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3642 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3643 $mbias_1{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3644 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3645 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3646 $mbias_2{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3647 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3648 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3649 elsif ($methylation_calls[$index] eq '.') {} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3650 elsif (lc$methylation_calls[$index] eq 'u'){} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3651 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3652 die "The methylation call string contained the following unrecognised character: $methylation_calls[$index]\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3653 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3654 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3655 } elsif ($strand eq '-') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3656 for my $index (0..$#methylation_calls) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3657 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3658 if ($cigar and @comp_cigar){ # only needed for SAM reads with InDels |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3659 # print "index: $index\tmethylation_call: $methylation_calls[$index]\tposition-index: ",$start-$index,"\t"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3660 my ($cigar_mod,$pos_mod) = check_cigar_string($index,$cigar_offset,$pos_offset,$strand,\@comp_cigar); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3661 $cigar_offset += $cigar_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3662 $pos_offset += $pos_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3663 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3664 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3665 if ($methylation_calls[$index] eq 'X') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3666 $counting{total_meCHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3667 print {$fhs{CHG_context}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3668 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3669 $mbias_1{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3670 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3671 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3672 $mbias_2{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3673 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3674 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3675 elsif ($methylation_calls[$index] eq 'x') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3676 $counting{total_unmethylated_CHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3677 print {$fhs{CHG_context}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3678 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3679 $mbias_1{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3680 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3681 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3682 $mbias_2{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3683 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3684 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3685 elsif ($methylation_calls[$index] eq 'Z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3686 $counting{total_meCpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3687 print {$fhs{CpG_context}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3688 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3689 $mbias_1{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3690 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3691 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3692 $mbias_2{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3693 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3694 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3695 elsif ($methylation_calls[$index] eq 'z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3696 $counting{total_unmethylated_CpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3697 print {$fhs{CpG_context}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3698 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3699 $mbias_1{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3700 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3701 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3702 $mbias_2{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3703 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3704 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3705 elsif ($methylation_calls[$index] eq 'H') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3706 $counting{total_meCHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3707 print {$fhs{CHH_context}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3708 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3709 $mbias_1{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3710 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3711 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3712 $mbias_2{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3713 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3714 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3715 elsif ($methylation_calls[$index] eq 'h') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3716 $counting{total_unmethylated_CHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3717 print {$fhs{CHH_context}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3718 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3719 $mbias_1{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3720 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3721 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3722 $mbias_2{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3723 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3724 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3725 elsif ($methylation_calls[$index] eq '.') {} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3726 elsif (lc$methylation_calls[$index] eq 'u'){} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3727 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3728 die "The methylation call string contained the following unrecognised character: $methylation_calls[$index]\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3729 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3730 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3731 } else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3732 die "The strand orientation as neither + nor -: '$strand'\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3733 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3734 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3735 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3736 ### strand-specific methylation output |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3737 else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3738 if ($strand eq '+') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3739 for my $index (0..$#methylation_calls) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3740 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3741 if ($cigar and @comp_cigar){ # only needed for SAM reads with InDels |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3742 my ($cigar_mod,$pos_mod) = check_cigar_string($index,$cigar_offset,$pos_offset,$strand,\@comp_cigar); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3743 # print "index: $index\tmethylation_call: $methylation_calls[$index]\tposition+index: ",$start+$index,"\t"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3744 $cigar_offset += $cigar_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3745 $pos_offset += $pos_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3746 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3747 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3748 if ($methylation_calls[$index] eq 'X') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3749 $counting{total_meCHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3750 print {$fhs{$filehandle_index}->{CHG}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3751 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3752 $mbias_1{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3753 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3754 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3755 $mbias_2{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3756 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3757 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3758 elsif ($methylation_calls[$index] eq 'x') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3759 $counting{total_unmethylated_CHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3760 print {$fhs{$filehandle_index}->{CHG}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3761 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3762 $mbias_1{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3763 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3764 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3765 $mbias_2{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3766 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3767 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3768 elsif ($methylation_calls[$index] eq 'Z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3769 $counting{total_meCpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3770 print {$fhs{$filehandle_index}->{CpG}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3771 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3772 $mbias_1{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3773 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3774 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3775 $mbias_2{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3776 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3777 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3778 elsif ($methylation_calls[$index] eq 'z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3779 $counting{total_unmethylated_CpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3780 print {$fhs{$filehandle_index}->{CpG}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3781 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3782 $mbias_1{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3783 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3784 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3785 $mbias_2{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3786 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3787 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3788 elsif ($methylation_calls[$index] eq 'H') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3789 $counting{total_meCHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3790 print {$fhs{$filehandle_index}->{CHH}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3791 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3792 $mbias_1{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3793 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3794 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3795 $mbias_2{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3796 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3797 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3798 elsif ($methylation_calls[$index] eq 'h') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3799 $counting{total_unmethylated_CHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3800 print {$fhs{$filehandle_index}->{CHH}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3801 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3802 $mbias_1{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3803 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3804 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3805 $mbias_2{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3806 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3807 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3808 elsif ($methylation_calls[$index] eq '.') {} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3809 elsif (lc$methylation_calls[$index] eq 'u'){} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3810 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3811 die "The methylation call string contained the following unrecognised character: $methylation_calls[$index]\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3812 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3813 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3814 } elsif ($strand eq '-') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3815 for my $index (0..$#methylation_calls) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3816 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3817 if ($cigar and @comp_cigar){ # only needed for SAM reads with InDels |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3818 # print "index: $index\tmethylation_call: $methylation_calls[$index]\tposition-index: ",$start-$index,"\t"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3819 my ($cigar_mod,$pos_mod) = check_cigar_string($index,$cigar_offset,$pos_offset,$strand,\@comp_cigar); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3820 $cigar_offset += $cigar_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3821 $pos_offset += $pos_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3822 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3823 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3824 if ($methylation_calls[$index] eq 'X') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3825 $counting{total_meCHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3826 print {$fhs{$filehandle_index}->{CHG}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3827 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3828 $mbias_1{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3829 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3830 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3831 $mbias_2{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3832 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3833 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3834 elsif ($methylation_calls[$index] eq 'x') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3835 $counting{total_unmethylated_CHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3836 print {$fhs{$filehandle_index}->{CHG}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3837 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3838 $mbias_1{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3839 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3840 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3841 $mbias_2{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3842 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3843 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3844 elsif ($methylation_calls[$index] eq 'Z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3845 $counting{total_meCpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3846 print {$fhs{$filehandle_index}->{CpG}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3847 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3848 $mbias_1{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3849 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3850 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3851 $mbias_2{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3852 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3853 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3854 elsif ($methylation_calls[$index] eq 'z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3855 $counting{total_unmethylated_CpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3856 print {$fhs{$filehandle_index}->{CpG}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3857 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3858 $mbias_1{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3859 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3860 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3861 $mbias_2{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3862 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3863 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3864 elsif ($methylation_calls[$index] eq 'H') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3865 $counting{total_meCHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3866 print {$fhs{$filehandle_index}->{CHH}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3867 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3868 $mbias_1{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3869 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3870 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3871 $mbias_2{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3872 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3873 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3874 elsif ($methylation_calls[$index] eq 'h') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3875 $counting{total_unmethylated_CHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3876 print {$fhs{$filehandle_index}->{CHH}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3877 if ($read_identity == 1){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3878 $mbias_1{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3879 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3880 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3881 $mbias_2{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3882 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3883 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3884 elsif ($methylation_calls[$index] eq '.') {} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3885 elsif (lc$methylation_calls[$index] eq 'u'){} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3886 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3887 die "The methylation call string contained the following unrecognised character: $methylation_calls[$index]\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3888 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3889 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3890 } else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3891 die "The strand orientation as neither + nor -: '$strand'\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3892 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3893 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3894 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3895 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3896 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3897 sub check_cigar_string { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3898 my ($index,$cigar_offset,$pos_offset,$strand,$comp_cigar) = @_; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3899 # print "$index\t$cigar_offset\t$pos_offset\t$strand\t"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3900 my ($new_cigar_offset,$new_pos_offset) = (0,0); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3901 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3902 if ($strand eq '+') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3903 # print "### $strand strand @$comp_cigar[$index + $cigar_offset]\t"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3904 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3905 if (@$comp_cigar[$index + $cigar_offset + $new_cigar_offset] eq 'M'){ # sequence position matches the genomic position |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3906 # warn "position needs no adjustment\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3907 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3908 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3909 elsif (@$comp_cigar[$index + $cigar_offset + $new_cigar_offset] eq 'I'){ # insertion in the read sequence |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3910 $new_pos_offset -= 1; # we need to subtract the length of inserted bases from the genomic position |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3911 # warn "adjusted genomic position by -1 bp (insertion)\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3912 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3913 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3914 elsif (@$comp_cigar[$index + $cigar_offset + $new_cigar_offset] eq 'D'){ # deletion in the read sequence |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3915 $new_cigar_offset += 1; # the composite cigar string does no longer match the methylation call index |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3916 $new_pos_offset += 1; # we need to add the length of deleted bases to get the genomic position |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3917 # warn "adjusted genomic position by +1 bp (deletion). Now looping through the CIGAR string until we hit another M or I\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3918 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3919 while ( ($index + $cigar_offset + $new_cigar_offset) < (scalar @$comp_cigar) ){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3920 if (@$comp_cigar[$index + $cigar_offset + $new_cigar_offset] eq 'M'){ # sequence position matches the genomic position |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3921 # warn "position needs no adjustment\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3922 last; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3923 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3924 elsif (@$comp_cigar[$index + $cigar_offset + $new_cigar_offset] eq 'I'){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3925 $new_pos_offset -= 1; # we need to subtract the length of inserted bases from the genomic position |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3926 # warn "adjusted genomic position by another -1 bp (insertion)\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3927 last; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3928 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3929 elsif (@$comp_cigar[$index + $cigar_offset + $new_cigar_offset] eq 'D'){ # deletion in the read sequence |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3930 $new_cigar_offset += 1; # the composite cigar string does no longer match the methylation call index |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3931 $new_pos_offset += 1; # we need to add the length of deleted bases to get the genomic position |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3932 # warn "adjusted genomic position by another +1 bp (deletion)\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3933 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3934 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3935 die "The CIGAR string contained undefined operations in addition to 'M', 'I' and 'D': '@$comp_cigar[$index + $cigar_offset + $new_cigar_offset]'\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3936 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3937 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3938 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3939 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3940 die "The CIGAR string contained undefined operations in addition to 'M', 'I' and 'D': '@$comp_cigar[$index + $cigar_offset + $new_cigar_offset]'\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3941 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3942 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3943 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3944 elsif ($strand eq '-') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3945 # print "### $strand strand @$comp_cigar[$index + $cigar_offset]\t"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3946 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3947 if (@$comp_cigar[$index + $cigar_offset + $new_cigar_offset] eq 'M'){ # sequence position matches the genomic position |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3948 # warn "position needs no adjustment\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3949 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3950 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3951 elsif (@$comp_cigar[$index + $cigar_offset + $new_cigar_offset] eq 'I'){ # insertion in the read sequence |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3952 $new_pos_offset += 1; # we need to add the length of inserted bases to the genomic position |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3953 # warn "adjusted genomic position by +1 bp (insertion)\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3954 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3955 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3956 elsif (@$comp_cigar[$index + $cigar_offset + $new_cigar_offset] eq 'D'){ # deletion in the read sequence |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3957 $new_cigar_offset += 1; # the composite cigar string does no longer match the methylation call index |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3958 $new_pos_offset -= 1; # we need to subtract the length of deleted bases to get the genomic position |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3959 # warn "adjusted genomic position by -1 bp (deletion). Now looping through the CIGAR string until we hit another M or I\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3960 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3961 while ( ($index + $cigar_offset + $new_cigar_offset) < (scalar @$comp_cigar) ){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3962 if (@$comp_cigar[$index + $cigar_offset + $new_cigar_offset] eq 'M'){ # sequence position matches the genomic position |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3963 # warn "Found new 'M' operation; position needs no adjustment\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3964 last; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3965 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3966 elsif (@$comp_cigar[$index + $cigar_offset + $new_cigar_offset] eq 'I'){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3967 $new_pos_offset += 1; # we need to subtract the length of inserted bases from the genomic position |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3968 # warn "Found new 'I' operation; adjusted genomic position by another +1 bp (insertion)\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3969 last; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3970 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3971 elsif (@$comp_cigar[$index + $cigar_offset + $new_cigar_offset] eq 'D'){ # deletion in the read sequence |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3972 $new_cigar_offset += 1; # the composite cigar string does no longer match the methylation call index |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3973 $new_pos_offset -= 1; # we need to subtract the length of deleted bases to get the genomic position |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3974 # warn "adjusted genomic position by another -1 bp (deletion)\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3975 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3976 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3977 die "The CIGAR string contained undefined operations in addition to 'M', 'I' and 'D': '@$comp_cigar[$index + $cigar_offset + $new_cigar_offset]'\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3978 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3979 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3980 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3981 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3982 die "The CIGAR string contained undefined operations in addition to 'M', 'I' and 'D': '@$comp_cigar[$index + $cigar_offset + $new_cigar_offset]'\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3983 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3984 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3985 # print "new cigar offset: $new_cigar_offset\tnew pos offset: $new_pos_offset\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3986 return ($new_cigar_offset,$new_pos_offset); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3987 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3988 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3989 sub print_individual_C_methylation_states_single_end{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3990 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3991 my ($meth_call,$chrom,$start,$id,$strand,$filehandle_index,$cigar) = @_; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3992 my @methylation_calls = split(//,$meth_call); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3993 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3994 ################################################################# |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3995 ### . for bases not involving cytosines ### |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3996 ### X for methylated C in CHG context (was protected) ### |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3997 ### x for not methylated C in CHG context (was converted) ### |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3998 ### H for methylated C in CHH context (was protected) ### |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
3999 ### h for not methylated C in CHH context (was converted) ### |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4000 ### Z for methylated C in CpG context (was protected) ### |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4001 ### z for not methylated C in CpG context (was converted) ### |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4002 ################################################################# |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4003 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4004 my $methyl_CHG_count = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4005 my $methyl_CHH_count = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4006 my $methyl_CpG_count = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4007 my $unmethylated_CHG_count = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4008 my $unmethylated_CHH_count = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4009 my $unmethylated_CpG_count = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4010 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4011 my $pos_offset = 0; # this is only relevant for SAM reads with insertions or deletions |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4012 my $cigar_offset = 0; # again, this is only relevant for SAM reads containing indels |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4013 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4014 my @comp_cigar; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4015 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4016 if ($cigar){ # parsing CIGAR string |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4017 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4018 ### Checking whether the CIGAR string is a linear genomic match or whether if requires indel processing |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4019 if ($cigar =~ /^\d+M$/){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4020 # warn "See!? I told you so! $cigar\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4021 # sleep(1); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4022 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4023 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4024 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4025 my @len; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4026 my @ops; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4027 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4028 @len = split (/\D+/,$cigar); # storing the length per operation |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4029 @ops = split (/\d+/,$cigar); # storing the operation |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4030 shift @ops; # remove the empty first element |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4031 # die "CIGAR string contained a non-matching number of lengths and operations: id: $id\nmeth call: $meth_call\nCIGAR: $cigar\n".join(" ",@len)."\n".join(" ",@ops)."\n" unless (scalar @len == scalar @ops); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4032 die "CIGAR string contained a non-matching number of lengths and operations\n" unless (scalar @len == scalar @ops); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4033 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4034 foreach my $index (0..$#len){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4035 foreach (1..$len[$index]){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4036 # print "$ops[$index]"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4037 push @comp_cigar, $ops[$index]; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4038 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4039 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4040 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4041 # warn "\nDetected CIGAR string: $cigar\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4042 # warn "Length of methylation call: ",length $meth_call,"\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4043 # warn "number of operations: ",scalar @ops,"\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4044 # warn "number of length digits: ",scalar @len,"\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4045 # print @comp_cigar,"\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4046 # print "$meth_call\n\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4047 # sleep (1); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4048 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4049 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4050 ### adjusting the start position for all reads mapping to the reverse strand |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4051 if ($strand eq '-') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4052 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4053 if (@comp_cigar){ # only needed for SAM reads with InDels |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4054 @comp_cigar = reverse@comp_cigar; # the CIGAR string needs to be reversed for all reads aligning to the reverse strand, too |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4055 # print @comp_cigar,"\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4056 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4057 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4058 unless ($ignore){ ### if --ignore was specified the start position has already been corrected |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4059 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4060 if ($cigar){ ### SAM format |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4061 if ($cigar =~ /^(\d+)M$/){ # linear match |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4062 $start += $1 - 1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4063 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4064 else{ # InDel read |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4065 my $MD_count = 0; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4066 foreach (@comp_cigar){ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4067 ++$MD_count if ($_ eq 'M' or $_ eq 'D'); # Matching bases or deletions affect the genomic position of the 3' ends of reads, insertions don't |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4068 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4069 $start += $MD_count - 1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4070 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4071 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4072 else{ ### vanilla format |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4073 $start += length($meth_call)-1; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4074 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4075 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4076 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4077 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4078 ### THIS IS THE CpG and Non-CpG SECTION (OPTIONAL) |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4079 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4080 ### single-file CpG and other-context output |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4081 if ($full and $merge_non_CpG) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4082 if ($strand eq '+') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4083 for my $index (0..$#methylation_calls) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4084 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4085 if ($cigar and @comp_cigar){ # only needed for SAM alignments with InDels |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4086 my ($cigar_mod,$pos_mod) = check_cigar_string($index,$cigar_offset,$pos_offset,$strand,\@comp_cigar); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4087 # print "index: $index\tmethylation_call: $methylation_calls[$index]\tposition+index: ",$start+$index,"\t"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4088 $cigar_offset += $cigar_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4089 $pos_offset += $pos_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4090 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4091 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4092 ### methylated Cs (any context) will receive a forward (+) orientation |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4093 ### not methylated Cs (any context) will receive a reverse (-) orientation |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4094 if ($methylation_calls[$index] eq 'X') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4095 $counting{total_meCHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4096 print {$fhs{other_context}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4097 $mbias_1{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4098 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4099 elsif ($methylation_calls[$index] eq 'x') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4100 $counting{total_unmethylated_CHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4101 print {$fhs{other_context}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4102 $mbias_1{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4103 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4104 elsif ($methylation_calls[$index] eq 'Z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4105 $counting{total_meCpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4106 print {$fhs{CpG_context}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4107 $mbias_1{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4108 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4109 elsif ($methylation_calls[$index] eq 'z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4110 $counting{total_unmethylated_CpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4111 print {$fhs{CpG_context}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4112 $mbias_1{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4113 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4114 elsif ($methylation_calls[$index] eq 'H') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4115 $counting{total_meCHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4116 print {$fhs{other_context}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4117 $mbias_1{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4118 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4119 elsif ($methylation_calls[$index] eq 'h') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4120 $counting{total_unmethylated_CHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4121 print {$fhs{other_context}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4122 $mbias_1{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4123 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4124 elsif ($methylation_calls[$index] eq '.') {} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4125 elsif (lc$methylation_calls[$index] eq 'u'){} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4126 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4127 die "The methylation call string contained the following unrecognised character: $methylation_calls[$index]\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4128 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4129 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4130 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4131 elsif ($strand eq '-') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4132 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4133 for my $index (0..$#methylation_calls) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4134 ### methylated Cs (any context) will receive a forward (+) orientation |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4135 ### not methylated Cs (any context) will receive a reverse (-) orientation |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4136 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4137 if ($cigar and @comp_cigar){ # only needed for SAM entries with InDels |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4138 # print "index: $index\tmethylation_call: $methylation_calls[$index]\tposition-index: ",$start-$index,"\t"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4139 my ($cigar_mod,$pos_mod) = check_cigar_string($index,$cigar_offset,$pos_offset,$strand,\@comp_cigar); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4140 $cigar_offset += $cigar_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4141 $pos_offset += $pos_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4142 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4143 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4144 if ($methylation_calls[$index] eq 'X') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4145 $counting{total_meCHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4146 print {$fhs{other_context}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4147 $mbias_1{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4148 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4149 elsif ($methylation_calls[$index] eq 'x') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4150 $counting{total_unmethylated_CHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4151 print {$fhs{other_context}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4152 $mbias_1{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4153 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4154 elsif ($methylation_calls[$index] eq 'Z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4155 $counting{total_meCpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4156 print {$fhs{CpG_context}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4157 $mbias_1{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4158 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4159 elsif ($methylation_calls[$index] eq 'z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4160 $counting{total_unmethylated_CpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4161 print {$fhs{CpG_context}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4162 $mbias_1{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4163 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4164 elsif ($methylation_calls[$index] eq 'H') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4165 $counting{total_meCHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4166 print {$fhs{other_context}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4167 $mbias_1{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4168 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4169 elsif ($methylation_calls[$index] eq 'h') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4170 $counting{total_unmethylated_CHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4171 print {$fhs{other_context}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4172 $mbias_1{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4173 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4174 elsif ($methylation_calls[$index] eq '.'){} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4175 elsif (lc$methylation_calls[$index] eq 'u'){} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4176 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4177 die "The methylation call string contained the following unrecognised character: $methylation_calls[$index]\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4178 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4179 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4180 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4181 else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4182 die "The strand information was neither + nor -: $strand\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4183 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4184 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4185 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4186 ### strand-specific methylation output |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4187 elsif ($merge_non_CpG) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4188 if ($strand eq '+') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4189 for my $index (0..$#methylation_calls) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4190 ### methylated Cs (any context) will receive a forward (+) orientation |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4191 ### not methylated Cs (any context) will receive a reverse (-) orientation |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4192 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4193 if ($cigar and @comp_cigar){ # only needed for SAM reads with Indels |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4194 my ($cigar_mod,$pos_mod) = check_cigar_string($index,$cigar_offset,$pos_offset,$strand,\@comp_cigar); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4195 $cigar_offset += $cigar_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4196 $pos_offset += $pos_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4197 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4198 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4199 if ($methylation_calls[$index] eq 'X') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4200 $counting{total_meCHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4201 print {$fhs{$filehandle_index}->{other_c}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4202 $mbias_1{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4203 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4204 elsif ($methylation_calls[$index] eq 'x') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4205 $counting{total_unmethylated_CHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4206 print {$fhs{$filehandle_index}->{other_c}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4207 $mbias_1{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4208 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4209 elsif ($methylation_calls[$index] eq 'Z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4210 $counting{total_meCpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4211 print {$fhs{$filehandle_index}->{CpG}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4212 $mbias_1{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4213 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4214 elsif ($methylation_calls[$index] eq 'z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4215 $counting{total_unmethylated_CpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4216 print {$fhs{$filehandle_index}->{CpG}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4217 $mbias_1{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4218 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4219 elsif ($methylation_calls[$index] eq 'H') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4220 $counting{total_meCHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4221 print {$fhs{$filehandle_index}->{other_c}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4222 $mbias_1{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4223 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4224 elsif ($methylation_calls[$index] eq 'h') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4225 $counting{total_unmethylated_CHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4226 print {$fhs{$filehandle_index}->{other_c}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4227 $mbias_1{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4228 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4229 elsif ($methylation_calls[$index] eq '.') {} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4230 elsif (lc$methylation_calls[$index] eq 'u'){} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4231 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4232 die "The methylation call string contained the following unrecognised character: $methylation_calls[$index]\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4233 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4234 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4235 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4236 elsif ($strand eq '-') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4237 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4238 for my $index (0..$#methylation_calls) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4239 ### methylated Cs (any context) will receive a forward (+) orientation |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4240 ### not methylated Cs (any context) will receive a reverse (-) orientation |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4241 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4242 if ($cigar and @comp_cigar){ # only needed for SAM reads with Indels |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4243 my ($cigar_mod,$pos_mod) = check_cigar_string($index,$cigar_offset,$pos_offset,$strand,\@comp_cigar); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4244 $cigar_offset += $cigar_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4245 $pos_offset += $pos_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4246 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4247 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4248 if ($methylation_calls[$index] eq 'X') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4249 $counting{total_meCHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4250 print {$fhs{$filehandle_index}->{other_c}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4251 $mbias_1{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4252 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4253 elsif ($methylation_calls[$index] eq 'x') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4254 $counting{total_unmethylated_CHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4255 print {$fhs{$filehandle_index}->{other_c}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4256 $mbias_1{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4257 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4258 elsif ($methylation_calls[$index] eq 'Z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4259 $counting{total_meCpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4260 print {$fhs{$filehandle_index}->{CpG}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4261 $mbias_1{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4262 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4263 elsif ($methylation_calls[$index] eq 'z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4264 $counting{total_unmethylated_CpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4265 print {$fhs{$filehandle_index}->{CpG}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4266 $mbias_1{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4267 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4268 elsif ($methylation_calls[$index] eq 'H') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4269 $counting{total_meCHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4270 print {$fhs{$filehandle_index}->{other_c}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4271 $mbias_1{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4272 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4273 elsif ($methylation_calls[$index] eq 'h') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4274 $counting{total_unmethylated_CHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4275 print {$fhs{$filehandle_index}->{other_c}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4276 $mbias_1{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4277 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4278 elsif ($methylation_calls[$index] eq '.') {} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4279 elsif (lc$methylation_calls[$index] eq 'u'){} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4280 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4281 die "The methylation call string contained the following unrecognised character: $methylation_calls[$index]\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4282 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4283 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4284 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4285 else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4286 die "The strand information was neither + nor -: $strand\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4287 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4288 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4289 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4290 ### THIS IS THE 3-CONTEXT (CpG, CHG and CHH) DEFAULT SECTION |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4291 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4292 elsif ($full) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4293 if ($strand eq '+') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4294 for my $index (0..$#methylation_calls) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4295 ### methylated Cs (any context) will receive a forward (+) orientation |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4296 ### not methylated Cs (any context) will receive a reverse (-) orientation |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4297 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4298 if ($cigar and @comp_cigar){ # only needed for SAM reads with Indels |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4299 my ($cigar_mod,$pos_mod) = check_cigar_string($index,$cigar_offset,$pos_offset,$strand,\@comp_cigar); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4300 $cigar_offset += $cigar_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4301 $pos_offset += $pos_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4302 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4303 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4304 if ($methylation_calls[$index] eq 'X') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4305 $counting{total_meCHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4306 print {$fhs{CHG_context}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4307 $mbias_1{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4308 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4309 elsif ($methylation_calls[$index] eq 'x') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4310 $counting{total_unmethylated_CHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4311 print {$fhs{CHG_context}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4312 $mbias_1{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4313 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4314 elsif ($methylation_calls[$index] eq 'Z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4315 $counting{total_meCpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4316 print {$fhs{CpG_context}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4317 $mbias_1{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4318 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4319 elsif ($methylation_calls[$index] eq 'z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4320 $counting{total_unmethylated_CpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4321 print {$fhs{CpG_context}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4322 $mbias_1{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4323 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4324 elsif ($methylation_calls[$index] eq 'H') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4325 $counting{total_meCHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4326 print {$fhs{CHH_context}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4327 $mbias_1{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4328 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4329 elsif ($methylation_calls[$index] eq 'h') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4330 $counting{total_unmethylated_CHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4331 print {$fhs{CHH_context}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4332 $mbias_1{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4333 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4334 elsif ($methylation_calls[$index] eq '.') {} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4335 elsif (lc$methylation_calls[$index] eq 'u'){} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4336 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4337 die "The methylation call string contained the following unrecognised character: $methylation_calls[$index]\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4338 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4339 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4340 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4341 elsif ($strand eq '-') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4342 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4343 for my $index (0..$#methylation_calls) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4344 ### methylated Cs (any context) will receive a forward (+) orientation |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4345 ### not methylated Cs (any context) will receive a reverse (-) orientation |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4346 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4347 if ($cigar and @comp_cigar){ # only needed for SAM reads with Indels |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4348 my ($cigar_mod,$pos_mod) = check_cigar_string($index,$cigar_offset,$pos_offset,$strand,\@comp_cigar); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4349 $cigar_offset += $cigar_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4350 $pos_offset += $pos_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4351 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4352 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4353 if ($methylation_calls[$index] eq 'X') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4354 $counting{total_meCHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4355 print {$fhs{CHG_context}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4356 $mbias_1{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4357 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4358 elsif ($methylation_calls[$index] eq 'x') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4359 $counting{total_unmethylated_CHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4360 print {$fhs{CHG_context}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4361 $mbias_1{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4362 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4363 elsif ($methylation_calls[$index] eq 'Z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4364 $counting{total_meCpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4365 print {$fhs{CpG_context}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4366 $mbias_1{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4367 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4368 elsif ($methylation_calls[$index] eq 'z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4369 $counting{total_unmethylated_CpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4370 print {$fhs{CpG_context}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4371 $mbias_1{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4372 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4373 elsif ($methylation_calls[$index] eq 'H') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4374 $counting{total_meCHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4375 print {$fhs{CHH_context}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4376 $mbias_1{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4377 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4378 elsif ($methylation_calls[$index] eq 'h') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4379 $counting{total_unmethylated_CHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4380 print {$fhs{CHH_context}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4381 $mbias_1{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4382 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4383 elsif ($methylation_calls[$index] eq '.') {} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4384 elsif (lc$methylation_calls[$index] eq 'u'){} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4385 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4386 die "The methylation call string contained the following unrecognised character: $methylation_calls[$index]\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4387 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4388 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4389 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4390 else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4391 die "The read had a strand orientation which was neither + nor -: $strand\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4392 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4393 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4394 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4395 ### strand-specific methylation output |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4396 else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4397 if ($strand eq '+') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4398 for my $index (0..$#methylation_calls) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4399 ### methylated Cs (any context) will receive a forward (+) orientation |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4400 ### not methylated Cs (any context) will receive a reverse (-) orientation |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4401 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4402 if ($cigar and @comp_cigar){ # only needed for SAM reads with Indels |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4403 my ($cigar_mod,$pos_mod) = check_cigar_string($index,$cigar_offset,$pos_offset,$strand,\@comp_cigar); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4404 $cigar_offset += $cigar_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4405 $pos_offset += $pos_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4406 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4407 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4408 if ($methylation_calls[$index] eq 'X') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4409 $counting{total_meCHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4410 print {$fhs{$filehandle_index}->{CHG}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4411 $mbias_1{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4412 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4413 elsif ($methylation_calls[$index] eq 'x') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4414 $counting{total_unmethylated_CHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4415 print {$fhs{$filehandle_index}->{CHG}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4416 $mbias_1{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4417 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4418 elsif ($methylation_calls[$index] eq 'Z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4419 $counting{total_meCpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4420 print {$fhs{$filehandle_index}->{CpG}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4421 $mbias_1{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4422 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4423 elsif ($methylation_calls[$index] eq 'z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4424 $counting{total_unmethylated_CpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4425 print {$fhs{$filehandle_index}->{CpG}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4426 $mbias_1{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4427 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4428 elsif ($methylation_calls[$index] eq 'H') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4429 $counting{total_meCHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4430 print {$fhs{$filehandle_index}->{CHH}} join ("\t",$id,'+',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4431 $mbias_1{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4432 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4433 elsif ($methylation_calls[$index] eq 'h') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4434 $counting{total_unmethylated_CHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4435 print {$fhs{$filehandle_index}->{CHH}} join ("\t",$id,'-',$chrom,$start+$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4436 $mbias_1{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4437 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4438 elsif ($methylation_calls[$index] eq '.') {} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4439 elsif (lc$methylation_calls[$index] eq 'u'){} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4440 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4441 die "The methylation call string contained the following unrecognised character: $methylation_calls[$index]\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4442 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4443 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4444 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4445 elsif ($strand eq '-') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4446 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4447 for my $index (0..$#methylation_calls) { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4448 ### methylated Cs (any context) will receive a forward (+) orientation |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4449 ### not methylated Cs (any context) will receive a reverse (-) orientation |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4450 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4451 if ($cigar and @comp_cigar){ # only needed for SAM reads with Indels |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4452 my ($cigar_mod,$pos_mod) = check_cigar_string($index,$cigar_offset,$pos_offset,$strand,\@comp_cigar); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4453 $cigar_offset += $cigar_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4454 $pos_offset += $pos_mod; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4455 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4456 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4457 if ($methylation_calls[$index] eq 'X') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4458 $counting{total_meCHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4459 print {$fhs{$filehandle_index}->{CHG}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4460 $mbias_1{CHG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4461 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4462 elsif ($methylation_calls[$index] eq 'x') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4463 $counting{total_unmethylated_CHG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4464 print {$fhs{$filehandle_index}->{CHG}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4465 $mbias_1{CHG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4466 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4467 elsif ($methylation_calls[$index] eq 'Z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4468 $counting{total_meCpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4469 print {$fhs{$filehandle_index}->{CpG}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4470 $mbias_1{CpG}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4471 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4472 elsif ($methylation_calls[$index] eq 'z') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4473 $counting{total_unmethylated_CpG_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4474 print {$fhs{$filehandle_index}->{CpG}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4475 $mbias_1{CpG}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4476 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4477 elsif ($methylation_calls[$index] eq 'H') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4478 $counting{total_meCHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4479 print {$fhs{$filehandle_index}->{CHH}} join ("\t",$id,'+',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4480 $mbias_1{CHH}->{$index+1}->{meth}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4481 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4482 elsif ($methylation_calls[$index] eq 'h') { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4483 $counting{total_unmethylated_CHH_count}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4484 print {$fhs{$filehandle_index}->{CHH}} join ("\t",$id,'-',$chrom,$start-$index+$pos_offset,$methylation_calls[$index]),"\n" unless($mbias_only); |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4485 $mbias_1{CHH}->{$index+1}->{un}++; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4486 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4487 elsif ($methylation_calls[$index] eq '.') {} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4488 elsif (lc$methylation_calls[$index] eq 'u'){} |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4489 else{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4490 die "The methylation call string contained the following unrecognised character: $methylation_calls[$index]\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4491 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4492 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4493 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4494 else { |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4495 die "The strand information was neither + nor -: $strand\n"; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4496 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4497 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4498 } |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4499 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4500 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4501 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4502 sub print_helpfile{ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4503 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4504 print << 'HOW_TO'; |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4505 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4506 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4507 DESCRIPTION |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4508 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4509 The following is a brief description of all options to control the Bismark |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4510 methylation extractor. The script reads in a bisulfite read alignment results file |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4511 produced by the Bismark bisulfite mapper and extracts the methylation information |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4512 for individual cytosines. This information is found in the methylation call field |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4513 which can contain the following characters: |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4514 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4515 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4516 ~~~ X for methylated C in CHG context ~~~ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4517 ~~~ x for not methylated C CHG ~~~ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4518 ~~~ H for methylated C in CHH context ~~~ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4519 ~~~ h for not methylated C in CHH context ~~~ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4520 ~~~ Z for methylated C in CpG context ~~~ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4521 ~~~ z for not methylated C in CpG context ~~~ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4522 ~~~ U for methylated C in Unknown context (CN or CHN ~~~ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4523 ~~~ u for not methylated C in Unknown context (CN or CHN) ~~~ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4524 ~~~ . for any bases not involving cytosines ~~~ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4525 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4526 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4527 The methylation extractor outputs result files for cytosines in CpG, CHG and CHH |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4528 context (this distinction is actually already made in Bismark itself). As the methylation |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4529 information for every C analysed can produce files which easily have tens or even hundreds of |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4530 millions of lines, file sizes can become very large and more difficult to handle. The C |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4531 methylation info additionally splits cytosine methylation calls up into one of the four possible |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4532 strands a given bisulfite read aligned against: |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4533 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4534 OT original top strand |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4535 CTOT complementary to original top strand |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4536 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4537 OB original bottom strand |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4538 CTOB complementary to original bottom strand |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4539 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4540 Thus, by default twelve individual output files are being generated per input file (unless |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4541 --comprehensive is specified, see below). The output files can be imported into a genome |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4542 viewer, such as SeqMonk, and re-combined into a single data group if desired (in fact |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4543 unless the bisulfite reads were generated preserving directionality it doesn't make any |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4544 sense to look at the data in a strand-specific manner). Strand-specific output files can |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4545 optionally be skipped, in which case only three output files for CpG, CHG or CHH context |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4546 will be generated. For both the strand-specific and comprehensive outputs there is also |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4547 the option to merge both non-CpG contexts (CHG and CHH) into one single non-CpG context. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4548 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4549 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4550 The output files are in the following format (tab delimited): |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4551 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4552 <sequence_id> <strand> <chromosome> <position> <methylation call> |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4553 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4554 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4555 USAGE: methylation_extractor [options] <filenames> |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4556 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4557 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4558 ARGUMENTS: |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4559 ========== |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4560 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4561 <filenames> A space-separated list of Bismark result files in SAM format from |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4562 which methylation information is extracted for every cytosine in |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4563 the reads. For alignment files in the older custom Bismark output |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4564 see option '--vanilla'. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4565 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4566 OPTIONS: |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4567 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4568 -s/--single-end Input file(s) are Bismark result file(s) generated from single-end |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4569 read data. Specifying either --single-end or --paired-end is |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4570 mandatory. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4571 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4572 -p/--paired-end Input file(s) are Bismark result file(s) generated from paired-end |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4573 read data. Specifying either --paired-end or --single-end is |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4574 mandatory. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4575 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4576 --vanilla The Bismark result input file(s) are in the old custom Bismark format |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4577 (up to version 0.5.x) and not in SAM format which is the default as |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4578 of Bismark version 0.6.x or higher. Default: OFF. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4579 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4580 --no_overlap For paired-end reads it is theoretically possible that read_1 and |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4581 read_2 overlap. This option avoids scoring overlapping methylation |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4582 calls twice (only methylation calls of read 1 are used for in the process |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4583 since read 1 has historically higher quality basecalls than read 2). |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4584 Whilst this option removes a bias towards more methylation calls |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4585 in the center of sequenced fragments it may de facto remove a sizable |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4586 proportion of the data. This option is highly recommended for paired-end |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4587 data. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4588 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4589 --ignore <int> Ignore the first <int> bp from the 5' end of Read 1 when processing the |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4590 methylation call string. This can remove e.g. a restriction enzyme site |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4591 at the start of each read or any other source of bias (e.g. PBAT-Seq data). |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4592 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4593 --ignore_r2 <int> Ignore the first <int> bp from the 5' end of Read 2 of paired-end sequencing |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4594 results only. Since the first couple of bases in Read 2 of BS-Seq experiments |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4595 show a severe bias towards non-methylation as a result of end-repairing |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4596 sonicated fragments with unmethylated cytosines (see M-bias plot), it is |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4597 recommended that the first couple of bp of Read 2 are removed before |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4598 starting downstream analysis. Please see the section on M-bias plots in the |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4599 Bismark User Guide for more details. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4600 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4601 --comprehensive Specifying this option will merge all four possible strand-specific |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4602 methylation info into context-dependent output files. The default |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4603 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4604 contexts are: |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4605 - CpG context |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4606 - CHG context |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4607 - CHH context |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4608 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4609 --merge_non_CpG This will produce two output files (in --comprehensive mode) or eight |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4610 strand-specific output files (default) for Cs in |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4611 - CpG context |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4612 - non-CpG context |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4613 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4614 --report Prints out a short methylation summary as well as the paramaters used to run |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4615 this script. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4616 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4617 --no_header Suppresses the Bismark version header line in all output files for more convenient |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4618 batch processing. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4619 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4620 -o/--output DIR Allows specification of a different output directory (absolute or relative |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4621 path). If not specified explicitely, the output will be written to the current directory. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4622 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4623 --samtools_path The path to your Samtools installation, e.g. /home/user/samtools/. Does not need to be specified |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4624 explicitly if Samtools is in the PATH already. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4625 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4626 --gzip The methylation extractor files (CpG_OT_..., CpG_OB_... etc) will be written out in |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4627 a GZIP compressed form to save disk space. This option does not work on bedGraph and |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4628 genome-wide cytosine reports as they are 'tiny' anyway. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4629 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4630 --version Displays version information. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4631 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4632 -h/--help Displays this help file and exits. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4633 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4634 --mbias_only The methylation extractor will read the entire file but only output the M-bias table and plots as |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4635 well as a report (optional) and then quit. Default: OFF. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4636 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4637 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4638 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4639 bedGraph specific options: |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4640 ========================== |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4641 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4642 --bedGraph After finishing the methylation extraction, the methylation output is written into a |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4643 sorted bedGraph file that reports the position of a given cytosine and its methylation |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4644 state (in %, see details below). The methylation extractor output is temporarily split up into |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4645 temporary files, one per chromosome (written into the current directory or folder |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4646 specified with -o/--output); these temp files are then used for sorting and deleted |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4647 afterwards. By default, only cytosines in CpG context will be sorted. The option |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4648 '--CX_context' may be used to report all cytosines irrespective of sequence context |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4649 (this will take MUCH longer!). The default folder for temporary files during the sorting |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4650 process is the output directory. The bedGraph conversion step is performed by the external |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4651 module 'bismark2bedGraph'; this script needs to reside in the same folder as the |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4652 bismark_methylation_extractor itself. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4653 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4654 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4655 --cutoff [threshold] The minimum number of times a methylation state has to be seen for that nucleotide |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4656 before its methylation percentage is reported. Default: 1. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4657 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4658 --remove_spaces Replaces whitespaces in the sequence ID field with underscores to allow sorting. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4659 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4660 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4661 --CX/--CX_context The sorted bedGraph output file contains information on every single cytosine that was covered |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4662 in the experiment irrespective of its sequence context. This applies to both forward and |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4663 reverse strands. Please be aware that this option may generate large temporary and output files |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4664 and may take a long time to sort (up to many hours). Default: OFF. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4665 (i.e. Default = CpG context only). |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4666 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4667 --buffer_size <string> This allows you to specify the main memory sort buffer when sorting the methylation information. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4668 Either specify a percentage of physical memory by appending % (e.g. --buffer_size 50%) or |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4669 a multiple of 1024 bytes, e.g. 'K' multiplies by 1024, 'M' by 1048576 and so on for 'T' etc. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4670 (e.g. --buffer_size 20G). For more information on sort type 'info sort' on a command line. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4671 Defaults to 2G. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4672 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4673 --scaffolds/--gazillion Users working with unfinished genomes sporting tens or even hundreds of thousands of |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4674 scaffolds/contigs/chromosomes frequently encountered errors with pre-sorting reads to |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4675 individual chromosome files. These errors were caused by the operating system's limit |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4676 of the number of filehandle that can be written to at any one time (typically 1024; to |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4677 find out this limit on Linux, type: ulimit -a). |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4678 To bypass the limitation of open filehandles, the option --scaffolds does not pre-sort |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4679 methylation calls into individual chromosome files. Instead, all input files are |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4680 temporarily merged into a single file (unless there is only a single file), and this |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4681 file will then be sorted by both chromosome AND position using the Unix sort command. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4682 Please be aware that this option might take a looooong time to complete, depending on |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4683 the size of the input files, and the memory you allocate to this process (see --buffer_size). |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4684 Nevertheless, it seems to be working. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4685 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4686 --ample_memory Using this option will not sort chromosomal positions using the UNIX 'sort' command, but will |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4687 instead use two arrays to sort methylated and unmethylated calls. This may result in a faster |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4688 sorting process of very large files, but this comes at the cost of a larger memory footprint |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4689 (two arrays of the length of the largest human chromosome 1 (~250M bp) consume around 16GB |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4690 of RAM). Due to overheads in creating and looping through these arrays it seems that it will |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4691 actually be *slower* for small files (few million alignments), and we are currently testing at |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4692 which point it is advisable to use this option. Note that --ample_memory is not compatible |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4693 with options '--scaffolds/--gazillion' (as it requires pre-sorted files to begin with). |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4694 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4695 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4696 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4697 Genome-wide cytosine methylation report specific options: |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4698 ========================================================= |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4699 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4700 --cytosine_report After the conversion to bedGraph has completed, the option '--cytosine_report' produces a |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4701 genome-wide methylation report for all cytosines in the genome. By default, the output uses 1-based |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4702 chromosome coordinates (zero-based cords are optional) and reports CpG context only (all |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4703 cytosine context is optional). The output considers all Cs on both forward and reverse strands and |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4704 reports their position, strand, trinucleotide content and methylation state (counts are 0 if not |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4705 covered). The cytsoine report conversion step is performed by the external module |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4706 'bedGraph2cytosine'; this script needs to reside in the same folder as the bismark_methylation_extractor |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4707 itself. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4708 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4709 --CX/--CX_context The output file contains information on every single cytosine in the genome irrespective of |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4710 its context. This applies to both forward and reverse strands. Please be aware that this will |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4711 generate output files with > 1.1 billion lines for a mammalian genome such as human or mouse. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4712 Default: OFF (i.e. Default = CpG context only). |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4713 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4714 --zero_based Uses zero-based coordinates like used in e.g. bed files instead of 1-based coordinates. Default: OFF. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4715 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4716 --genome_folder <path> Enter the genome folder you wish to use to extract sequences from (full path only). Accepted |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4717 formats are FastA files ending with '.fa' or '.fasta'. Specifying a genome folder path is mandatory. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4718 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4719 --split_by_chromosome Writes the output into individual files for each chromosome instead of a single output file. Files |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4720 will be named to include the input filename and the chromosome number. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4721 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4722 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4723 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4724 OUTPUT: |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4725 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4726 The bismark_methylation_extractor output is in the form: |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4727 ======================================================== |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4728 <seq-ID> <methylation state*> <chromosome> <start position (= end position)> <methylation call> |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4729 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4730 * Methylated cytosines receive a '+' orientation, |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4731 * Unmethylated cytosines receive a '-' orientation. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4732 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4733 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4734 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4735 The bedGraph output (optional) looks like this (tab-delimited; 0-based start coords, 1-based end coords): |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4736 ========================================================================================================= |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4737 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4738 track type=bedGraph (header line) |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4739 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4740 <chromosome> <start position> <end position> <methylation percentage> |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4741 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4742 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4743 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4744 The coverage output looks like this (tab-delimited, 1-based genomic coords): |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4745 ============================================================================ |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4746 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4747 <chromosome> <start position> <end position> <methylation percentage> <count methylated> <count non-methylated> |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4748 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4749 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4750 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4751 The genome-wide cytosine methylation output file is tab-delimited in the following format: |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4752 ========================================================================================== |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4753 <chromosome> <position> <strand> <count methylated> <count non-methylated> <C-context> <trinucleotide context> |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4754 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4755 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4756 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4757 This script was last modified on 25 November 2013. |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4758 |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4759 HOW_TO |
fcadce4d9a06
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
diff
changeset
|
4760 } |