[Bio] / FigKernelScripts / ma_pipeline.pl Repository:
ViewVC logotype

Annotation of /FigKernelScripts/ma_pipeline.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.10 - (view) (download) (as text)

1 : overbeek 1.1 use strict;
2 :     use Data::Dumper;
3 :    
4 : overbeek 1.3 my $usage = "usage: ma_pipeline Genome RMA-key";
5 : overbeek 1.1
6 : overbeek 1.3 my($genome,$orgD);
7 : overbeek 1.1 (
8 : overbeek 1.3 ($genome = shift @ARGV) && ($orgD = "$FIG_Config::organisms/$genome")
9 : overbeek 1.1 )
10 :     || die $usage;
11 : overbeek 1.3
12 :     (-d $orgD) || die "invalid organism directory";
13 :    
14 :     (my $rma_key = shift @ARGV)
15 : overbeek 1.2 || die $usage;
16 : overbeek 1.1
17 :     my $exp_ed = "$orgD/UserSpace/ExpressionData";
18 :     (-d $exp_ed)
19 :     || die "Where is $exp_ed?";
20 :     (-s "$exp_ed/probes")
21 :     || die "Where is $exp_ed/probes?";
22 :     (-s "$orgD/contigs")
23 :     || die "Where is $orgD/contigs?";
24 :     (-s "$orgD/Features/peg/tbl")
25 :     || die "Where is $orgD/Features/peg/tbl?";
26 :    
27 : overbeek 1.10 my $tbl = (-s "$exp_ed/tbl") ? "$exp_ed/tbl" : $orgD/Features/peg/tbl;
28 :     &run("make_probes_to_genes $exp_ed/probes $orgD/contigs $tbl $exp_ed/peg.probe.table $exp_ed/probe.occ.table 2> $exp_ed/problems");
29 : overbeek 1.4 &run("remove_multiple_occurring_probes $exp_ed/peg.probe.table $exp_ed/probe.occ.table > $exp_ed/peg.probe.table.no.multiple");
30 : overbeek 1.3 chdir $exp_ed;
31 :    
32 : overbeek 1.9 &make_missing_probes("$exp_ed/peg.probe.table.no.multiple", "$exp_ed/probes", "$exp_ed/probe.no.match");
33 :    
34 :     &run("Rscript $FIG_Config::bin/RunRMA.R $rma_key $exp_ed $exp_ed/Experiments 2> $exp_ed/stderr.RMA");
35 : overbeek 1.3 &run("$FIG_Config::bin/call_coregulated_clusters_on_chromosome $genome $exp_ed/raw_data.tab > $exp_ed/coregulated.clusters 2> $exp_ed/stderr.coregulated.clusters");
36 :     &run("$FIG_Config::bin/make_coreg_conjectures_based_on_subsys $genome $exp_ed/raw_data.tab > $exp_ed/coregulated.subsys 2> $exp_ed/stderr.coregulated.subsys");
37 : overbeek 1.7 &run("cat $exp_ed/coregulated.clusters $exp_ed/coregulated.subsys | cut -f1 | $FIG_Config::bin/merge_gene_sets | filter_on_known $exp_ed/raw_data.tab > $exp_ed/merged.clusters");
38 : overbeek 1.5
39 : overbeek 1.7 &run("get_ON_probes $genome $exp_ed/probe.occ.table $exp_ed/peg.probe.table $exp_ed/raw_data.tab > $exp_ed/probes.always.on");
40 : overbeek 1.8 &run("cut -f2 $exp_ed/probes.always.on | sort -u > $exp_ed/pegs.always.on");
41 : overbeek 1.6 &run("Rscript $FIG_Config::bin/Pipeline.R $exp_ed/pegs.always.on $exp_ed/merged.clusters > $exp_ed/comments.by.Pipeline.R");
42 : overbeek 1.3 &run("Rscript $FIG_Config::bin/SplitGeneSets.R $exp_ed/merged.clusters 0.7 > $exp_ed/split.clusters");
43 : overbeek 1.9
44 :     sub make_missing_probes
45 :     {
46 :     my($probe_table, $probes, $output) = @_;
47 :     open(MATCH,"<", $probe_table) or die "Cannot open $probe_table: $!";
48 :     open(PROBES,"<", $probes) or die "Cannot open $probes: $!";
49 :     open(OUTPUT, ">", $output) or die "Cannot open $output: $!";
50 :     my %locations;
51 :     while(<MATCH>)
52 :     {
53 :     chomp;
54 :     my($peg,$loc)=split "\t";
55 :     $locations{$loc} = $peg;
56 :     }
57 :    
58 :     while(<PROBES>)
59 :     {
60 :     chomp;
61 :     my($loc,$seq) = split "\t";
62 :     print OUTPUT $loc, "\n" if ! exists $locations{$loc};
63 :     }
64 :     close(MATCH);
65 :     close(PROBES);
66 :     close(OUTPUT);
67 :     }
68 : overbeek 1.3
69 :     sub run {
70 :     shift if UNIVERSAL::isa($_[0],__PACKAGE__);
71 :     my($cmd) = @_;
72 : overbeek 1.2
73 : overbeek 1.3 if ($ENV{FIG_VERBOSE}) {
74 :     my @tmp = `date`;
75 :     chomp @tmp;
76 :     print STDERR "$tmp[0]: running $cmd\n";
77 :     }
78 :     (system($cmd) == 0) || die("FAILED: $cmd");
79 :     }
80 : overbeek 1.2

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3