1
|
1 ########################################################################
|
|
2 # JAMMv1.0.7rev1 is a peak finder for joint analysis of NGS replicates.
|
|
3 # Copyright (C) 2014-2015 Mahmoud Ibrahim
|
|
4 #
|
|
5 # This program is free software: you can redistribute it and/or modify
|
|
6 # it under the terms of the GNU General Public License as published by
|
|
7 # the Free Software Foundation, either version 3 of the License, or
|
|
8 # (at your option) any later version.
|
|
9 #
|
|
10 # This program is distributed in the hope that it will be useful,
|
|
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 # GNU General Public License for more details.
|
|
14 #
|
|
15 # You should have received a copy of the GNU General Public License
|
|
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17 #
|
|
18 # Contact: mahmoud.ibrahim@mdc-berlin.de
|
|
19 ########################################################################
|
0
|
20
|
|
21
|
|
22 use feature qw(say);
|
|
23
|
|
24
|
|
25 # ==================
|
|
26 # Parsing Arguments
|
|
27 # ==================
|
|
28 #initialize to NULL
|
|
29 my $bed_file = NULL; #bed file
|
|
30
|
|
31 #Parse the arguments
|
|
32 $bed_file = $ARGV[0]; #bed file
|
|
33 #=======================> DONE!
|
|
34
|
|
35
|
|
36
|
|
37
|
|
38 # ========================================
|
|
39 # Parse the bed file and extend the reads
|
|
40 # ========================================
|
|
41 #open the file
|
|
42 open(DATA, $bed_file) || die("Can't open the bed file, probably you gave me the wrong path!");
|
|
43
|
|
44 while (<DATA>) {
|
|
45 my ($chr, $start, $end, $name, $score, $strand, $signal, $pvalue, $qvalue, $summit, $minpeak, $geom) = split(/\t/,$_,12);
|
|
46
|
|
47 my $size = $end - $start;
|
|
48
|
|
49 if($size >= $minpeak) {
|
|
50 if($signal > $geom) {
|
|
51 #Now write the new line
|
|
52 $summit =~ s/\015?\012?$//;
|
|
53 say join "\t", $chr, $start, $end, $name, $score, $strand, $signal, $pvalue, $qvalue, $summit;
|
|
54 }
|
|
55 }
|
|
56 }
|
|
57 #=======================> DONE!
|