Entering edit mode
9.1 years ago
nikunj.m1989
•
0
Hi all,
I am new to BioGraphics. I have a text file with three columns: Protein name, start position, end position.
I want to map them based on their locations. I modified the code from the BioGraphics tutorial. My code looks something like this:
#!/usr/bin/perl
use strict;
use Bio::Graphics;
use Bio::SeqFeature::Generic;
my $panel = Bio::Graphics::Panel->new(
-length => 10000,
-width => 8000
);
my $track = $panel->add_track(
-glyph => 'generic',
-label => 1
);
while (<>) {
chomp;
my($name,$start,$end) = split /\t+/;
my $feature = Bio::SeqFeature::Generic->new(
-display_name => $name,
-start => $start,
-end => $end
);
$track->add_feature($feature);
}
binmode(STDOUT);
print $panel->png;
perl test_image.pl map_final.txt > 12.png.
My result is a blank image. Can someone help me with what is happening here?
Many thanks
Nik
That's how I would debug such a program:
map_final.txt
, check that the file is in fact multi-tab separated (\t+
= at least one tab), try split without argument, should work on most filesHi Michael, I got the output using fixed coordinates.
Coming back to my file input, I got some kind of output with this code:
The difference here is
-score => $score
rather than-start => $start
. If I replace it back to-start => $start
, I get no output. Could it be my coordinates are too big? I tried with higher length but didn't help.Example of
map_final.txt
:Here, I added an extra column which I don't really care about. Reason being that the tutorial script was written with BLAST output in mind. My data is 1st column as name, 3rd as start and 4th as end.
Tabs don't seem to be the issue.
It worked finally. Thanks for the help Michael. I think the length and the file was an issue. My new code looks like this:
map_final.txt
has data such as:It is a crude image but I can work on it now.
Thanks again.
nice it worked, but please always have
use strict; use warnings; if it doesn't work with use strict it is possibly broken.
Yes I will, sometimes I miss it when I am in a rush.