-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathanalyzeEpi.pl
More file actions
executable file
·51 lines (48 loc) · 1.27 KB
/
analyzeEpi.pl
File metadata and controls
executable file
·51 lines (48 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
use strict;
my $res = shift;
my %epi;
$epi{'E101'} = "Rectal_Mucosa";
$epi{'E102'} = "Rectal_Mucosa2";
$epi{'E103'} = "Rectal_Smooth_Muscle";
$epi{'E077'} = "Duodenum_Mucosa";
$epi{'E096'} = "Lung";
$epi{'E087'} = "Pancreatic_Islets";
$epi{'E075'} = "Colonic_Mucosa";
open IN, "$res";
my %colnames;
my %colindex;
while ( <IN> ){
chomp;
my @cols = split /\t/;
for(my $i = 0; $i <= $#cols; $i++){ #clean it
$cols[$i] =~ s/\"//g;
$cols[$i] =~ s/[\s\n]$//;
}
if ($_ =~ /^#chr/) {
for(my $i = 0; $i <= $#cols; $i++){
if ($cols[$i] =~ /broadPeak\.sorted\.name/){
$cols[$i] =~ /(E\d+)\-(\w+)\./;
my $tissue = $epi{$1};
my $mark = $2;
$cols[$i] = $tissue.'-'.$mark;
}
$colindex{$cols[$i]} = $i;
$colnames{$i} = $cols[$i];
}
printf("%s\n", join("\t", @cols, 'epi'));
} else {
my $status = 'NA';
for($colindex{'Rectal_Mucosa-H3K27ac'}..$colindex{'Colonic_Mucosa-H3K9me3'}){
my $idx = $_;
my $hmark = $colnames{$idx};
if ($cols[$idx] =~ /^Rank\_(\d+)$/){
if ($1 < 20000){
$status .= "$hmark\=$1," if $status ne 'NA';
$status = "$hmark\=$1," if $status eq 'NA';
}
}
}
printf("%s\n", join("\t", @cols, $status)) if $status =~ /,\w/;
}
}
close IN;