我想创建一个PNG文件。此脚本为什么在Windows上创建损坏的PNG文件?
下面的脚本执行时不返回任何错误,输出文件tester.png
不能被查看(并且cmd窗口打印附加的附加文本)。
我不知道为什么我无法查看此脚本生成的PNG文件。
我使用了Active Perl(5.18.2)和Strawberry Perl(5.18.4.1),但同样的问题。我尝试了草莓Perl,因为它具有libgd
和libpng
作为安装的一部分,即使我没有收到任何错误。有什么建议?
#!/usr/bin/perl
use Bio::Graphics;
use Bio::SeqFeature::Generic;
use strict;
use warnings;
my $infile = "data1.txt";
open(ALIGN, "$infile") or die;
my $outputfile = "tester.png";
open(OUTFILE, ">$outputfile") or die;
my $panel = Bio::Graphics::Panel->new(
-length => 1000,
-width => 800
);
my $track = $panel->add_track(
-glyph => 'generic',
-label => 1
);
while (<ALIGN>) { # read blast file
chomp;
#next if /^\#/; # ignore comments
my ($name, $score, $start, $end) = split /\t+/;
my $feature = Bio::SeqFeature::Generic->new(
-display_name => $name,
-score => $score,
-start => $start,
-end => $end
);
$track->add_feature($feature);
}
binmode STDOUT;
print $panel->png;
print OUTFILE $panel->png;
你要得到什么?如果您不想显示二进制数据,请删除'print $ panel-> png;'行。或者移除'print OUTFILE $ panel-> png;'并使用script:'script.pl> file.png'。 – jm666