-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathprocessEpiRoadmapMergeMark.pl
More file actions
executable file
·49 lines (46 loc) · 1.25 KB
/
processEpiRoadmapMergeMark.pl
File metadata and controls
executable file
·49 lines (46 loc) · 1.25 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
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/){
$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[0], $cols[1], $cols[2], 'mark'));
} else {
my $status = 'NA';
for($colindex{'Rectal_Mucosa-H3K27ac'}..$colindex{'wgEncodeRegDnaseClusteredV2.sorted'}){
my $idx = $_;
my $hmark = $colnames{$idx};
if ($cols[$idx] == 1){
$status .= "$hmark," if $status ne 'NA';
$status = "$hmark," if $status eq 'NA';
}
}
printf("%s\n", join("\t", $cols[0], $cols[1], $cols[2], $status));
}
}
close IN;