Please clarify your requirements. Is it:

1. Read a file that has no fixed size in chunks of 100 characters.
2. Count the occurance of A,G,C,T in the above 100 characters.
3. Draw a bargraph for the above - 1 bargraph in a line for each 100 chars.
4. Stop when count of A,G,C,T reaches 100.

Please state your specs in simple statements like above.



> To: [email protected]
> From: [email protected]
> Date: Wed, 3 Feb 2010 17:37:02 +0530
> Subject: Re:  RE: [TwinCLinG] read and count only limited characters usingphp 
>  script
> 
> -- Original Message --
> From: shinoj vg <[email protected]>
> To: <[email protected]>
> Date: Mon, 1 Feb 2010 20:55:11 +0530
> Subject: RE: [TwinCLinG] read and count only limited characters using php
>  script
> I dont understand your requirements but you can try this:
> while(( ($contents=fread( $handle, 100 )) != '' )) {
> for ($i=0; $i<100; $i++)
> {if
> {
> ...
> }
> else
> if{
> ..
> }
> }
> }
> There may be a problem in the last read above.
> If you are trying to count the occurance of A,G,C,T in the file using 
> preg_grep may be easier.
> Regards,
> Shinoj.
> still, it reads & counts all entire characters present in the input file 
> instead of limited number of characters as I desire. The aim is to draw a 
> barcode of series of thin vertical lines with respect to its recurrence in 
> the input file. The preg_grep function is to search & filter the pattern from 
> an array which may not be exactly what I am looking for.
> with regards
> s.mahalingam
> > To: [email protected]
> > From: [email protected]
> > Date: Sun, 31 Jan 2010 22:44:00 +0530
> > Subject: [TwinCLinG] read and count only limited characters using php script
> > 
> >  
> >                                                                             
> >                                     
> >                                                     
> > Hi All
> > the aim is to read and count only 100 characters from input text file 
> > containing characters of A, G, C, T....of 500 or more.... The PHP script 
> > which I appended here reads all the 500 or whatever is present in the input 
> > file. The help which I expect from the forum is to find and correct the 
> > mistake by which it can read and count only the limited number of 
> > characters to be set as a condition.
> > <?php
> > $file="co3.txt";
> > $handle=fopen($file, 'r');
> > $A=0;
> > $G=0;
> > $C=0;
> > $T=0;
> > $contents[] = '';
> >     while(!feof($handle)) {
> >    $contents[] = fread($handle, 100);
> > }
> > #echo($contents);
> >  { $readchar=fgetc($handle);
> >   $readchar=strtoupper($readchar);
> > for ($i=0; $i<100; $i++)
> > {
> > #echo ($contents[$i]);
> > if($contents[$i] == 'A' )    # && ($A++ <=100))
> >  {
> >  
> >     $A++;
> > #   if ( $A++ <= 100 ) {
> >     imagefilledrectangle($img, $x1, $y1, $x2, $y2, $green);
> > /***to draw an image of thin vertical rectangular line for every characters 
> > read and counted which is secondary***/
> >     $x1=$x1+6;
> >     $x2=$x2+6;
> > }
> >     else
> >     if ($contents[$i] == 'G' )  # ($G++ <=100))
> > {
> >     $G++;
> > #   if ( $G++ <= 100 ) {
> >     imagefilledrectangle($img, $x1, $y1, $x2, $y2, $black);
> >     $x1=$x1+6;
> >     $x2=$x2+6;
> > }
> >     else
> >     if ($contents[$i] == 'C' )  #($C++ <=100))
> > {
> >     
> >     $C++;
> > #   if ( $C++ <= 100 ) {
> >     imagefilledrectangle($img, $x1, $y1, $x2, $y2, $blue);
> >     $x1=$x1+6;
> >     $x2=$x2+6;
> > }
> >     else
> >     if ($contents[$i] == 'T' )  #($T++ <=100))
> > {
> >     $T++;
> > #   if ( $T++ <= 100 ) {
> >     imagefilledrectangle($img, $x1, $y1, $x2, $y2, $red);
> >     $x1=$x1+6;
> >     $x2=$x2+6;
> > }
> > }
> > fclose($handle);
> > ?>
> > I shall appreciate and honor your help.
> > with regards
> > s.mahalingam
> > 
> > 
> > 
> > [Non-text portions of this message have been removed]
> > 
> > 
> > 
> > ------------------------------------
> > 
> > -----------------------------------------------
> > Next Meeting as on our Website: http://ilughyd.org.in
> > -----------------------------------------------Yahoo! Groups Links
> > 
> > 
> > 
>                                         
> _________________________________________________________________
> Hotmail: Trusted email with Microsofts powerful SPAM protection.
> https://signup.live.com/signup.aspx?id=60969
> [Non-text portions of this message have been removed]
> ------------------------------------
> -----------------------------------------------
> Next Meeting as on our Website: http://ilughyd.org.in
> -----------------------------------------------Yahoo! Groups Links
>     Individual Email | Traditional
>     http://docs.yahoo.com/info/terms/
> 
> 
> 
> [Non-text portions of this message have been removed]
> 
> 
> 
> ------------------------------------
> 
> -----------------------------------------------
> Next Meeting as on our Website: http://ilughyd.org.in
> -----------------------------------------------Yahoo! Groups Links
> 
> 
> 
                                          
_________________________________________________________________
Hotmail: Powerful Free email with security by Microsoft.
https://signup.live.com/signup.aspx?id=60969

[Non-text portions of this message have been removed]

Reply via email to