forked from CGU-CERTH/PathTrace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPopulateNodes.pm
74 lines (53 loc) · 1.83 KB
/
PopulateNodes.pm
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/perl
package PopulateNodes;
#use strict;
#use warnings;
# First input: Profile file for GeneTrace
# Second input: Genome list file for GeneTrace
# Third input: Node tree file for GeneTrace
# Forth input: number of intermediate nodes from the GeneTrace graph
# Fifth input: gain parameter for GeneTrace
# Sixth input: loss parameter for GeneTrace
# Seventh input: image name for GeneTraceOutput
# Eigth input: directory name for the Node files
# eg perl populateNodes.pl pathway.profiles geneTraceGenomeList genomeTree.nodes 8 5 2 genetrace.jpg NodePathway
sub populate_nodes{
my @args;
my $num_args = 8;
for(my $i = 0; $i < $num_args; $i++) {
my $tmpArg = $_[$i];
push @args, $tmpArg;
}
if(-e $args[7]){
print "$args[7] directory already exists...\n";
}
elsif(!(mkdir $args[7])) {
die "Unable to create $args[7]\n";
}
print "Running Full geneTrace\n";
my @sysargs_1 = `perl ./geneTrace/geneTrace.pl $args[0] $args[1] $args[2] -all -gain $args[4] -loss $args[5] -img $args[6] > genetrace.populateNodes.output`;
system(@sysargs_1);
print "Starting populating nodes\n";
for(my $id = 0; $id <= $args[3]; $id++) {
print "Running Node$id...\n";
my @sysargs_2 = `perl ./geneTrace/geneTrace.pl $args[0] $args[1] $args[2] -gain $args[4] -loss $args[5] -node node$id > $args[7]/node$id.node`;
system(@sysargs_2);
}
my @genomeIds;
my $first = '';
my $genomeId= '';
open (GENOME_ID_READER, $args[1]);
while (<GENOME_ID_READER>) {
chomp;
($first, $genomeId) = split("\t");
push @genomeIds, $genomeId;
}
close (GENOME_ID_READER);
foreach my $taxaID (@genomeIds){
print "Running $taxaID...\n";
my @sysargs_3 = `perl ./geneTrace/geneTrace.pl $args[0] $args[1] $args[2] -gain $args[4] -loss $args[5] -node $taxaID > $args[7]/$taxaID.node`;
system(@sysargs_3);
}
print "Finished populating nodes\n";
}
1;