Chrom | Count |
";
//xxxxxx
$count = array();
$chr = array();
while($row = mysql_fetch_array($result)){
$count_table .= "";
$count_table .= "" . $row['chrom'] . " | ";
$count_table .= "" . $row['count(*)'] . " | ";
array_push($count,$row['count(*)']);
array_push($chr,$row['chrom']);
$count_table .= "
";
}
$count_table .= "
";
//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 = "https://chart.googleapis.com/chart?chs=300x225&cht=p&chd=t:$count_str&chl=$chr_str&chco=$color_array[$color_inx1],$color_array[$color_inx2]";
//print $chart1;
return array(
"table_of_reads" => $count_table,
"read_count" => $total_read_number,
"read_dist_chart" => $chart1
);
}//end of compare function
?>