[Ilugc] error with php script

  • From: smal@xxxxxxxxxxx (Mahalingam Subramaniam)
  • Date: Tue Jan 19 20:04:07 2010

Dear All
the expected output is an image of vertical rectangular thin strip ( like 
commercial barcode)  within the stipulated rectangular boundary using php 
script with "gd" library on Ubuntu 9.04.  I am able to achieve this partially 
as the script counts & creates "PNG" images partially from the input text file 
containing characters i.e. A, G, C, T,........   Instead of counting and 
drawing image for 800 characters, it does its job only for about 150 
characters. The sample input & php script file is attached with this mail. 
kindly input your valuable suggestions & recommendations through this forum.
with regards
s.mahalingam
S.Mahalingam
Technical Officer
Molecular Genetics Lab (Bioinformatics)
Centre for Cellular and Molecular Biology
Habsiguda, Uppal Road, Hyderabad 500 007
Ph:+91-40-27192776, 27192775, 27192635, 27192643
     +91-40-27160222 - 41 (20 Lines)        
Fax: :+91-40-27160591, 27160311
E-mail:
smal@xxxxxxxxxxx
smal8@xxxxxxxxx
smalgene@xxxxxxxxx
http://www.ccmb.res.in
-------------- next part --------------
<?php
#$file="count_chars.txt";
$file="12S.txt";
$handle=fopen($file, "r+");

$A=0;
$G=0;
$C=0;
$T=0;
#$question=0;
#$dash =0;

$img = imagecreate(850,80);
$white = imagecolorallocate($img, 255,255,255);
$green=imagecolorallocate($img, 0, 128, 0);
$black=imagecolorallocate($img, 0, 0, 0);
$red=imagecolorallocate($img, 255, 0, 0);
$blue=imagecolorallocate($img, 0, 0, 255);


$x1=40;
$y1=40;
$x2=43;
$y2=80;


while(!feof($handle))

{ $readchar=fgetc($handle);
  $readchar=strtoupper($readchar);
#$img = imagecreate(367,80);
 if($readchar=='A')

  {
#    echo($readchar);
    $A++;
    imagefilledrectangle($img, $x1, $y1, $x2, $y2, $green);
    $x1=$x1+6;
    $x2=$x2+6;
   # break;
  }
else if($readchar=='G')
 {
#    echo($readchar);
    $G++;
    imagefilledrectangle($img, $x1, $y1, $x2, $y2, $black);
    $x1=$x1+6;
    $x2=$x2+6;
   # break;
  }
else if($readchar=='C')

  {
    $C++;
    imagefilledrectangle($img, $x1, $y1, $x2, $y2, $blue);
    $x1=$x1+6;
    $x2=$x2+6;
   # break;
  }
else if($readchar=='T')

  {
    $T++;
    imagefilledrectangle($img, $x1, $y1, $x2, $y2, $red);
    $x1=$x1+6;
    $x2=$x2+6;
   # break;
}


fclose($handle);


header("Content-type: image/png");
imagepng($img);
imagedestroy($img);

?>


-------------- next part --------------
GCCTTACTATCAGTTACCCCTCAACTTACACATGCAAGTCTCAGCACCCCCGTGAGGAAGCCCTTAAACCCTTCACCAGGATAAGGAGCCGGTATCAGGCCCAATTTTTGCCCATGACACCTAGCCCCCGCCACGCCCCCAAGGGTTGTCAGCAGTGATAAACATTATCCATAAGCGATAGCTTGACTTAGTTAGAGGGAAGATAGTTGGCCAACTCGGTGCCAGCCGCCGCGGTTAGACCCACAAACTAAAATTGATAGTCATCGGCGTTAAGCGTGATTATAGCTACTATTGAATTAGAGTAAAACTCCTTGCCCAGCTGTGAAAAGCATGCATTCCGGAATCCTATGAACGAAAGTCACTCTAACTAACGCTTGAACACACGACAGCTAAGAACACAAACTGGGATTAGAGACCCCACTATGCTTAGCCGTAAATATCAACTCACAACTATAAACGCCAGGGAACTACGGGCTAGGCCTAAAACCCAAAGGACTTGACGGTGTCCCACCCAACTAGAGGAGCCTGTTCTGTAATCGATAACCCCCGCTAAACCTAACCTCTTCTTGCTTTTCAGCCTGTATACCTCCGTCGTAAATCCGCCCTGTGAATGCCTAATAGCGTGATTCAATTACCTTCCGTTAATACGTCAGGTCAAGGTGCAGCCTATGAAGAGGGGAGCAATGGGCTACAATTTCTAACTTAGAACAAACGAATTACTATATGAAACTAGCTATGAAGGAGGATTTAGTAGTAAAGAGAAATTAACGTGTTCTCTTTAACATGGCCCTGGGACGCGTACACACCGCCCGTC

Other related posts:

  • » [Ilugc] error with php script - Mahalingam Subramaniam