"; echo ""; $count = array(); $chr = array(); while($row = mysql_fetch_array($result)){ echo ""; echo ""; echo ""; array_push($count,$row['count(*)']); array_push($chr,$row['chrom']); echo ""; } echo "
chrom count(*)
" . $row['chrom'] . "" . $row['count(*)'] . "
"; } //After printing the table, want to give the total number of reads //Want to return the total count for the file (same as above) $total_read = mysql_query("Select count(*) from summarybed WHERE bedfile_id=$bedfile_id;"); //Need to get the number from the resulting query $row_total_read = mysql_fetch_row($total_read); $total_read_number = $row_total_read[0]; print "Total number of reads for this BED file is: $total_read_number
"; //Creating the pie chart $count_str = join(",",array_values($count)); $chr_str = join("|",array_values($chr)); $color_inx1 = rand(0,2); $color_inx2 = $color_inx1 +1; $color_array = array("FF0000","0000FF","00FF00","BB0000"); //print (gettype($count_str)); $chart1 = ""; print $chart1; return array( "Table of Read Count by Chromosome" => $count_table, "Total number of reads for this BED file is" => $total_read_number, "Distribution of Reads" => $chart1 ); }//end of compare function ?>