Im following this guide: http://www.bioperl.org/wiki/HOWTO:Graphics and what Im tryin to do is create a png file for each hit in the blastoutput file. Also each png file should be named after the hit names. So forexample if there is a hit called 200134, then the resulting png file would be 200134.png etc

sub parseBlastOutput{ use Bio::Graphics; use Bio::SearchIO; use Bio::SeqFeature::Generic; my $searchio = Bio::SearchIO->new( -file => 'CAZyOutputM7.xml', -format => 'blastxml' ) or die +'parse failed'; #my $result = $searchio->next_result() or die "no result"; while (my $result = $searchio->next_result) { my $panel = Bio::Graphics::Panel->new( -length => $result-> +query_length, -width => 800, -pad_left => 10, -pad_right => 10 ); my $full_length = Bio::SeqFeature::Generic->new( -start + => 1, -end + => $result->query_length, -display_name + => $result->query_name ); $panel->add_track( $full_length, -glyph => 'arrow', -tick => 2, -fgcolor => 'black', -double => 1, -label => 1 ); my $track = $panel->add_track( -glyph => 'graded_segment +s', -label => 1, -connector => 'dashed', -bgcolor => 'blue', -font2color => 'red', -sort_order => 'high_score', -description => sub { my $featu +re = shift; return un +less $feature->has_tag('description'); my ($desc +ription) = $feature->each_tag_value('description'); my $score + = $feature->score; "$descrip +tion, score=$score"; } ); while (my $hit = $result->next_hit) { my $hitname = $hit->name; my $feature = Bio::SeqFeature::Generic->new( -score + => $hit->raw_score, -display_name + => $hit->name, -tag + => { description => $hit->description } ); while (my $hsp = $hit->next_hsp) { $feature->add_sub_SeqFeature($hsp,'EXPAND'); } $track->add_feature($feature); open my $blast, '>', $hitname or die "Failed to create $hi +tname\n"; print $blast $panel->png; close $blast or die "Failed to close $blast\n"; } } }

The way i have the script setup now, it doesnt do anything. I would appreciate some help on this.


In reply to BioPerl Graphics problem by Tjuh

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.