12
|
1 #!/usr/bin/perl -w
|
|
2 use strict;
|
|
3 use File::Basename 'dirname';
|
|
4 use File::Spec;
|
|
5 use Cwd 'abs_path';
|
|
6
|
|
7 my @inputs = @ARGV;
|
|
8 my @inputs2 = @inputs;
|
|
9
|
|
10 my $genome_name = shift(@inputs);
|
|
11 my $genomic_region_source_type__genomic_region = shift(@inputs);
|
|
12 my $genomic_region_source_type__further_information = shift(@inputs);
|
|
13 my $genomic_region_source_type__interval_size = shift(@inputs);
|
|
14 my $genomic_region_source_type__flanking_region_option_source_type__flanking_region_option = shift(@inputs);
|
|
15 my $genomic_region_source_type__flanking_region_option_source_type__flanking_region_size = shift(@inputs);
|
|
16 my $numsamples = shift(@inputs);
|
|
17 my $usepairs = shift(@inputs);
|
|
18
|
|
19 #print STDERR "inputs @inputs\n";
|
|
20
|
|
21 my $randfile = rand(100)."\.config\.txt";
|
|
22 my $randfile2 = $randfile;
|
|
23 $randfile2 =~ s/config\.txt/logfile/gm;
|
|
24
|
|
25 my $outfile = File::Spec->catfile(abs_path(dirname(__FILE__)),"$randfile");
|
|
26 open(FILE,">$outfile");
|
|
27
|
|
28 for (my $i=1;$i<=$numsamples;$i++) {
|
|
29 my $bamfile=shift(@inputs);
|
|
30 my $reffile=shift(@inputs);
|
|
31 my $usegenelist=shift(@inputs);
|
|
32 my $genelist=shift(@inputs);
|
|
33 my $title=shift(@inputs);
|
|
34 my $fraglen=shift(@inputs);
|
|
35 my $color=shift(@inputs);
|
|
36 if ($usepairs eq 'yes') {
|
|
37 syswrite(FILE, "$bamfile\:$reffile\t$genelist\t$title\t$fraglen\t$color\n");
|
|
38 }else {
|
|
39 syswrite(FILE, "$bamfile\t$genelist\t$title\t$fraglen\t$color\n");
|
|
40 }
|
|
41 }
|
|
42 close(FILE);
|
|
43
|
|
44 my $gene_database = shift(@inputs);
|
|
45 my $randomly_sample = shift(@inputs);
|
|
46 my $gene_order = shift(@inputs);
|
|
47 my $knc = shift(@inputs);
|
|
48 my $mit = shift(@inputs);
|
|
49 my $nrs = shift(@inputs);
|
|
50 my $chunk_size = shift(@inputs);
|
|
51 my $quality_requirement = shift(@inputs);
|
|
52 my $standard_error = shift(@inputs);
|
|
53 my $radius_size = shift(@inputs);
|
|
54 my $flooding_fraction = shift(@inputs);
|
|
55 my $smooth_method = shift(@inputs);
|
|
56 my $shaded_area = shift(@inputs);
|
|
57 my $out_name = shift(@inputs);
|
|
58 my $out_avg_name = shift(@inputs);
|
|
59 my $out_hm_name = shift(@inputs);
|
|
60
|
|
61
|
|
62 my $G = $genome_name;
|
|
63 my $R = $genomic_region_source_type__genomic_region;
|
|
64 my $C = $outfile;
|
|
65 my $O = $out_name;
|
|
66 my $O2 = $out_avg_name;
|
|
67 my $O3 = $out_hm_name;
|
|
68 my $F = $genomic_region_source_type__further_information;
|
|
69 my $D = $gene_database;
|
|
70 my $L = $genomic_region_source_type__flanking_region_option_source_type__flanking_region_size;
|
|
71 my $N = $genomic_region_source_type__flanking_region_option_source_type__flanking_region_size;
|
|
72 my $RB = $radius_size;
|
|
73 my $S = $randomly_sample;
|
|
74 my $CS = $chunk_size;
|
|
75 my $MQ = $quality_requirement;
|
|
76 my $IN = $genomic_region_source_type__interval_size;
|
|
77 my $SE = $standard_error;
|
|
78 my $MW = $smooth_method;
|
|
79 my $H = $shaded_area;
|
|
80 my $GO = $gene_order;
|
|
81 my $KNC = $knc;
|
|
82 my $MIT = $mit;
|
|
83 my $NRS = $nrs;
|
|
84 my $FC = $flooding_fraction;
|
|
85
|
|
86 if ($GO eq 'km') {
|
|
87 $GO = "$GO -KNC $KNC -MIT $MIT -NRS $NRS";
|
|
88 }
|
|
89
|
|
90 my $logfile = File::Spec->catfile(abs_path(dirname(__FILE__)),"$randfile2");
|
|
91 open(FILE2,">>$logfile");
|
|
92 my $cmd5="pwd >> $logfile 2>&1";
|
|
93 system($cmd5);
|
|
94
|
|
95 my $cmd='';
|
|
96 if (($R eq 'tss')||($R eq 'tes')) {
|
|
97 $cmd = "ngs.plot.r -Galaxy 1 -P 0 -G $G -R $R -C $C -O $O -O2 $O2 -O3 $O3 -D $D -L $L -S $S -GO $GO -CS $CS -MQ $MQ -SE $SE -RB $RB -FC $FC -MW $MW -H $H >> $logfile 2>&1";
|
|
98 }elsif ($genomic_region_source_type__flanking_region_option_source_type__flanking_region_option eq 'flanking_region_size') {
|
|
99 if ($IN eq 'automatic') {
|
|
100 $cmd = "ngs.plot.r -Galaxy 1 -P 0 -G $G -R $R -C $C -O $O -O2 $O2 -O3 $O3 -D $D -L $L -S $S -GO $GO -CS $CS -MQ $MQ -SE $SE -RB $RB -FC $FC -MW $MW -H $H >> $logfile 2>&1";
|
|
101 }else {
|
|
102 $cmd = "ngs.plot.r -Galaxy 1 -P 0 -G $G -R $R -C $C -O $O -O2 $O2 -O3 $O3 -D $D -L $L -S $S -GO $GO -CS $CS -MQ $MQ -SE $SE -RB $RB -FC $FC -MW $MW -H $H -IN $IN >> $logfile 2>&1";
|
|
103 }
|
|
104 }elsif ($genomic_region_source_type__flanking_region_option_source_type__flanking_region_option eq 'flanking_floating_size') {
|
|
105 if ($IN eq 'automatic') {
|
|
106 $cmd = "ngs.plot.r -Galaxy 1 -P 0 -G $G -R $R -C $C -O $O -O2 $O2 -O3 $O3 -D $D -N $N -S $S -GO $GO -CS $CS -MQ $MQ -SE $SE -RB $RB -FC $FC -MW $MW -H $H >> $logfile 2>&1";
|
|
107 }else {
|
|
108 $cmd = "ngs.plot.r -Galaxy 1 -P 0 -G $G -R $R -C $C -O $O -O2 $O2 -O3 $O3 -D $D -N $N -S $S -GO $GO -CS $CS -MQ $MQ -SE $SE -RB $RB -FC $FC -MW $MW -H $H -IN $IN >> $logfile 2>&1";
|
|
109 }
|
|
110 }
|
|
111 my $cmd2="cp data.zip $O";
|
|
112 my $cmd3="rm $outfile";
|
|
113 my $cmd4="rm $logfile";
|
|
114 syswrite(FILE2, "\n$cmd\n");
|
|
115 syswrite(FILE2, "\n$cmd2\n");
|
|
116 syswrite(FILE2, "\n$cmd3\n");
|
|
117 syswrite(FILE2, "\n$cmd4\n\n");
|
|
118
|
|
119 system($cmd);
|
|
120 system($cmd2);
|
|
121 system($cmd3);
|
|
122 system($cmd4);
|
|
123
|
|
124 close(FILE2);
|
|
125
|
|
126
|