[Bio] / FigWebServices / RTMg.cgi Repository:
ViewVC logotype

Diff of /FigWebServices/RTMg.cgi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5, Fri Sep 23 14:55:15 2011 UTC revision 1.6, Sat Nov 12 01:23:10 2011 UTC
# Line 6  Line 6 
6  use lib '/home/redwards/perl/lib/perl5/site_perl/5.8.7/i686-linux/', '/home/redwards/perl/lib/perl5/site_perl/5.8.7';  use lib '/home/redwards/perl/lib/perl5/site_perl/5.8.7/i686-linux/', '/home/redwards/perl/lib/perl5/site_perl/5.8.7';
7  use JSON::XS;  use JSON::XS;
8  use File::Slurp;  use File::Slurp;
9    use LWP::Simple qw/getstore/;
10    
11    
12  my $jobfn = $$;  my $jobfn = $$;
# Line 168  Line 169 
169                                  -onChange=>"getTable(this.value)",                                  -onChange=>"getTable(this.value)",
170                                  -default=>3), p,                                  -default=>3), p,
171  # I took out , 4=>"OTU"  # I took out , 4=>"OTU"
172                                iframe({name=>"TableIFrame", width=>"100%"}, " "), "\n",                                div({id=>"frame"}, iframe({name=>"TableIFrame", frameborder=>"0", width=>"100%", height=>"80%"}, "   ")), "\n",
173                                div({id=>"percent"}, ""), "\n",                                div({id=>"percent"}, ""), "\n",
174                                div({id=>"primary"}, ""), "\n",                                div({id=>"primary"}, ""), "\n",
175                                div({id=>"secondary"}, ""), "\n",                                div({id=>"secondary"}, ""), "\n",
# Line 241  Line 242 
242                        div({id=>"header"},                        div({id=>"header"},
243                        a({class=>"help", href=>"./Html/RTMg.html"}, "Help! What is this?"), "\n",                        a({class=>"help", href=>"./Html/RTMg.html"}, "Help! What is this?"), "\n",
244                        ),                        ),
245                        div({id=>"title"}, ("Welcome to Real Time Metagenomics")),                        div({id=>"title"}, ("Welcome to <br />Real Time Metagenomics")),
246                        div({id=>"uploadField"},                        div({id=>"uploadField"},
247                        "Welcome to the next revolution in metagenome annotation: Real time data processing and analysis. ",p,                        "Welcome to the next revolution in metagenome annotation: Real time data processing and analysis. ",p,),
                       "<b>Fasta files</b> are <em>uncompressed</em> text files in fasta format. The format has a line that begins with a &gt; and then ",  
                       "has the id of the sequence. It then has a new line, and the actual sequence.",p,"<tt>",  
                       "&gt;id1<br />atcgactcagcagctacgaatcgactat<br />&gt;id2<br />actgactgcagcggacgagcaggcagcaggca<br /></tt>",p,  
                       ),  
248                        div({-id=>"cacheImg"}, "<img src='$base/Html/ajax-loader.gif' alt='spinning icon'></img>"),                        div({-id=>"cacheImg"}, "<img src='$base/Html/ajax-loader.gif' alt='spinning icon'></img>"),
249                        "Please choose a fasta file.  You can probably upload a compressed file. Who knows!",p,                        "<div id='directions'>\n",
250                        filefield(-name=>"uploadfile") , p, "\n",                          "You can upload DNA sequence data and we will provide an immediate annotation of the sequences there. ",
251                            "We accept either fasta or fastq files, although we do not use the quality scores associated with fastq ",
252                            "data. We recommend that you prescreen your sequences with <a href='http://edwards.sdsu.edu/prinseq/'>prinseq</a> ",
253                            "before uploading those data for annotation.\n",p,
254    
255                            "Once your data has been processed you can download the results and load the numbers into Excel or ",
256                            "your favorite program for statistical analysis.",p,
257                          "</div>\n",
258                          "You can either upload an uncompressed file, or data compressed with either zip or gzip &nbsp; ",p,
259                          filefield(-name=>"uploadfile") , " or \n",p,
260                          "if your file is online, paste the url where your file is housed: &nbsp; ", p,
261                          textfield(-name=>"fileurl", -size=>"100", -value=>"http://", -onFocus=>"this.value=''; return true;"), p, "\n",
262                        submit(-name=>'submit', -value=>'RTMg Lite',  -onClick=>"uploadingNow(); return true;"),                        submit(-name=>'submit', -value=>'RTMg Lite',  -onClick=>"uploadingNow(); return true;"),
263                        submit(-name=>'submit', -value=>'Upload',  -onClick=>"uploadingNow(); return true;"), reset, p,"\n",                        #submit(-name=>'submit', -value=>'Upload',  -onClick=>"uploadingNow(); return true;"),
264                          reset, p,"\n",
265                        div({id=>"showadvancedSettings"}, a({href=>"#", onClick=>"showAdvancedSettings(); return true;"}, h3("Show advanced settings"))),                        div({id=>"showadvancedSettings"}, a({href=>"#", onClick=>"showAdvancedSettings(); return true;"}, h3("Show advanced settings"))),
266                        div({id=>"advancedSettings"}, a({href=>"#", onClick=>"showAdvancedSettings(); return true;"},                        div({id=>"advancedSettings"}, a({href=>"#", onClick=>"showAdvancedSettings(); return true;"},
267                          h3("Hide advanced settings")), p,                          h3("Hide advanced settings")), p,
# Line 311  Line 320 
320    
321  sub process_data {  sub process_data {
322          my $file_id = $jobfn;          my $file_id = $jobfn;
         my $filename=$cgi->param('uploadfile');  
         no strict;  
323          my $of=$file_id;          my $of=$file_id;
324          $of =~ s/\s+//g;          $of =~ s/\s+//g;
325          $of =~ s/[^\w\.]*//g;          $of =~ s/[^\w\.]*//g;
326            my $filename;
327            if ($cgi->param('uploadfile')) {
328                    $filename=$cgi->param('uploadfile');
329                    no strict;
330          if ($filename =~ /\.gz$/) {          if ($filename =~ /\.gz$/) {
331                  $of .= ".gz";                  $of .= ".gz";
332          }          }
# Line 329  Line 340 
340          close OUT;          close OUT;
341    
342          strict;          strict;
343            }
344            elsif ($cgi->param('fileurl')) {
345                    my $url = $cgi->param('fileurl');
346                    $filename = $url;
347                    $filename =~ s/^.*\///;
348    
349                    if ($url =~ /\.gz$/) {
350                            $of .= ".gz";
351                    }
352                    if ($url =~ /\.zip$/) {
353                            $of .= ".zip";
354                    }
355    
356                    getstore($url, "$dest/$of");
357            }
358            else {
359                    die "No data provided!";
360            }
361    
362            # check and see what kind of file it is
363            { # scope this block
364                    if ($of =~ /gz/) {
365                            open(IN, "gunzip -c $dest/$of|") || die "can't open $dest/$of";
366                    }
367                    elsif ($of =~ /zip$/) {
368                            open(IN, "unzip -p $dest/$of|") || die "can't open $dest/$of";
369                    }
370                    else {
371                            open (IN, "$dest/$of") || die "Can't open $dest/$of that we saved";
372                    }
373                    my $in = <IN>;
374                    if (index($in, "@") == 0) {
375    # this is a fastq file, and we need to convert it to a fasta file.
376                            $of .= ".fasta";
377                            open(OUT, ">$dest/$of") || die "CAn't open $dest/$of";
378                            $in =~ s/^\@/>/;
379                            print OUT $in;
380                            my $linecount=1;
381                            while ($in = <IN>) {
382                                    $linecount++;
383                                    if ($linecount==1) {$in =~ s/^\@/>/; print OUT $in;}
384                                    elsif ($linecount==2) {print OUT $in;}
385                                    elsif ($linecount==4) {$linecount=0}
386                            }
387                            close OUT;
388                    }
389    
390                    close IN;
391            }
392    
393          my $reliability = $cgi->param('reliability');          my $reliability = $cgi->param('reliability');
394          my $kmer = $cgi->param('kmer');          my $kmer = $cgi->param('kmer');

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3