InSilicoSpectro

 view release on metacpan or  search on metacpan

cgi/fragmentator.pl  view on Meta::CPAN

    }
  }
  matchSpectrumGreedy(spectrum=>\%spectrum, expSpectrum=>\@massList, tol=>$tol, minTol=>$minTol, massIndex=>$massIndex, intensityIndex=>$intensityIndex, order=>\@order);
}

my $msms = new InSilicoSpectro::InSilico::MSMSOutput(spectrum=>\%spectrum, prec=>2, modifLvl=>1, expSpectrum=>\@massList, massIndex=>$massIndex, intensityIndex=>$intensityIndex, tol=>$tol, minTol=>$minTol, intSel=>$intSel);

my $css = htmlCSS(boldTitle=>1);
print <<end_of_html;
<html>

<head>

<title>fragmentator results</title>

<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
<meta name="description" content="Peptide fragmentation result">
<meta name="keywords" content="fragment, peptide, dissociation">
<style type="text/css">
$css
</style>

</head>

<body bgcolor=white>
<h2>Fragmentator results</h2>
<br>
<table border=0 cellspacing=5>
<caption><b>$displayPeptide</b>, mass=$spectrum{peptideMass} Da
end_of_html

# Terminal fragment masses
print $msms->htmlTerm(boldTitle=>1, colLineFunc=>\&chooseColorFrag, css=>1);
print "</table>\n";

# Internal fragment masses
my $intern;
foreach (@fragSel){
  if ($_ eq 'immo'){
    $intern = 1;
    last;
  }
}
if ($intern){
  print "<br><table border=0 cellspacing=5>\n";
  print "\n",$msms->htmlIntern(boldTitle=>1, css=>1);
  print "</table>\n";
}

# Match plot
if (length($massList) > 20){
  use File::Temp qw(tempfile);

#  You have to create a link and set Options FollowSymLinks or to allow access to the tmp directory for the browser
#  use File::Spec;
#  my $tmpdir = File::Spec->tmpdir();

  use File::Spec;
  my $tmpdir = $ENV{INSILICOSPECTRO_FULL_TMPDIR};
  my ($tmpFH, $tmpFname) = tempfile('matchplot-XXXXX', SUFFIX=>'.png', UNLINK=>0, DIR=>$tmpdir);
  $msms->plotSpectrumMatch(fhandle=>$tmpFH, format=>'png', fontChoice=>'default:Large', style=>'circle',changeColModifAA=>1, legend=>($intern ? 'bottom' : 'right'), plotIntern=>($intern ? 1 : undef));
  close($tmpFH);
  chmod(0644, $tmpFname);
  my $fname = $ENV{INSILICOSPECTRO_WEB_TMPDIR}."/".(split(/\//, $tmpFname))[-1];
  print "<br><img src=\"$fname\" alt=\"match image ($tmpdir, $tmpFname, $fname\" />\n";
}

print <<end_of_html;
</body>
</html>
end_of_html


sub htmlError
{
  my $msg = shift;
  print "$msg</body></html>\n";
  exit(0);

} # htmlError



( run in 0.941 second using v1.01-cache-2.11-cpan-39bf76dae61 )