diff --git a/dynamic_loading.php b/dynamic_loading.php index 0668ddc..46fe311 100644 --- a/dynamic_loading.php +++ b/dynamic_loading.php @@ -527,14 +527,26 @@ $res = mysqli_query ($link,$sql); $returnArray = []; $compString = ""; + $count = 0; + while($row = mysqli_fetch_row($res)){ $start = (string)$row[0]; $end = (string)$row[1]; //$compString.(string)$row[0]."-".(string)$row[1].", "; - $compString .= $start."-".$end.", "; + $count++; + if($count > 5){ + $compString = substr($compString,0,-2); + $compString .= " ... zoom in to see more "; + break; + } + else{ + $compString .= $start." - ".$end.", "; + } } $compString = substr($compString,0,-2); return $type.": ".$compString; + + } function loadHG19Tooltip($chrom,$type, $min,$max,$fileHandle){ @@ -551,19 +563,44 @@ $res = mysqli_query ($link,$sql); $returnArray = []; $compString = ""; + $count = 0; while($row = mysqli_fetch_row($res)){ + $count++; if($type == "gene"){ $start = (string)$row[0]; $end = (string)$row[1]; $name = (string)$row[2]; - //$compString.(string)$row[0]."-".(string)$row[1].", "; - $compString .= $name." (".$start."-".$end."), "; + if($count > 5){ + $compString = substr($compString,0,-2); + $compString .= " ... zoom in to see more "; + break; + } + else{ + //$compString.(string)$row[0]."-".(string)$row[1].", "; + $compString .= $name." (".$start." - ".$end."), "; + } } else{ - $name = (string)$row[2]; - $start = substr((string)$row[3],0,-1); - $end = substr((string)$row[4],0,-1); - $compString .= $name."(".$start."-".$end."), "; + if($count > 1){ + $compString = substr($compString,0,-2); + $compString .= " ... zoom in to see more "; + break; + } + else{ + $name = (string)$row[2]; + $start = substr((string)$row[3],0,-1); + $end = substr((string)$row[4],0,-1); + $start_array = explode(",",$start); + $end_array = explode(",",$end); + $exons = ""; + foreach ($start_array as $key => $value) { + + $exons .= "(".$value." - ".$end_array[$key]."), "; + } + + $compString .= $name." ".$exons; + } + } }