Mercurial > repos > dereeper > pangenome_explorer
comparison PanExplorer_workflow/Perl/Heatmaply.pl @ 1:032f6b3806a3 draft
Uploaded
author | dereeper |
---|---|
date | Thu, 30 May 2024 11:16:08 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:3cbb01081cde | 1:032f6b3806a3 |
---|---|
1 #!/usr/bin/perl | |
2 | |
3 my $in = $ARGV[0]; | |
4 my $out = $ARGV[1]; | |
5 my $rowmetadata = $ARGV[2]; | |
6 my $colmetadata = $ARGV[3]; | |
7 | |
8 my %hash; | |
9 my %hash2; | |
10 my $n = 0; | |
11 open(M,$rowmetadata); | |
12 while(<M>){ | |
13 my $line = $_; | |
14 $line =~s/\n//g;$line =~s/\r//g; | |
15 $n++; | |
16 my @infos = split(/\t/,$line); | |
17 my $genus = $infos[1]; | |
18 my $country = $infos[2]; | |
19 my $continent = $infos[3]; | |
20 $hash{$n} = "Genus: $genus <br>Country: $country <br> Continent: $continent"; | |
21 } | |
22 close(M); | |
23 | |
24 my $k = 0; | |
25 open(M,$colmetadata); | |
26 while(<M>){ | |
27 my $line = $_; | |
28 $line =~s/\n//g;$line =~s/\r//g; | |
29 $k++; | |
30 my @infos = split(/\t/,$line); | |
31 my $cog = $infos[1]; | |
32 my $cog_cat = $infos[2]; | |
33 my $function = $infos[3]; | |
34 $hash2{$k} = "Description: $function <br>COG: $cog <br>COG category: $cog_cat"; | |
35 } | |
36 close(M); | |
37 | |
38 open(T,">$in.metadata_tooltips.txt"); | |
39 foreach my $n(sort {$a<=>$b} keys(%hash)){ | |
40 | |
41 my $country = $hash{$n}; | |
42 foreach my $k(sort {$a<=>$b} keys(%hash2)){ | |
43 my $cog = $hash2{$k}; | |
44 print T "<br>$cog <br><br>$country \t"; | |
45 } | |
46 print T "\n"; | |
47 } | |
48 close(T); | |
49 | |
50 use strict; | |
51 system("ulimit -s 163840;Rscript $dirname/../R/heatmaply.R -f $in -o $out -c $colmetadata -r $rowmetadata"); |