Skip Menu |

This queue is for tickets about the PostScript-Simple CPAN distribution.

Report information
The Basics
Id: 5592
Status: resolved
Priority: 0/
Queue: PostScript-Simple

People
Owner: Nobody in particular
Requestors: msmatlib [...] artsci.wustl.edu
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.06p1
Fixed in: (no value)



Subject: showpage bug
#!c:\Perl\bin\Perl.exe # Hi # Had a problem using Postscript::Simple 0.06p1 # see what I had to do in line 117 of my script below # manually adding the showpage command # I could not get any printout without this # no biggy, but could be helpful to others. # I've included a test input file for the script. # Otherwise great mod! # ::: Robin S. Matlib ::: Doctoral Candidate ::: Molecular Genetics ::: # :::::: Division of Biology and Biomedical Sciences :::::: # ::::::::: Washington University in Saint Louis ::::::::: # #!c:\Perl\bin\Perl.exe # Robin S. Matlib 3/8/2004 12:33:02 PM # ps_wconsensus.pl # A script for graphically displaying iutput from WConsensus # Stormo and Hartzell (1989, PNAS, 86:1183-1187) # and Hertz et al. (1990, CABIOS, 6:81-92) open (WCONSENSUS,$ARGV[0])||die "Couldn't open $ARGV[0]:$!\n"; while (<WCONSENSUS>) { if (/COMMAND LINE\: (.*)/) {$title=$1;} if (/(sequence (\d+)\: .*)/) {$seq=$2;push (@seqs,$1);} if (/fragments\: \d+\-(\d+)/) {$seqhash{$seq}{"L"}=$1;} if (/([ACGTN] [\.\d]+)/) {push (@obs,$1);} if (/([ACGTN]) prior frequency = ([\.\d]+)/) {$prior{$1}=$2;} if (/^INFORMATION CONTENT/) {last;} } while (<WCONSENSUS>) { last if (/FINAL CYCLE/); } while (<WCONSENSUS>) { if (/MATRIX (\d+)/) {$mtx=$1;push (@matrices,$1);} if (/number of sequences = (\d+)/) {$mhash{$mtx}{"nos"}=$1;} if (/width = (\d+)/) {$mhash{$mtx}{"w"}=$1;} if (/crude information = ([\.\d]+)/) {$mhash{$mtx}{"crude"}=$1;} if (/unadjusted information = ([\.\d]+)/) {$mhash{$mtx}{"unadjusted"}=$1;} if (/size adjusted information = ([\.\d]+)/) {$mhash{$mtx}{"adjusted"}=$1;} if (/ln\(p-value\) = ([\.\d\-]+)/) {$mhash{$mtx}{"lnp"}=$1;} if (/p-value = ([\d\.E\-]+)/) {$mhash{$mtx}{"p"}=$1;} if (/ln\(expected frequency\) = ([\.\d\-]+)/) {$mhash{$mtx}{"lne"}=$1;} if (/expected frequency = ([\.\d]+)/) {$mhash{$mtx}{"e"}=$1;} if (/(^[ACGTN])\s\|\s{2,3}([\d\s]+)/) { #print STDERR; $base=$1;$freqs=$2; #print STDERR "base $base freqs $freqs\n"; @freqs=split(/\s+/,$freqs); foreach $freq (@freqs) { #print STDERR "freq $freq $base $prior{$base}\n"; #$freq/=$prior{$base}; #$freq = int (5*eval{log $freq;}); $freq=1 if ($freq<1); #$freq++ if ($freq % 2); } @{$mhash{$mtx}{$base}}=@freqs; } if (/(\d+)\/(\d+)\s+(\w+)/) {$mhash{$mtx}{"seqhash"}{$1}{"begin"}=$2;$mhash{$mtx}{"sequence"}{$1}=$3} } use PostScript::Simple; # create a new PostScript object foreach $mtx (@matrices) { $p = new PostScript::Simple(papersize => "Letter",colour => 1, units => "in",landscape => 1); # create a new page ##$p->newpage; # add title in red $p->setcolour("red"); $p->setfont("Times-Roman", 20); $p->text(5.5,7.75,$title,'centre'); #add subtitle $p->setfont("Times-Roman", 12); $p->text(5.5,7.5,"MATRIX $mtx",'centre'); $p->setfont("Times-Roman", 9); $p->text(5.5,7.25,"INFO crude: ".$mhash{$mtx}{"crude"} ." unadj: ".$mhash{$mtx}{"unadjusted"} ." adj: ".$mhash{$mtx}{"adjusted"}."\n" ." ln P: ".$mhash{$mtx}{"lnp"} ." p: ".$mhash{$mtx}{"p"} ." ln e: ".$mhash{$mtx}{"lne"} ." e: ".$mhash{$mtx}{"e"},'centre'); #A $p->setcolour("brightgreen"); for ($i=1;$i<=$mhash{$mtx}{"w"};$i++) { #print STDERR "$i ".${$mhash{$mtx}{"A"}}[$i-1],"\n"; $p->setfont("Times-Roman",${$mhash{$mtx}{"A"}}[$i-1]); $p->text(1.5+$i*0.125,7.00,"A",'centre'); } #T $p->setcolour("red"); for ($i=1;$i<=$mhash{$mtx}{"w"};$i++) { $p->setfont("Times-Roman",${$mhash{$mtx}{"T"}}[$i-1]); $p->text(1.5+$i*0.125,6.875,"T",'centre'); } #G $p->setcolour(255,153,0); for ($i=1;$i<=$mhash{$mtx}{"w"};$i++) { $p->setfont("Times-Roman",${$mhash{$mtx}{"G"}}[$i-1]); $p->text(1.5+$i*0.125,6.750,"G",'centre'); } #C $p->setcolour("blue"); for ($i=1;$i<=$mhash{$mtx}{"w"};$i++) { $p->setfont("Times-Roman",${$mhash{$mtx}{"C"}}[$i-1]); $p->text(1.5+$i*0.125,6.625,"C",'centre'); } $i=0; @sortedseqs = sort {$a <=> $b} keys %{$mhash{$mtx}{"seqhash"}}; foreach $seq (@sortedseqs) { #print STDERR "$mtx: $seq ",$mhash{$mtx}{"nos"}," ",$mhash{$mtx}{"seqhash"}{$seq}{"begin"}," ",$mhash{$mtx}{"w"}," ",$seqhash{$seq}{"L"},"\n"; $i++; $p->setcolour("black"); $p->line(1.5,0.8*$i*8/$mhash{$mtx}{"nos"}, 10.5,0.8*$i*(8/$mhash{$mtx}{"nos"})); $p->setfont("Times-Roman", 7); $p->text(0.25,0.8*$i*8/$mhash{$mtx}{"nos"}+0.0625,$seqs[$seq-1],'left'); $x1=1.5+9*$mhash{$mtx}{"seqhash"}{$seq}{"begin"}/$seqhash{$seq}{"L"}; $y1=0.8*$i*8/$mhash{$mtx}{"nos"}; $x2=$x1+9*$mhash{$mtx}{"w"}/$seqhash{$seq}{"L"}; $y2=$y1+0.150; $p->setcolour("green"); $p->box($x1,$y1 , $x2,$y2, filled=>1); $p->setcolour("black"); $p->setfont("Courier", 22); $p->text($x1,$y1,$mhash{$mtx}{"sequence"}{$seq}); } $p->{pspages} .= "\nshowpage\n"; # write the output to a file $p->output("$ARGV[0].$mtx.ps"); }#matrix

Message body is not shown because it is too large.

From: mcnewton [...] cpan.org
[guest - Mon Mar 8 13:37:09 2004]: Show quoted text
> # Had a problem using Postscript::Simple 0.06p1 > # see what I had to do in line 117 of my script below > # manually adding the showpage command > # I could not get any printout without this > # no biggy, but could be helpful to others. > # I've included a test input file for the script. > # Otherwise great mod!
The default is to create an EPS file. The documentation probably does not make this clear. Show quoted text
> $p = new PostScript::Simple(papersize => "Letter",colour => 1, > units => "in",landscape => 1);
This line should also have eps=>0 in there. The showpage should then be added properly.