0

我正在尝试将 SNP 绘制到基因(或以下)上。我的代码如下:

#!/usr/bin/perl

use strict;
use warnings;

use Bio::Graphics;
use Bio::SeqFeature::Generic;


my @SNPs = "408777 408900 409100 409480";
my $gene_name = "GSTd10";
my $scaffold = "KB668289";
my $gene_start = 408763;
my $gene_end = 409489;
my $length = $gene_end - $gene_start + 50;

open my $png,  ">", "$gene_name.png" or die "Cannot open $gene_name.png: $!\n";

    #Create a panel for the image#
my $panel=Bio::Graphics::Panel->new(-offset => $gene_start, -length => $length, -width => 1000, -pad_left => 100, -pad_right => 10, -pad_top => 10);

my $track_whole=$panel->add_track(-glyph => 'graded_segments', -label => 1, -bgcolor => 'black', -font2color => 'black',);
my $feature= Bio::SeqFeature::Generic->new(-display_name => $gene_name, -start => $gene_start, -end => $gene_end,);
$track_whole->add_feature($feature);

my $track=$panel->add_track(-glyph => 'graded_segments', -label => 1, -bgcolor =>'blue', -min_score => 0, -max_score => 30, -font2color => 'black');
foreach my $SNP (@SNPs)
{
    my $feature= Bio::SeqFeature::Generic->new(-label => $SNP, -start => $SNP, -end => $SNP);
    $track->add_feature($feature);
}

#This will print out the final panel i.e. you must have created an object called $panel above
print $png $panel -> png;

每当我运行这个脚本时,我只会打印一行。 在此处输入图像描述

打印所有值的错误在哪里@SNPs?另外,有没有办法打印^而不是块?

4

1 回答 1

0

在这一行

 my @SNPs = "408777 408900 409100 409480";

您只是在创建一个包含整个字符串的单个元素的数组。

尝试

my @SNPs = qw(408777 408900 409100 409480);
于 2014-04-30T16:19:49.860 回答