示例#1
0
function getGroupSyntenyIDs($db, $bp, $dnafrag, $dnafrag2name, $species_name)
{
    $sqlDnafrag = 'SELECT r2.dnafrag_start, r2.dnafrag_end, r2.dnafrag_id ' . '  FROM dnafrag_region AS r2 
	             INNER JOIN dnafrag_region as r1 ' . ' ON (    r1.synteny_region_id = r2.synteny_region_id ' . ' AND r1.dnafrag_start <=' . $bp['end'] . '  ' . ' AND r1.dnafrag_end >= ' . $bp['start'] . '  ' . ' AND r1.dnafrag_id = ' . $dnafrag . ' ' . ' AND r2.dnafrag_id in (' . implode(',', array_keys($dnafrag2name)) . '));';
    $fragQuery = $db->query($sqlDnafrag) or trigger_error('Query failed: ' . $db->error);
    $regions = array();
    $i = 0;
    while ($row = $fragQuery->fetch_assoc()) {
        $chr = $dnafrag2name[$row['dnafrag_id']];
        $tempChr = $chr;
        $tempStart = bp2cM($chr, $row['dnafrag_start'], $species_name);
        $tempEnd = bp2cM($chr, $row['dnafrag_end'], $species_name);
        if ($tempStart != NULL || $tempEnd != NULL) {
            $regions[$i]['chr'] = $tempChr;
            $regions[$i]['start'] = $tempStart;
            $regions[$i]['end'] = $tempEnd;
            $i++;
        }
    }
    return $regions;
}
示例#2
0
    $regionEnd[] = substr($regionBP, $pos + 1);
}
//initialize array for mapping groupnumbers to regions
$group2region = array();
$group2region2 = array();
//load informations of experiment1 (database and so on...)
//$genome_db_ids = array($experiment1['genome_db_id'],$experiment2['genome_db_id']);
$species_names = array($experiment1['species'], $experiment2['species']);
$database1 = $experiment1['db_name'];
$database2 = $experiment2['db_name'];
//put the region start and region end in arrays
for ($i = 0; $i < sizeof($regionChr); $i++) {
    //bp to cM for start of region
    $intervalStart[$i] = bp2cM($regionChr[$i], (int) $regionStart[$i], $experiment1['species']);
    //bp to cM for end of region
    $intervalEnd[$i] = bp2cM($regionChr[$i], (int) $regionEnd[$i], $experiment1['species']);
}
$chromosomsEx1 = $regionChr;
$ex1 = get_loci_from_sql($database1, $experiment1['connection'], 'userinterval', $chromosomsEx1, $confidence_int, $group2region, $intervalStart, $intervalEnd);
if (!empty($ex1)) {
    // converts $ex1 in 2 arrays: $groups1 = groupnr -> ('loci' -> lociOfGroup, 'start', 'end', 'Chr') $mapEx1 = index -> (locus,groupNr)
    list($groups1, $mapEx1) = $ex1;
} else {
    echo '<INPUT TYPE=BUTTON VALUE="back" onClick="history.back()">';
    echo '<br />';
    fatal_error('nothing found for the given region(-s)');
}
// generates an arrays with index -> locinames
// $loci_ex1 = array_map('current',$mapEx1);
$chromosomsEx2 = getChromosomes($compara, $experiment2['ensembl_species']);
//filter compara chromosoms for existing chromosoms in QTL-database