root / src / wwwblast.php @ 4fcefb60
Historique | Voir | Annoter | Télécharger (5,42 ko)
1 |
<?php
|
---|---|
2 |
session_start (); |
3 |
require("headers.php"); |
4 |
|
5 |
require_once("lib/seq.lib.php"); |
6 |
|
7 |
// Create an updated fasta
|
8 |
// file of all oligos
|
9 |
$qry = "SELECT * FROM oligos"; |
10 |
$result = mysql_query($qry, $connexion); |
11 |
$blastbasename = BLAST_HOME . "oligostock_db"; |
12 |
$FastaFile = fopen($blastbasename, 'w'); |
13 |
while($oli = mysql_fetch_object($result)) { |
14 |
fwrite($FastaFile, ">$oli->id\n"); |
15 |
$toprint = Convert2Fasta($oli->Sequence); |
16 |
for ($i=0; $i< count($toprint); $i++) { |
17 |
fwrite($FastaFile, "$toprint[$i]\n"); |
18 |
} |
19 |
} |
20 |
fclose($FastaFile); |
21 |
// Using the fasta file
|
22 |
// Create the blast database
|
23 |
// and place it in the appropriate directory for wwwblast
|
24 |
$cmd_formatdb = FORMATDB_CMD." -i $blastbasename -p F"; |
25 |
echo "<pre>$cmd_formatdb</pre>"; |
26 |
system($cmd_formatdb, $retval1); |
27 |
if ($retval1 != 0){ |
28 |
echo "Error while formatting the FASTA database into BLAST format"; |
29 |
exit;
|
30 |
} |
31 |
echo "BLAST has been updated with the latest oligostock."; |
32 |
|
33 |
// Create an updated fasta
|
34 |
// file of all plasmids
|
35 |
$qry = "SELECT * FROM plasmids"; |
36 |
$result = mysql_query($qry, $connexion); |
37 |
$blastbasename = BLAST_HOME . "plasmidstock_db"; |
38 |
$FastaFile = fopen($blastbasename, 'w'); |
39 |
while($pl = mysql_fetch_object($result)) { |
40 |
//print("**$pl->sequence**<br>");
|
41 |
if ($pl->sequence != "") { |
42 |
fwrite($FastaFile, ">$pl->id $pl->Name_\n"); |
43 |
$toprint = Convert2Fasta($pl->sequence); |
44 |
for ($i=0; $i< count($toprint); $i++) { |
45 |
fwrite($FastaFile, "$toprint[$i]\n"); |
46 |
} |
47 |
} |
48 |
} |
49 |
fclose($FastaFile); |
50 |
// Using the fasta file
|
51 |
// Create the blast database
|
52 |
// and place it in the appropriate directory for wwwblast
|
53 |
$cmd_formatdb = FORMATDB_CMD." -i $blastbasename -p F"; |
54 |
echo "<pre>$cmd_formatdb</pre>"; |
55 |
system($cmd_formatdb, $retval1); |
56 |
if ($retval1 != 0){ |
57 |
echo "Error while formatting the FASTA database into BLAST format"; |
58 |
exit;
|
59 |
} |
60 |
echo "BLAST has been updated with the latest plasmidstock."; |
61 |
|
62 |
// Create an updated fasta
|
63 |
// file of all pl_features
|
64 |
$blastbasename = BLAST_HOME . "plfeatstock_db"; |
65 |
$FastaFile = fopen($blastbasename, 'w'); |
66 |
$qry = "SELECT * FROM pl_features"; |
67 |
$result = mysql_query($qry, $connexion); |
68 |
while($pl = mysql_fetch_object($result)) { |
69 |
//print("**$pl->sequence**<br>");
|
70 |
fwrite($FastaFile, ">$pl->Description\n"); |
71 |
$toprint = Convert2Fasta($pl->Sequence); |
72 |
for ($i=0; $i< count($toprint); $i++) { |
73 |
fwrite($FastaFile, "$toprint[$i]\n"); |
74 |
} |
75 |
} |
76 |
$qry = "SELECT * FROM oligos"; |
77 |
$result = mysql_query($qry, $connexion); |
78 |
while($feat = mysql_fetch_object($result)) { |
79 |
//print("**$feat->id**<br>");
|
80 |
fwrite($FastaFile, ">_$feat->id\n"); |
81 |
$toprint = Convert2Fasta($feat->Sequence); |
82 |
for ($i=0; $i< count($toprint); $i++){ |
83 |
fwrite($FastaFile, $toprint[$i] . "\n"); |
84 |
} |
85 |
} |
86 |
fclose($FastaFile); |
87 |
// Using the fasta file
|
88 |
// Create the blast database
|
89 |
// and place it in the appropriate directory for wwwblast
|
90 |
$cmd_formatdb = FORMATDB_CMD." -i $blastbasename -p F"; |
91 |
echo "<pre>$cmd_formatdb</pre>"; |
92 |
system($cmd_formatdb, $retval1); |
93 |
if ($retval1 != 0){ |
94 |
echo "Error while formatting the FASTA database into BLAST format"; |
95 |
exit;
|
96 |
} |
97 |
echo "BLAST has been updated with the latest plfeatstock."; |
98 |
|
99 |
|
100 |
|
101 |
|
102 |
// Create an updated PlasMapper fasta
|
103 |
// file of all pl_features
|
104 |
$blastbasename = PLASMAPPER_HOME."dataBase/db_vectorFeature/features.fasta.nt"; |
105 |
$FastaFile = fopen($blastbasename, 'w'); |
106 |
$fasta_content = ""; |
107 |
|
108 |
$qry = "SELECT * FROM pl_features"; |
109 |
$result = mysql_query($qry, $connexion); |
110 |
while($feat = mysql_fetch_object($result)) { |
111 |
$descr = str_replace(" ","-",substr($feat->Description, 0, strlen($feat->Description))); |
112 |
// $descr = $feat->Description;
|
113 |
// echo "***$descr***<br>";
|
114 |
fwrite($FastaFile, ">$descr" . "[$feat->Category]{" . $descr . "}," . strlen($feat->Sequence) . " bases, " . md5($feat->Sequence) . " checksum.\n"); |
115 |
$fasta_content .= ">$feat->Description\n"; |
116 |
$toprint = Convert2Fasta($feat->Sequence); |
117 |
for ($i=0; $i< count($toprint); $i++){ |
118 |
fwrite($FastaFile, $toprint[$i] . "\n"); |
119 |
$fasta_content .= $toprint[$i] . "\n"; |
120 |
} |
121 |
} |
122 |
|
123 |
$qry = "SELECT * FROM oligos"; |
124 |
$result = mysql_query($qry, $connexion); |
125 |
while($feat = mysql_fetch_object($result)) { |
126 |
//print("**$feat->id**<br>");
|
127 |
fwrite($FastaFile, ">_$feat->id[OTH]{_$feat->id}," . strlen($feat->Sequence) . " bases, " . md5($feat->Sequence) . " checksum.\n"); |
128 |
$fasta_content .= ">_$feat->id\n"; |
129 |
$toprint = Convert2Fasta($feat->Sequence); |
130 |
for ($i=0; $i< count($toprint); $i++){ |
131 |
fwrite($FastaFile, $toprint[$i] . "\n"); |
132 |
$fasta_content .= $toprint[$i] . "\n"; |
133 |
} |
134 |
} |
135 |
fclose($FastaFile); |
136 |
// Using the fasta file
|
137 |
// Create the blast database
|
138 |
// and place it in the appropriate directory for wwwblast
|
139 |
$cmd_formatdb = FORMATDB_CMD." -i $blastbasename -p F -o T"; |
140 |
echo "<pre>$cmd_formatdb</pre>"; |
141 |
system($cmd_formatdb, $retval1); |
142 |
|
143 |
if ($retval1 != 0){ |
144 |
echo "Error while formatting the FASTA database into BLAST format"; |
145 |
exit;
|
146 |
} |
147 |
$html_feat_cnt = <<<EOD |
148 |
<html>
|
149 |
<head>
|
150 |
<meta HTTP-EQUIV =" Content-Type" CONTENT =" text/html; charset=iso-8859-1">
|
151 |
<meta NAME =" Description" CONTENT =" Wishart Pharmaceutical Research Group -
|
152 |
PlasMap">
|
153 |
<link rel=stylesheet type="text/css" href="/PlasMapper/style/PlasMapper.css" title="default PlasMap styles" />
|
154 |
<title>PlasMap - Help</title>
|
155 |
</head>
|
156 |
<body bgcolor="#ffffff">
|
157 |
<pre>
|
158 |
$fasta_content
|
159 |
</pre>
|
160 |
</body>
|
161 |
</html>
|
162 |
EOD;
|
163 |
$html_feat_filename = PLASMAPPER_HOME . "html/feature.html"; |
164 |
$fp = fopen($html_feat_filename, 'w'); |
165 |
fwrite($fp, $html_feat_cnt); |
166 |
fclose($fp); |
167 |
echo "BLAST has updated PlasMapper with the latest plasmid's features."; |
168 |
?>
|
169 |
|
170 |
<center>
|
171 |
<iframe src="/blast/blast.html" width="100%" height="90%" border="0"/> |
172 |
</center>
|