免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1677 | 回复: 1
打印 上一主题 下一主题

bioperl 图像处理 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-03-06 10:38 |只看该作者 |倒序浏览
各位大虾:
小弟偶得一段程序,如下。请问如何输出到一个.png的文件。(现在运行结果为乱码,在windows下)
use strict;
use warnings;
use Bio::Graphics;
use Bio::SeqIO;
use Bio::SeqFeature::Generic;
my $file = "E:\\perl_test\\AB07769.gbk" or die "provide a sequence file as the argument";
my $outfile=">e:\\perl_test\\gra.png";
my $io = Bio::SeqIO->new(-file=>$file);
my $out= Bio::SeqIO->new(-file=>">e:\\perl_test\\gra";
my $seq = $io->next_seq;
my @features = $seq->all_SeqFeatures;
# sort features by their primary tags
my %sorted_features;
for my $f (@features) {
my $tag = $f->primary_tag;
push @{$sorted_features{$tag}},$f;}
my $panel = Bio::Graphics:anel->new(
                                                                                                                                                        -length => $seq->length,
                                                                                                                                                        -key_style => 'between',
                                                                                                                                                        -width => 800,
                                                                                                                                                        -pad_left => 10,
                                                                                                                                                        -pad_right => 10);
$panel->add_track(arrow =>Bio::SeqFeature::Generic->new(-start => 1,-end => $seq->length),
                                                                                                                                                                                                                                -bump => 0,
                                                                                                                                                                                                                                -double=>1,
                                                                                                                                                                                                                                -tick => 2);
$panel->add_track(generic =>Bio::SeqFeature::Generic->new(-start => 1,
                                                                                                                                                                                                                                        -end => $seq->length,
                                                                                                                                                                                                                                        -bgcolor => 'blue',
                                                                                                                                                                                                                                        -label => 1));
# general case
my @colors = qw(cyan orange blue purple green
chartreuse magenta yellow aqua);
my $idx = 0;
for my $tag (sort keys %sorted_features) {
my $features = $sorted_features{$tag};
$panel->add_track($features,
                                                                        -glyph => 'generic',
                                                                        -bgcolor => $colors[$idx++ % @colors],
                                                                        -fgcolor => 'black',
                                                                        -font2color => 'red',
                                                                        -key => "${tag}s",
                                                                        -bump => +1,
                                                                        -height => 8,
                                                                        -label => 1,
                                                                        -description => 1,);
}
print  $panel->png;

论坛徽章:
0
2 [报告]
发表于 2006-03-13 11:41 |只看该作者
要把输出文件句柄改为二进制模式。

binmode OUTFH;
print OUTFH ...;
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP