Is there a way of formatting the numbers in my array so that the module can interpret them? (am I missing something?) - obviously i have printed out the contents of the array etc but can't see whats going wrong! I hope someone can help.
# heres my code use strict; use Chart::Plot; open (FILE, $ARGV[0]) or die "Unable to open file: perl says $!"; my $line; my @array; my (@t3, @c3, @a3, @g3, @cai, @cbi, @fop, @nc, @gc3, @gc, @lsym, @laa, + @gravy, @aromo); while (<FILE>) { $line = $_; chomp $line; if ($line !~ /^(\w{2,3})(.{1})(\w{2}\d{6}.{2})(\w?)(\d+\W{1,2} +\d+.{0,5})(\s+)(\d+\W?\d+\s+)(\d+\W?\d+\s+)(\d+\W?\d+\s+)(\d+\W?\d+\s ++)(\d+\W?\d+\s+)(.?\d+\W?\d+\s+)(\d+\W?\d+\s+)(\d+\W?\d+\s+)(\d+\W?\d ++\s+)(\d+\W?\d+\s+)(\d+\s+\d+\s+)(\W?\d+\W?\d+\s+)(\d+\W?\d+)/) { # print "BAD LINE!!!!!!!!!!!!!!!!!!!!!\n"; # print "$line\n"; $line =~ s/.*//; } @array = (); @array = split (/\s+/, $line); # $array[0] to $array[14] should now be defined. $array[1] =~ s/^T3s//; $array[2] =~ s/^C3s//; $array[3] =~ s/^A3s//; $array[4] =~ s/^G3s//; $array[5] =~ s/^CAI//; $array[6] =~ s/^CBI//; $array[7] =~ s/^Fop//; $array[8] =~ s/^Nc//; $array[9] =~ s/^GC3s//; $array[10] =~ s/^GC//; $array[11] =~ s/^L_sym//; $array[12] =~ s/^L_aa//; $array[13] =~ s/^Gravy//; $array[14] =~ s/^Aromo//; push @t3, $array[1]; push @c3, $array[2]; push @a3, $array[3]; push @g3, $array[4]; push @cai, $array[5]; push @cbi, $array[6]; push @fop, $array[7]; push @nc, $array[8]; push @gc3, $array[9]; push @gc, $array[10]; push @lsym, $array[11]; push @laa, $array[12]; push @gravy, $array[13]; push @aromo, $array[14]; } my $gravy = join ('', @gravy); @gravy = split ('', $gravy); print @gravy; my $gc3 = join ('', @gc3); @gc3 = split ('', @gravy); my $graph = Chart::Plot->new (650,400); $graph->setData (\@gravy, \@gc3); my ($x_min,$y_min, $x_max, $y_max) = $graph->getBounds(); $graph->setGraphOptions ('title' => 'My first graph', 'horAxisLabel' => 'gravy', 'vertAxisLabel' => 'gc3'); open (IMG, ">testgraph.png") or die $!; binmode IMG; print IMG $graph->draw(); close IMG;
In reply to Chart::Plot module by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |