view release on metacpan or search on metacpan
cgi/fragmentator.pl view on Meta::CPAN
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
lib/InSilicoSpectro/InSilico/MSMSOutput.pm view on Meta::CPAN
=over 4
=item threshold value
=item red intensity (cell color)
=item green intensity (cell color)
=item blue intensity (cell color)
=item legend text
=item red intensity (legend text color)
=item green intensity (legend text color)
=item blue intensity (legend text color)
=back
These eight data are repeated for each threshold and the number of threshold
is not limited. The threshold values must be adapted to intensity normalization
(see function tabSpectrum).
By default, plotSpectrumMatch generates a color scale that adapts to the
normalization and contains 5 bins: blue (less intense), red, orange, yellow,
green (most intense).
=item legend
When this parameter is set to 'right', a legend is added at the right of the
graphics. When it is set to 'bottom', a legend is added under the graphics.
The legend is made of the color scale and a count number of matched peaks versus
number of experimental peaks in each intensity bin. This count informs on the
quality of the match. It is important to note that it is not uncommon for an
experimental peak to match several theoretical masses and therefore the count,
which considers each mass once, may be slightly different from what is read
from the graphics. The present two different point of views: theoretical and
experimental masses point of views.
=item changeColModifAA
Except when tabSpectrum was called with modifLvl equal to 2, plotSpectrumMatch
lib/InSilicoSpectro/InSilico/MSMSOutput.pm view on Meta::CPAN
A reference to a vector of three values (R, G, B) used to defined the line
color, default black.
=back
Example:
my $msms = new InSilicoSpectro::InSilico::MSMSOutput(spectrum=>\%spectrum, prec=>2, modifLvl=>1,
expSpectrum=>\@peaks, intSel=>'order', tol=>$tol, minTol=>$minTol);
$msms->plotSpectrumMatch(fname=>$peptide, format=>'png', fontChoice=>'default:Large',
changeColModifAA=>1, legend=>'bottom');
=cut
sub plotSpectrumMatch
{
croak "cannot call graphic method when GD module coul not be loaded" unless $okGD;
unless (defined $tmpim){
$tmpim = new GD::Image(1000, 200);
$tmpWhite = $tmpim->colorAllocate(255,255,255);
}
my $table = shift;
my (%h) = @_;
my ($fname, $fhandle, $fontChoice, $colorScale, $format, $inCellBorder, $bgColor, $textColor, $lineColor, $modifAAColor, $changeColModifAA, $style, $legend, $nColIntern, $plotIntern) = ($h{fname}, $h{fhandle}, $h{fontChoice}, $h{colorScale}, $h{for...
if (defined($format)){
if (($format ne 'png') && ($format ne 'xbm') && ($format ne 'gif') && ($format ne 'gdf') && ($format ne 'bmp') && ($format ne 'sgi') && ($format ne 'pcx') && ($format ne 'jpeg') && ($format ne 'tiff')){
croak("Wrong file format [$format]");
}
}
$fontChoice = $fontChoice || 'default:Large';
$inCellBorder = $inCellBorder || 1;
$nColIntern = $nColIntern || 2;
lib/InSilicoSpectro/InSilico/MSMSOutput.pm view on Meta::CPAN
}
push(@vLines, $vLines[-1]+$fontWidth+2*$inCellBorder+1);
}
}
my @hLines = (0);
for (my $i = 0; $i <= $nFrag; $i++){
push(@hLines, $hLines[-1]+$cellHeight);
}
# Legend box
my ($legendHeight, $legendWidth, @legend, @intThres, @countPeaks, @countMatched);
my ($maxCountLen, @countLegend, $countStartPos, $maxLegLen);
if (defined($legend)){
# Prepares legend text
if (defined($colorScale)){
# User defined scale
for (my $i = 0; $i < @$colorScale; $i += 8){
push(@intThres, $colorScale->[$i]);
push(@legend, $colorScale->[$i+4]);
}
}
elsif ($table->{intSel} eq 'order'){
@intThres = (0, 0.3, 0.5, 0.7, 0.9);
@legend = ('0 %', '30 %', '50 %', '70 %', '90 %');
}
elsif ($table->{intSel} eq 'relative'){
@intThres = (0, 0.1, 0.2, 0.3, 0.5);
@legend = ('0 %', '10 %', '20 %', '30 %', '50 %');
}
elsif ($table->{intSel} eq 'log'){
@intThres = (0, 4.6, 6.2, 7.6, 9.2);
@legend = ('1', '100', '500', '2000', '10000');
}
elsif ($table->{intSel} eq 'original'){
@intThres = (0, 100, 500, 2000, 10000);
@legend = ('0', '100', '500', '2000', '10000');
}
else{
croak("Unknown intSel value [$table->{intSel}]");
}
# Counts peaks
foreach my $intens (values(%{$table->{normInt}})){
$countPeaks[selectColor(\@intThres, $intens)]++;
}
# Counts matched peaks (once)
lib/InSilicoSpectro/InSilico/MSMSOutput.pm view on Meta::CPAN
}
}
}
}
for (my $i = 0; $i < @intThres; $i++){
push(@countLegend, ($countMatched[$i]+0).'/'.($countPeaks[$i]+0));
$maxCountLen = length($countLegend[-1]) if (length($countLegend[-1]) > $maxCountLen);
}
$legendHeight = scalar(@legend)*$cellHeight+1;
if (defined($font)){
foreach (@legend){
$maxLegLen = length($_) if (length($_) > $maxLegLen);
}
$legendWidth = ($maxLegLen+$maxCountLen)*$nativeFontWidth+4*$inCellBorder+3;
$countStartPos = $maxLegLen*$nativeFontWidth+2*$inCellBorder+1;
}
else{
my (@coord, $lWidth, $countWidth);
foreach (@legend){
@coord = $tmpim->stringFT($tmpWhite, $fontName, $fontPoint, 0, 10, 180, $_);
if ($lWidth < $coord[2]-$coord[0]){
$lWidth = $coord[2]-$coord[0];
}
}
foreach (@countLegend){
@coord = $tmpim->stringFT($tmpWhite, $fontName, $fontPoint, 0, 10, 180, $_);
if ($countWidth < $coord[2]-$coord[0]){
$countWidth = $coord[2]-$coord[0];
}
}
$legendWidth = $lWidth+$countWidth+4*$inCellBorder+3;
$countStartPos = $lWidth+2*$inCellBorder+1;
}
}
my ($internWidth, $internHeight, @internHPos, @internVPos, @internList);
if (defined($plotIntern)){
# Internal fragments
for (my $i = 0; $i < @{$table->{mass}{intern}}; $i++){
for (my $j = 1; $j < @{$table->{mass}{intern}[$i]}; $j+=2){
push(@internList, [$table->{mass}{intern}[$i][0], $table->{mass}{intern}[$i][$j], defined($table->{match}{intern}[$i][$j+1]) ? $table->{intens}{intern}[$i][$j+1] : undef]);
lib/InSilicoSpectro/InSilico/MSMSOutput.pm view on Meta::CPAN
@internVPos = ($hLines[-1]+2*$inCellBorder);
for (my $i = 0; $i < int(scalar(@internList)/$nColIntern); $i++){
push(@internVPos, $internVPos[-1]+$cellHeight);
}
push(@internVPos, $internVPos[-1]+$cellHeight) unless (scalar(@internList) % $nColIntern == 0);
}
# Determines size
my $imageWidth = $vLines[-1]+1;
my $imageHeight = $hLines[-1]+1;
if ($legend eq 'right'){
$imageWidth += $legendWidth+2*$inCellBorder;
if (defined($plotIntern)){
$imageHeight = $internVPos[-1]+1;
$imageWidth = $internHPos[-1]+1 if ($internHPos[-1]+1 > $imageWidth);
}
}
elsif ($legend eq 'bottom'){
if (defined($plotIntern)){
if ($internHPos[-1]+2*$inCellBorder+$legendWidth+1 > $imageWidth){
# Enlarge image because of overlap
$imageWidth = $internHPos[-1]+2*$inCellBorder+$legendWidth+1;
}
$imageHeight = max($imageHeight+$legendHeight+2*$inCellBorder-1, $internVPos[-1]+1);
}
else{
$imageHeight += $legendHeight+2*$inCellBorder-1;
}
}
elsif (defined($plotIntern)){
$imageHeight = $internVPos[-1]+1;
}
# Creates the graphic image and allocates colors
my $im = new GD::Image($imageWidth, $imageHeight);
my $white = $im->colorAllocate(255,255,255);
my $black = $im->colorAllocate(0,0,0);
lib/InSilicoSpectro/InSilico/MSMSOutput.pm view on Meta::CPAN
my $green = $im->colorAllocate(19,232,0);
my $yellow = $im->colorAllocate(255,255,80);
my $orange = $im->colorAllocate(255,180,0);
$bgColor = defined($bgColor) ? $im->colorAllocate(@$bgColor) : $white;
$lineColor = defined($lineColor) ? $im->colorAllocate(@$lineColor) : $black;
$textColor = defined($textColor) ? $im->colorAllocate(@$textColor) : $black;
$modifAAColor = defined($modifAAColor) ? $im->colorAllocate(@$modifAAColor) : $blue;
# Prepares the color scale
my (@color, @legendColor);
if (defined($colorScale)){
# User defined scale
for (my $i = 0; $i < @$colorScale; $i += 8){
push(@color, $im->colorAllocate($colorScale->[$i+1], $colorScale->[$i+2], $colorScale->[$i+3]));
push(@legendColor, $im->colorAllocate($colorScale->[$i+5], $colorScale->[$i+6], $colorScale->[$i+7]));
}
}
elsif ($table->{intSel} eq 'order'){
@color = ($blue, $red, $orange, $yellow, $green);
@legendColor = ($white, $white, $black, $black, $black);
}
elsif ($table->{intSel} eq 'relative'){
@color = ($blue, $red, $orange, $yellow, $green);
@legendColor = ($white, $white, $black, $black, $black);
}
elsif ($table->{intSel} eq 'log'){
@color = ($blue, $red, $orange, $yellow, $green);
@legendColor = ($white, $white, $black, $black, $black);
}
elsif ($table->{intSel} eq 'original'){
@color = ($blue, $red, $orange, $yellow, $green);
@legendColor = ($white, $white, $black, $black, $black);
}
else{
croak("Unknown intSel value [$table->{intSel}]");
}
# Plots the horizontal lines and fragment names
$im->filledRectangle(0, 0, $imageWidth-1, $imageHeight-1, $bgColor);
for (my $i = 0; $i < @hLines; $i++){
$im->line(0, $hLines[$i], $vLines[-1], $hLines[$i], $lineColor);
}
lib/InSilicoSpectro/InSilico/MSMSOutput.pm view on Meta::CPAN
# Impossible mass, draw a little slash
$im->line($vLines[$j]+$hRadius-2, $hLines[$i+1]+$vRadius-2, $vLines[$j]+$hRadius+3, $hLines[$i+1]+$vRadius+3, $lineColor);
}
}
}
}
else{
croak("Unknown style [$style]");
}
if (defined($legend)){
my ($legLeft, $legTop) = ($legend eq 'right') ? ($vLines[-1]+2*$inCellBorder, $hLines[-1]-$legendHeight+1) : ($imageWidth-1-$legendWidth, $hLines[-1]+2*$inCellBorder);
my $countRight = $legLeft+$legendWidth-$inCellBorder;
my $legRight = $legLeft+$countStartPos-$inCellBorder;
$im->rectangle($legLeft, $legTop, $legLeft+$legendWidth, $legTop+$legendHeight-1, $lineColor);
for (my $i = 1; $i < @legend; $i++){
$im->line($legLeft, $legTop+$i*$cellHeight, $legLeft+$legendWidth, $legTop+$i*$cellHeight, $lineColor);
}
my $n = scalar(@legend)-1;
my @coord;
for (my $i = 0; $i < @legend; $i++){
$im->filledRectangle($legLeft+1, $legTop+$i*$cellHeight+1, $legLeft+$countStartPos, $legTop+($i+1)*$cellHeight-1, $color[$n-$i]);
if(defined($font)){
$im->string($font, $legRight-length($legend[$n-$i])*$nativeFontWidth, $legTop+$i*$cellHeight+$inCellBorder+1, $legend[$n-$i], $legendColor[$n-$i]);
$im->string($font, $countRight-length($countLegend[$n-$i])*$nativeFontWidth, $legTop+$i*$cellHeight+$inCellBorder+1, $countLegend[$n-$i], $textColor);
}
else{
@coord = $tmpim->stringFT($tmpWhite, $fontName, $fontPoint, 0, $inCellBorder+1+$ttHShift, $inCellBorder+1+$ttVShift, $legend[$n-$i]);
my $length = $coord[2]-$coord[0];
$im->stringFT($legendColor[$n-$i], $fontName, $fontPoint, 0, $legRight-$length, $legTop+$i*$cellHeight+$inCellBorder+1+$ttVShift, $legend[$n-$i]);
@coord = $tmpim->stringFT($tmpWhite, $fontName, $fontPoint, 0, $inCellBorder+1+$ttHShift, $inCellBorder+1+$ttVShift, $countLegend[$n-$i]);
$length = $coord[2]-$coord[0];
$im->stringFT($textColor, $fontName, $fontPoint, 0, $countRight-$length, $legTop+$i*$cellHeight+$inCellBorder+1+$ttVShift, $countLegend[$n-$i]);
}
}
$im->line($legLeft+$countStartPos, $legTop, $legLeft+$countStartPos, $legTop+$legendHeight-1, $lineColor);
}
if (defined($plotIntern)){
# Draws lines
for (my $i = 0; $i < @internVPos; $i++){
$im->line(0, $internVPos[$i], $internHPos[-1], $internVPos[$i], $lineColor);
}
for (my $i = 0; $i < @internHPos; $i++){
$im->line($internHPos[$i], $internVPos[0], $internHPos[$i], $internVPos[-1], $lineColor);
}
lib/InSilicoSpectro/InSilico/MSMSOutput.pm view on Meta::CPAN
if (defined($font)){
$im->string($font, $internHPos[$col]+$inCellBorder+1, $internVPos[$line]+$inCellBorder+1, $internList[$i+$j][0], $textColor);
}
else{
$im->stringFT($textColor, $fontName, $fontPoint, 0, $internHPos[$col]+$inCellBorder+1+$ttHShift, $internVPos[$line]+$inCellBorder+1+$ttVShift, $internList[$i+$j][0]);
}
if (defined($internList[$i+$j][2])){
my $index = selectColor(\@intThres, $internList[$i+$j][2]);
$im->filledRectangle($internHPos[$col+1]+1, $internVPos[$line]+1, $internHPos[$col+2]-1, $internVPos[$line+1]-1, $color[$index]);
if (defined($font)){
$im->string($font, $internHPos[$col+1]+$inCellBorder+1, $internVPos[$line]+$inCellBorder+1, $internList[$i+$j][1], $legendColor[$index]);
}
else{
$im->stringFT($legendColor[$index], $fontName, $fontPoint, 0, $internHPos[$col+1]+$inCellBorder+1+$ttHShift, $internVPos[$line]+$inCellBorder+1+$ttVShift, $internList[$i+$j][1]);
}
}
else{
if (defined($font)){
$im->string($font, $internHPos[$col+1]+$inCellBorder+1, $internVPos[$line]+$inCellBorder+1, $internList[$i+$j][1], $textColor);
}
else{
$im->stringFT($textColor, $fontName, $fontPoint, 0, $internHPos[$col+1]+$inCellBorder+1+$ttHShift, $internVPos[$line]+$inCellBorder+1+$ttVShift, $internList[$i+$j][1]);
}
}
lib/InSilicoSpectro/InSilico/MSMSOutput.pm view on Meta::CPAN
$$old = $tmp;
}
} # chooseColorFrag
=head2 plotLegendOnly(%h)
This function plots the color scale only and should be used
if you don not want to display it for each match plot. Note
that the legend generated by PlotSpectrumMatch contains extra
information that is specific to the match, i.e. the count of
matched peaks per intensity bin. This information is not
reported if you decide to save space and only display the
color scale once.
The named parameters are (see plotSpectrumMatch for detailed
explanations):
=over 4
lib/InSilicoSpectro/InSilico/MSMSOutput.pm view on Meta::CPAN
$ttVShift = 180-$coord[1];
}
else{
croak("Unknown font class [$class]");
}
}
# Computes image size
my $cellHeight = $fontHeight+2*$inCellBorder+1;
$ttVShift += $cellHeight;
my ($legendHeight, $legendWidth, @legend, @intThres);
if (defined($colorScale)){
# User defined scale
for (my $i = 0; $i < @$colorScale; $i += 8){
push(@intThres, $colorScale->[$i]);
push(@legend, $colorScale->[$i+4]);
}
}
elsif ($intSel eq 'order'){
@intThres = (0, 0.3, 0.5, 0.7, 0.9);
@legend = ('0 %', '30 %', '50 %', '70 %', '90 %');
}
elsif ($intSel eq 'relative'){
@intThres = (0, 0.1, 0.2, 0.3, 0.5);
@legend = ('0 %', '10 %', '20 %', '30 %', '50 %');
}
elsif ($intSel eq 'log'){
@intThres = (0, 4.6, 6.2, 7.6, 9.2);
@legend = ('1', '100', '500', '2000', '10000');
}
elsif ($intSel eq 'original'){
@intThres = (0, 100, 500, 2000, 10000);
@legend = ('0', '100', '500', '2000', '10000');
}
else{
croak("Unknown intSel value [$intSel]");
}
$legendHeight = scalar(@legend)*$cellHeight+1;
if (defined($font)){
my $maxLen;
foreach (@legend){
$maxLen = length($_) if (length($_) > $maxLen);
}
$legendWidth = $maxLen*$fontWidth+2*$inCellBorder+2;
}
else{
my @coord;
foreach (@legend){
@coord = $tmpim->stringFT($tmpWhite, $fontName, $fontPoint, 0, 10, 180, $_);
if ($legendWidth < $coord[2]-$coord[0]){
$legendWidth = $coord[2]-$coord[0];
}
}
$legendWidth += 2*$inCellBorder+2;
}
# Creates the graphic image and allocates colors
my $im = new GD::Image($legendWidth, $legendHeight);
my $white = $im->colorAllocate(255,255,255);
my $black = $im->colorAllocate(0,0,0);
my $blue= $im->colorAllocate(0,72,223);
my $red = $im->colorAllocate(255,16,0);
my $green = $im->colorAllocate(19,232,0);
my $yellow = $im->colorAllocate(255,255,80);
my $orange = $im->colorAllocate(255,180,0);
$lineColor = defined($lineColor) ? $im->colorAllocate(@$lineColor) : $black;
# Prepares the color scale
my (@color, @legendColor);
if (defined($colorScale)){
# User defined scale
for (my $i = 0; $i < @$colorScale; $i += 8){
push(@color, $im->colorAllocate($colorScale->[$i+1], $colorScale->[$i+2], $colorScale->[$i+3]));
push(@legendColor, $im->colorAllocate($colorScale->[$i+5], $colorScale->[$i+6], $colorScale->[$i+7]));
}
}
elsif ($intSel eq 'order'){
@color = ($blue, $red, $orange, $yellow, $green);
@legendColor = ($white, $white, $black, $black, $black);
}
elsif ($intSel eq 'relative'){
@color = ($blue, $red, $orange, $yellow, $green);
@legendColor = ($white, $white, $black, $black, $black);
}
elsif ($intSel eq 'log'){
@color = ($blue, $red, $orange, $yellow, $green);
@legendColor = ($white, $white, $black, $black, $black);
}
elsif ($intSel eq 'original'){
@color = ($blue, $red, $orange, $yellow, $green);
@legendColor = ($white, $white, $black, $black, $black);
}
else{
croak("Unknown intSel value [$intSel]");
}
$im->rectangle(0, 0, $legendWidth-1, $legendHeight-1, $lineColor);
for (my $i = 1; $i < @legend; $i++){
$im->line(0, $i*$cellHeight, $legendWidth-1, $i*$cellHeight, $lineColor);
}
my $n = scalar(@legend)-1;
my @coord;
for (my $i = 0; $i < @legend; $i++){
$im->filledRectangle(1, $i*$cellHeight+1, $legendWidth-2, ($i+1)*$cellHeight-1, $color[$n-$i]);
if (defined($font)){
$im->string($font, $legendWidth-$inCellBorder-1-length($legend[$n-$i])*$fontWidth, $i*$cellHeight+$inCellBorder+1, $legend[$n-$i], $legendColor[$n-$i]);
}
else{
@coord = $tmpim->stringFT($tmpWhite, $fontName, $fontPoint, 0, $inCellBorder+1+$ttHShift, $inCellBorder+1+$ttVShift, $legend[$n-$i]);
my $length = $coord[2]-$coord[0];
$im->stringFT($legendColor[$n-$i], $fontName, $fontPoint, 0, $legendWidth-$inCellBorder-2-$length+$ttHShift, $i*$cellHeight+$inCellBorder+1+$ttVShift, $legend[$n-$i]);
}
}
if (defined($format)){
# Creates file
if ($fhandle){
binmode $fhandle;
print $fhandle $im->$format;
}
else{
scripts/peptSpectra/getIonIntensities.pl view on Meta::CPAN
}
elsif ($matchSel eq 'mostintense'){
matchSpectrumGreedy(pept=>$peptide, modif=>$modif, spectrum=>\%spectrum, expSpectrum=>\@peaks, fragTypes=>\@fragTypes, tol=>$tol);
}
else{
CORE::die("Unknown match type [$matchSel]");
}
if (defined($withPlots)){
my $msms = new InSilicoSpectro::InSilico::MSMSOutput(spectrum=>\%spectrum, prec=>2, modifLvl=>1, expSpectrum=>\@peaks, intSel=>'order', tol=>$tol, minTol=>$minTol);
$msms->plotSpectrumMatch(fname=>"$peptide-$$-$nPlot", format=>'png', fontChoice=>'default:Large', changeColModifAA=>1, legend=>'right', plotIntern=>1);
$nPlot++;
}
# Normalizes intensities
my %normInt;
normalizeIntensities($intSel, \@peaks, \%normInt);
# Extracts statistics
my $len = length($peptide);
foreach my $frag (keys(%{$spectrum{mass}{term}})){
scripts/peptSpectra/ionStat.R view on Meta::CPAN
h<-hist(d[[i]], breaks=br, plot=FALSE)
s<-max(h$density)
if (s > m) m<-s
}
h<-hist(d[[1]], breaks=br, plot=FALSE)
plot(h$density, x=h$mids, type="l", ylim=c(0,m), main="ion probability densities", ylab="density", xlab=xlab, col=col[1], lwd=lwd, lty=lty)
for (i in 2:n){
h<-hist(d[[i]], breaks=br, plot=FALSE)
lines(h$density, x=h$mids, type="l", col=col[i], lwd=lwd, lty=lty)
}
legend(0, m, legend=names(d), lwd=lwd, lty=lty, col=col)
}
ionFreqHist<-function(d, xlab, col=rainbow(dim(d)[2]), relative=FALSE, lty=1, lwd=2, br=30)
{
n<-dim(d)[2]
m<-0
for (i in 1:n){
h<-hist(d[[i]], breaks=br, plot=FALSE)
s<-ifelse(relative, max(h$counts/sum(h$counts)), max(h$counts))
if (s > m) m<-s
}
h<-hist(d[[1]], breaks=br, plot=FALSE)
plot(ifelse(rep(relative, length(h$counts)), h$counts/sum(h$counts), h$counts), x=h$mids, type="l", ylim=c(0,m), main="ion frequencies", ylab="frequency", xlab=xlab, col=col[1], lwd=lwd, lty=lty)
for (i in 2:n){
h<-hist(d[[i]], breaks=br, plot=FALSE)
lines(ifelse(rep(relative, length(h$counts)), h$counts/sum(h$counts), h$counts), x=h$mids, type="l", col=col[i], lwd=lwd, lty=lty)
}
legend(0, m, legend=names(d), lwd=lwd, lty=lty, col=col)
}
t/InSilico/testMSMSOutPlot.pl view on Meta::CPAN
my %spectrum;
my $peptide = new InSilicoSpectro::InSilico::Peptide(sequence=>'SCMSFPQMLS', modif=>'::Cys_CAM::::::Oxidation:::');
getFragmentMasses(pept=>$peptide, fragTypes=>['b','a','b-NH3*','b-H2O*','b++','y','y-H2O*-NH3*','y++','immo'], spectrum=>\%spectrum);
my @expSpectrum = ([120,340],[221,100], [494, 250], [820.4, 300], [821, 200], [985,700], [1116, 200]);
my $pd = new InSilicoSpectro::Spectra::PeakDescriptor(['mass', 'intensity']);
my $expSpectrum = new InSilicoSpectro::Spectra::ExpSpectrum(spectrum=>\@expSpectrum, peakDescriptor=>$pd);
matchSpectrumGreedy(spectrum=>\%spectrum, expSpectrum=>$expSpectrum, minTol=>2);
my $theoSpectrum = new InSilicoSpectro::InSilico::MSMSTheoSpectrum(theoSpectrum=>\%spectrum, massType=>getMassType());
my $msms = new InSilicoSpectro::InSilico::MSMSOutput(spectrum=>$theoSpectrum, prec=>2, modifLvl=>1, expSpectrum=>$expSpectrum, intSel=>'order');
$msms->plotSpectrumMatch(fname=>'test1', format=>'png', fontChoice=>'default:Large', style=>'circle',changeColModifAA=>1, legend=>'bottom', plotIntern=>1);
#$msms->plotSpectrumMatch(fname=>'test1', format=>'png', fontChoice=>'/usr/X11R6/lib/X11/fonts/truetype/luximri.ttf:18', style=>'circle',changeColModifAA=>1, legend=>'bottom', plotIntern=>1);
#$msms->plotSpectrumMatch(fname=>'test1', format=>'png', fontChoice=>'/home/colinge/open-ms-tools/tombots.ttf:20', style=>'circle',changeColModifAA=>1, legend=>'bottom', plotIntern=>1);
};
if ($@){
carp($@);
}