How to draw nodes with arcs in PHP?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rekha Kumaran
    New Member
    • Jan 2011
    • 30

    How to draw nodes with arcs in PHP?

    Will any body will tell me how to draw nodes with arcs by using PHP?

    The nodes values is gene names.
    Last edited by Niheel; May 9 '11, 04:29 AM.
  • nathj
    Recognized Expert Contributor
    • May 2007
    • 937

    #2
    The best way to get some help on this forum is to show you've had a go first.

    So I would suggest having a look around and have a go at it. then when you get stuck post back with the code and the specific problem.

    Perhaps a look at the manual?

    Cheers
    nathj

    Comment

    • dgreenhouse
      Recognized Expert Contributor
      • May 2008
      • 250

      #3
      Look at the graphics libraries built in and that can extend php.

      Comment

      • Rekha Kumaran
        New Member
        • Jan 2011
        • 30

        #4
        Thanks for ur reply. I got some package Graph.jar. They designed it in Smarty. It is working well. If i do change the coding in .tpl file, the result is not coming.

        Do anybody know about template_c?

        The coding is

        draw_Nodes.tpl
        Code:
        <div style= "border:1px solid #000000;position: relative; width: 760px;  left:50%; margin-left: -380px;z-index: 2; " id="layer65">
        
        <table border="0" width="300"  bordercolor="#C0C0C0" cellspacing="0" cellpadding="0" align ="center">
        <td><p align=left"><b><font face="Verdana" size="2">Network Visualization</font></b></td></table>
        </table>
        <table border="1" width="95%" height="250"  cellpadding="0"  cellspacing="0" align="center" bordercolor="#C0C0C0">
        <tr><td>
        <table border="0" width="700" height="400"  cellpadding="0"  cellspacing="0" align="center" bordercolor="#C0C0C0">
        <tr><td>
        {if $regulation_array[0][0] == ''}
        <table border="1" width="120" height="120"  cellpadding="0"  cellspacing="0" align="center" bordercolor="#C0C0C0"><tr><td align = center><font size="2"><b></b></font></td></tr></table>
        
        {else}
        <table border="0" width="120" height="120"  cellpadding="0"  cellspacing="0" align="center" bordercolor="#C0C0C0"><tr><td align =center><font size ="2"><b>Regulators/sRNAs</b></font></td></tr><tr><td><p align="center"><form method="GET" action="regulation_query.php?acc="><select size="3" name="acc" multiple>{section name=sec1 loop=$regulation_array}
        <option value = {$regulation_array[sec1][0]}>{$regulation_array[sec1][1]}</option>
        {/section}<option  value = {section name=sec1 loop=$regulation_array}{$regulation_array[sec1][0]}-{/section} selected>Select All</option></select><br><input type="submit" value="    Submit    " ></form></p></td></tr></table>{/if}</td>
        
        <td rowspan="3"><table border="1" width="550" height="300"  cellpadding="0"  cellspacing="0" align="center" bordercolor="#C0C0C0"><tr><td>
         <applet codebase="./Graph/" code="Graph.class" archive="SGraph.jar" width=550 height=330>
                        <param name=edges value="{if $targeting_array[0][0] == ''}
        		{else}
        		{section name=sec1 loop=$targeting_array}{$gene_array[1]}({$gene_array[0]})-{$targeting_array[sec1][1]}({$targeting_array[sec1][2]})/ST:({$targeting_array[sec1][0]}),{/section}
        		{/if}
        		{if $regulation_array[0][0] == ''}
        		{else}
        		{section name=sec1 loop=$regulation_array}{$gene_array[1]}({$gene_array[0]})-{$regulation_array[sec1][1]}({$regulation_array[sec1][2]})/SR:({$regulation_array[sec1][0]}),{/section}
        		{/if}">
                        <param name=center value="{$gene_array[1]}({$gene_array[0]})/S">
                alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
                Your browser is completely ignoring the &lt;APPLET&gt; tag!
         </applet><font face="Verdana" size="2">
         Requires <a href ="http://www.java.com/en/download/index.jsp">Java Web Start</a>, which is automatically installed when you install JRE/JDK with version 1.4.2 above.</font>
        </td></tr></table></td></tr>
        <tr><td>
        {if $targeting_array[0][0] == ''}
        <table border="1" width="120" height="120"  cellpadding="0"  cellspacing="0" align="center" bordercolor="#C0C0C0"><tr><td align = center><font size="2"><b></b></font></td></tr></table>
        {else}
        <table border="0" width="120" height="120"  cellpadding="0"  cellspacing="0" align="center" bordercolor="#C0C0C0"><tr><td align = center><font size="2"><b>sRNAs/Targets</b></font></td></tr><tr><td><p align="center"><form method="GET" action="targeting_query.php?acc={$acc}"><select size="3" name="acc">
        {section name=sec1 loop=$targeting_array}<option value = {$targeting_array[sec1][0]}>{$targeting_array[sec1][1]}</option>
        {/section}
        <option value ={section name=sec1 loop=$targeting_array}{$targeting_array[sec1][0]}-{/section} selected>Select All</option>
        </select><br><input type="submit" value="    Submit    " ></form></p></td></tr></table>
        {/if}</td>
        
        
        <tr><td>
        {if $coprotein[0][0] == ''}
        <table border="0" width="120" height="120"  cellpadding="0"  cellspacing="0" align="center" bordercolor="#C0C0C0"><tr><td align = center><font size="2"><b></b></font></td></tr></table></td></tr></table>
        {else}
        <table border="1" width="120" height="80"  cellpadding="0"  cellspacing="0" align="center" bordercolor="#C0C0C0"><tr><td align=center><font size ="2"><b>Co protein</b></font></td></tr><tr><td  align = center><form method="GET" action="co_protein.php"><select size="2" name="coprotein"></select><br><input type="submit" value="    Submit    " ></form></td></tr></table></td></tr></table></td></tr></table>
        {/if}</td></tr></table>
        
        </div>
        draw_Nodes.php
        Code:
        <?php
        
        
        $targeting_array = array(0=>array(0=>"sRNAT0003",1 =>"ftsZ",2 =>"sRNATG0002"));
        $gene_array = array(0 =>"sRNAG0012",1 =>"dicF",2 =>"ECK1568;b1574;",3 =>"1647406",4 =>"1647458",5 =>"forward",6 =>"Qin prophage; DicF antisense RNA",7 =>"Escherichia coli K12 MG1655",8=>"Inferred from genetic interaction;Inferred from direct assay;",9 =>"TTTCTGGTGACGTTTGGCGGTATCAGTTTTACTCCGTGACTGCTCTGCCGCCC",10=>"regulonDB",11=>"The DicF RNA acts to inhibit cell division (Bouche F,1989). DicF causes inhibition of the formation of the constriction and the separation of the replicated chromosomes into the daughter nucleoids (Tetart F,1992). DicF RNA interferes with FtsZ mRNA translation (Tetart F,1992); DicF may bind to and occlude the ribosome binding site on the FtsZ mRNA (Tetart F,1992). The DicF-mediated delay in nucleoid segregation is suppressed by FtsZ overproduction (Tetart F,1992). The DicF-mediated decrease in FtsZ abundance and activity is suppressed by an rpoB mutation, and this effect is partially counteracted by an rpoS mutation (Cam K,1995). The DicF RNA is subject to processing by RNase III and RNase E (Faubladier M,1990). The DicF gene has similarity to multiple prophage sequences (Faubladier M,1994). Regulation has been described (Faubladier M,1990). Reviews: (Delihas N.,1995. Wassarman KM,1999).",12=>"2477663;1552861;7651342;7540245;7508908;1691299;1372677;10068996;"); 
        $regulation_array =array(0=>array(0=>"sRNAR0026",1=>"hfq ",2=>"sRNARG0025"));
        
        require './library/smarty/Smarty.class.php';
        
        $tpl = new Smarty;
        $tpl->compile_check = true;
        
        $tpl->assign("gene_array", $gene_array);
        $tpl->assign("regulation_array", $regulation_array);
        $tpl->assign("targeting_array",$targeting_array);
        $tpl->display('draw_Nodes.tpl');
        
        ?>
        Last edited by Niheel; May 16 '11, 05:59 AM.

        Comment

        Working...