BioPerl/BioGraphics only prints one value instead of all
1
0
Entering edit mode
10.0 years ago
Felix_Sim ▴ 260

I am trying to plot SNPs onto a gene.

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";

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(-start=>$SNP,-end=>$SNP);
    $track->add_feature($feature);}

print $png $panel -> png;

Result:

How can I print all values in @SNPs?

BioPerl Perl BioGraphics • 2.0k views
ADD COMMENT
0
Entering edit mode

Modules files are all loaded but removed here to match the character limit!

ADD REPLY
1
Entering edit mode
10.0 years ago
Felix_Sim ▴ 260

Problem solved.

my @SNPs = "408777 408900 409100 409480";

should be ...

my @SNPs = qw(408777 408900 409100 409480);
ADD COMMENT

Login before adding your answer.

Traffic: 3180 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6