Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Ploting a 2d graph ...Bioinformatics

by govindkailas (Acolyte)
on Apr 27, 2007 at 10:15 UTC ( #612346=perlquestion: print w/ replies, xml ) Need Help??
govindkailas has asked for the wisdom of the Perl Monks concerning the following question:

i have set of values of XYZ coord and the result of their RMSD(root mean square deviation),all these are stored in a file... so i need to plot a graph by reading this values from the file.the file content is shown below
X Y Z coords for model:1 X Y Z coords for model:2 Distance btwn the +coords ******************** ******************** ************** +****** 3.434 -6.163 -1.655 3.853 -6.638 -1.842 0.660420320704 +928 -6.227 0.621 3.115 -6.323 0.008 3.458 0.708966853950 +169 -1.324 -1.345 -3.901 -1.134 -1.015 -3.797 0.394735354383 +161 5.781 2.099 4.597 5.506 2.312 5.263 0.751365423745 +33 4.926 6.887 -2.229 5.453 6.881 -2.623 0.658028114900 +876 -5.284 -1.264 -0.084 -4.929 -1.189 0.099 0.406372981385 +327 6.096 4.124 -4.591 6.379 3.890 -4.817 0.431185574897 +862 *********************************** X Y Z coords for model:1 X Y Z coords for model:3 Distance btwn the +coords ******************** ******************** ************** +****** 3.434 -6.163 -1.655 3.355 -6.081 -2.184 0.541115514469 +877 -6.227 0.621 3.115 -6.412 0.418 3.323 0.344525761010 +697 -1.324 -1.345 -3.901 -1.189 -1.065 -3.601 0.432001157405 +857 5.781 2.099 4.597 5.448 2.564 5.351 0.946377303193 +604 4.926 6.887 -2.229 5.132 6.599 -2.797 0.669331009292 +114 -5.284 -1.264 -0.084 -4.933 -0.678 -0.034 0.684906562970 +454 X Y Z coords for model:1 X Y Z coords for model:4 Distance btwn the +coords ******************** ******************** ************** +****** 3.434 -6.163 -1.655 3.845 -6.488 -1.926 0.589904229515 +266 -6.227 0.621 3.115 -5.952 1.213 3.659 0.849720542296 +113 -1.324 -1.345 -3.901 -1.273 -1.053 -3.983 0.307553247422 +296 5.781 2.099 4.597 5.848 1.551 5.892 1.407770577899 +68 4.926 6.887 -2.229 5.103 6.729 -2.644 0.478035563530 +581 -5.284 -1.264 -0.084 -5.233 -0.566 0.355 0.826151317858 +902
how can i plot this??? can any one help me plzz

Comment on Ploting a 2d graph ...Bioinformatics
Download Code
Re: Ploting a 2d graph ...Bioinformatics
by jettero (Monsignor) on Apr 27, 2007 at 10:53 UTC

    I'm fond of using gri for plotting — particularly for technical papers. That has nothing to do with perl of course...

    In perl, I'd almost certainly use GD::Graph for the plotting and I'd use regular expressions to read the values into my @data = ( [@X], [@Y1], [@Y2], [@Y3], ... ) array.

    -Paul

Re: Ploting a 2d graph ...Bioinformatics
by polettix (Vicar) on Apr 27, 2007 at 11:06 UTC
    Need Help?? You should ask yourself...

    On a general basis, for the plotting part, first decide what you're interested to plot, then take a look at GD::Graph and GD::Graph3D.

    To read the data, you can open the file, then iterate on its lines - something like this:

    open my $fh, '<', $filename or die "open('$filename'): $!"; while (<$fh>) { # Do whatever you want with the line in $_ } close $fh;
    Before going further, again, you must decide what you want to plot and how (e.g. you have three datasets: do you want a graph for each of them? Do you want to mix up all data? ...)

    Flavio
    perl -ple'$_=reverse' <<<ti.xittelop@oivalf

    Don't fool yourself.
      GD::Graph can't make 2D data plots. It will only take a series of Y-values, and display them left-to-right in the order given. There's no way, for instance, to make a plot in which there are 2 points with the same X value - at least, no way I can discover.
        This is unbelievable. Don't know where you tried to discover how to do it, but the very first example in GD::Graph documentation shows you how to:
        • set your own X axis values/labels, AND
        • plot two graphs in a single chart.

        Flavio
        perl -ple'$_=reverse' <<<ti.xittelop@oivalf

        Io ho capito... ma tu che hai detto?
Re: Ploting a 2d graph ...Bioinformatics
by eXile (Priest) on Apr 27, 2007 at 14:35 UTC
    I'd second the posts above, but can't resist plugging another option for actually plotting your data once you have selected the data you want to plot:

    <shameless plug> Chart::Graph::Gnuplot </shameless plug>

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://612346]
Approved by planetscape
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (12)
As of 2015-07-06 21:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (83 votes), past polls