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