0
|
1 require 'config.pl';
|
|
2 open OUT, "> FISH/library_cis_list.txt";
|
|
3 open OUT2, ">FISH/multi_test.txt";
|
|
4
|
|
5 $query1 = "select count(name) from cis_result_final_$proj where pvalueregion < $cocis_threshold and type = 'all_$library_percent' and gene_name not like '%BAD%' and region > 1 order by pvalueregion limit 100";
|
|
6 $sth = $dbh->prepare("$query1");
|
|
7
|
|
8 $sth->execute;
|
|
9
|
|
10 while ((@row) = $sth->fetchrow_array) {
|
|
11 $cis_number = $row[0];
|
|
12 }
|
|
13
|
|
14 $query2="select name,gene_name, library_name from cis_result_final_$proj where pvalueregion < $cocis_threshold and type = 'all_$library_percent' and gene_name not like '%BAD%' and region > 1 order by pvalueregion limit 100";
|
|
15
|
|
16 $sth = $dbh->prepare("$query2");
|
|
17 $sth->execute;
|
|
18
|
|
19 while ((@row) = $sth->fetchrow_array) {
|
|
20 #print $row[2];
|
|
21 @chunks = split(/::/m, $row[2]);
|
|
22 foreach $lib(@chunks) {
|
|
23 if ($lib ne '') {
|
|
24 print OUT "$row[0]::$row[1]\t$lib\t1\n";
|
|
25 }
|
|
26 }
|
|
27 }
|
|
28 close OUT;
|
|
29
|
|
30 $sth = $dbh->prepare("select count(distinct descriptor) from metadata_$proj where descriptor != 'all';");
|
|
31
|
|
32 $sth->execute;
|
|
33
|
|
34 while ((@row) = $sth->fetchrow_array) {
|
|
35 $desc_number = $row[0];
|
|
36 }
|
|
37 $ann_cis_testing = $desc_number*$cis_number;
|
|
38 $cis_cis_testing = $cis_number*($cis_number-3)/2;
|
|
39 $ann_ann_testing = $desc_number*($desc_number-3)/2;
|
|
40 print OUT2 "$cis_number\t$desc_number\t$ann_cis_testing\t$cis_cis_testing\t$ann_ann_testing\n";
|
|
41 close OUT2;
|
|
42 $sth = $dbh->prepare("select 'descriptor', descriptor, library from metadata_$proj;");
|
|
43 $sth->execute;
|
|
44
|
|
45 open OUT, "> FISH/library_descriptor_list.txt";
|
|
46
|
|
47 while ((@row) = $sth->fetchrow_array) {
|
|
48 print OUT "$row[0]::$row[1]\t$row[2]\t1\n";
|
|
49 }
|
|
50
|
|
51 close OUT;
|
|
52
|
|
53 open (my $list, ">", "FISH/list.txt");
|
|
54 open (my $cis_list, "<", "FISH/library_cis_list.txt");
|
|
55 while(<$cis_list>) {
|
|
56 print $list $_;
|
|
57 }
|
|
58 close($cis_list);
|
|
59 open (my $desc_list, "<", "FISH/library_descriptor_list.txt");
|
|
60 while (<$desc_list>) {
|
|
61 print $list $_;
|
|
62 }
|
|
63 close($desc_list);
|
|
64 close($list);
|
|
65 #system ("cat FISH/library_cis_list.txt FISH/library_descriptor_list.txt > FISH/list.txt");
|
|
66 system ("perl lib/list2tab.pl 1 2 3 0 FISH/list.txt > FISH/cis4cluster.txt");
|
|
67 system ("perl lib/list2tab.pl 1 2 3 0 FISH/library_cis_list.txt > results/Assoc/Cis.txt");
|
|
68 system ("perl lib/list2tab.pl 1 2 3 0 FISH/library_descriptor_list.txt > results/Assoc/Ann.txt");
|
|
69
|
|
70 print "generated the matrix file cis4cluster.txt";
|
|
71
|
|
72
|