示例#1
0
            $nTables = count($aTables);
            // FIXME. remove later when TABLE_PATHOGENIC and TABLE_HITS are exterminated in all LOVD installations.
            //print('  Found ' . $nTables . '/' . count($_TABLES) . ' tables.' . "\n");
            $_TABLES_cleaned = $_TABLES;
            unset($_TABLES_cleaned['TABLE_PATHOGENIC']);
            unset($_TABLES_cleaned['TABLE_HITS']);
            print '  Found ' . $nTables . '/' . count($_TABLES_cleaned) . ' tables.' . "\n";
            // FIXME; add more later.
            // General statistics...
            print "\n";
            // 2012-02-01; 3.0-beta-02; Exclude "LOVD" system user.
            $nUsers = $_DB->query('SELECT COUNT(*) FROM ' . TABLE_USERS . ' WHERE id > 0')->fetchColumn();
            $nIndividuals = $_DB->query('SELECT COUNT(*) FROM ' . TABLE_INDIVIDUALS)->fetchColumn();
            $nScreenings = $_DB->query('SELECT COUNT(*) FROM ' . TABLE_SCREENINGS)->fetchColumn();
            $nVars = $_DB->query('SELECT COUNT(*) FROM ' . TABLE_VARIANTS)->fetchColumn();
            $nGenes = count(lovd_getGeneList());
            print '  Found ' . $nUsers . ' user' . ($nUsers == 1 ? '' : 's') . '.' . "\n" . '  Found ' . $nIndividuals . ' individual' . ($nIndividuals == 1 ? '' : 's') . '.' . "\n" . '  Found ' . $nScreenings . ' screening' . ($nScreenings == 1 ? '' : 's') . '.' . "\n" . '  Found ' . $nVars . ' variant' . ($nVars == 1 ? '' : 's') . '.' . "\n" . '  Found ' . $nGenes . ' gene' . ($nGenes == 1 ? '' : 's') . '.' . "\n" . '      </PRE>' . "\n";
            if ($nGenes || $nIndividuals || $nVars) {
                lovd_showInfoTable('FINAL WARNING! If you did not download the variation and individual data stored in the LOVD system, everything will be lost!', 'warning');
            }
            print '      Please confirm uninstalling LOVD using your password.<BR>' . "\n" . '      <BR>' . "\n\n";
        }
        lovd_errorPrint();
        print '      <FORM action="' . $_PE[0] . '?confirm" method="post">' . "\n" . '        <TABLE border="0" cellpadding="0" cellspacing="0" width="300">' . "\n" . '          <TR align="right">' . "\n" . '            <TD width="125" style="padding-right : 5px;">Password</TD>' . "\n" . '            <TD width="175"><INPUT type="password" name="password" size="20"></TD></TR>' . "\n" . '          <TR align="right">' . "\n" . '            <TD width="125">&nbsp;</TD>' . "\n" . '            <TD width="175"><INPUT type="submit" value="Uninstall LOVD" style="font-weight : bold; font-size : 11px; width : 110px;"></TD></TR></TABLE></FORM>' . "\n\n";
        $_T->printFooter();
        exit;
    }
}
if (empty($_POST)) {
    print '      Welcome to the LOVD uninstaller. Please continue by providing your password.<BR>' . "\n" . '      <BR>' . "\n\n";
    lovd_showInfoTable('WARNING! If you did not download your data, you will lose all of it!', 'warning');
示例#2
0
     }
 }
 if ($aToRemove) {
     $q = $_DB->query('DELETE FROM ' . TABLE_SCR2GENE . ' WHERE screeningid = ? AND geneid IN (?' . str_repeat(', ?', count($aToRemove) - 1) . ')', array_merge(array($zData['id']), $aToRemove), false);
     if (!$q) {
         // Silent error.
         lovd_writeLog('Error', LOG_EVENT, 'Gene information entr' . (count($aToRemove) == 1 ? 'y' : 'ies') . ' ' . implode(', ', $aToRemove) . ' could not be removed from screening ' . $nID);
     } else {
         lovd_writeLog('Event', LOG_EVENT, 'Gene information entr' . (count($aToRemove) == 1 ? 'y' : 'ies') . ' ' . implode(', ', $aToRemove) . ' successfully removed from screening ' . $nID);
     }
 }
 // Add genes.
 $aSuccess = array();
 $aFailed = array();
 foreach ($_POST['genes'] as $sGene) {
     if (!in_array($sGene, $zData['genes']) && in_array($sGene, lovd_getGeneList())) {
         // Add gene to screening.
         $q = $_DB->query('INSERT IGNORE INTO ' . TABLE_SCR2GENE . ' VALUES (?, ?)', array($nID, $sGene), false);
         if (!$q) {
             $aFailed[] = $sGene;
         } else {
             $aSuccess[] = $sGene;
         }
     }
 }
 // Get genes which are modified only when linked variant is marked or public.
 $aGenes = $_DB->query('SELECT DISTINCT t.geneid FROM ' . TABLE_TRANSCRIPTS . ' AS t ' . 'INNER JOIN ' . TABLE_VARIANTS_ON_TRANSCRIPTS . ' AS vot ON (vot.transcriptid = t.id) ' . 'INNER JOIN ' . TABLE_VARIANTS . ' AS vog ON (vog.id = vot.id) ' . 'INNER JOIN ' . TABLE_SCR2VAR . ' AS s2v ON (s2v.variantid = vog.id) ' . 'INNER JOIN ' . TABLE_SCREENINGS . ' AS s ON (s.id = s2v.screeningid) ' . 'INNER JOIN ' . TABLE_INDIVIDUALS . ' AS i ON (i.id = s.individualid) ' . 'WHERE vog.statusid >= ? AND i.statusid >= ? AND s2v.screeningid = ?', array(STATUS_MARKED, STATUS_MARKED, $nID))->fetchAllColumn();
 if ($aGenes) {
     // Change updated date for genes
     lovd_setUpdatedDate($aGenes);
 }
示例#3
0
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * LOVD is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with LOVD.  If not, see <http://www.gnu.org/licenses/>.
 *
 *************/
define('ROOT_PATH', '../');
require ROOT_PATH . 'inc-init.php';
session_write_close();
$aGenes = lovd_getGeneList();
if (empty($_GET['variant']) || !preg_match('/^([A-Z]{2}_\\d{6,9}\\.\\d{1,2}(\\([A-Za-z0-9-]+_v\\d{3}\\))?:[cn])|(chr.{0,2}:[gm])\\..+$/', $_GET['variant']) || empty($_GET['gene']) || !in_array($_GET['gene'], $aGenes)) {
    die(AJAX_DATA_ERROR);
}
// Requires at least LEVEL_SUBMITTER, anything lower has no $_AUTH whatsoever.
if (!$_AUTH) {
    // If not authorized, die with error message.
    die(AJAX_NO_AUTH);
}
require ROOT_PATH . 'class/soap_client.php';
$_Mutalyzer = new LOVD_SoapClient();
$sGene = $_GET['gene'];
// If the gene is defined in the mito_genes_aliases in inc-init.php, use the NCBI gene symbol.
if (isset($_SETT['mito_genes_aliases'][$_GET['gene']])) {
    $sGene = $_SETT['mito_genes_aliases'][$_GET['gene']];
}
示例#4
0
function lovd_checkDBID($aData)
{
    // Checks if given variant and DBID match. I.e., whether or not there is
    // already an entry where this variant and DBID come together.
    // NOTE: We're assuming that the DBID field actually exists. Using this
    // function implies you've checked for it's presence.
    // All checks ignore the current variant, if the ID is given.
    global $_DB;
    // <chr||GENE>_000000 is always allowed.
    $sSymbol = substr($aData['VariantOnGenome/DBID'], 0, strpos($aData['VariantOnGenome/DBID'], '_'));
    $sGenomeVariant = str_replace(array('(', ')', '?'), '', $aData['VariantOnGenome/DNA']);
    if (!isset($aData['aTranscripts'])) {
        $aData['aTranscripts'] = array();
    }
    $aTranscriptVariants = array();
    if (!empty($aData['aTranscripts'])) {
        $aGenes = array();
        foreach ($aData['aTranscripts'] as $nTranscriptID => $aTranscript) {
            // Check for non-empty VariantOnTranscript/DNA fields for each transcript and return true immediately when GENE_000000 is used.
            $aGenes[] = $aTranscript[1];
            if (!empty($aData[$nTranscriptID . '_VariantOnTranscript/DNA'])) {
                $aTranscriptVariants[$nTranscriptID] = str_replace(array('(', ')', '?'), '', $aData[$nTranscriptID . '_VariantOnTranscript/DNA']);
            }
            if (!isset($aData['ignore_' . $nTranscriptID]) && $aData['VariantOnGenome/DBID'] == $aTranscript[1] . '_000000') {
                return true;
            }
        }
    }
    if ($aData['VariantOnGenome/DBID'] == 'chr' . $aData['chromosome'] . '_000000') {
        // Check if chr_000000 is used and return true if this is the case.
        return true;
    }
    $nIDtoIgnore = !empty($aData['id']) ? $aData['id'] : 0;
    // Check if the DBID entered is already in use by a variant entry excluding the current one.
    $nHasDBID = $_DB->query('SELECT COUNT(id) FROM ' . TABLE_VARIANTS . ' WHERE `VariantOnGenome/DBID` = ? AND id != ?', array($aData['VariantOnGenome/DBID'], $nIDtoIgnore))->fetchColumn();
    if ($nHasDBID && (!empty($sGenomeVariant) || !empty($aTranscriptVariants))) {
        // This is the standard query that will be used to determine if the DBID given is correct.
        $sSQL = 'SELECT DISTINCT t.geneid, ' . 'CONCAT(IFNULL(vog.`VariantOnGenome/DNA`, ""), ";", IFNULL(GROUP_CONCAT(vot.`VariantOnTranscript/DNA` SEPARATOR ";"), "")) as variants, ' . 'vog.`VariantOnGenome/DBID` ' . 'FROM ' . TABLE_VARIANTS . ' AS vog LEFT OUTER JOIN ' . TABLE_VARIANTS_ON_TRANSCRIPTS . ' AS vot ON (vog.id = vot.id) ' . 'LEFT OUTER JOIN ' . TABLE_TRANSCRIPTS . ' AS t ON (vot.transcriptid = t.id) ' . 'WHERE (';
        $aArgs = array();
        $sWhere = '';
        if (!empty($sGenomeVariant)) {
            // SQL addition to check the genomic notation-chromosome combination.
            $sWhere .= '(REPLACE(REPLACE(REPLACE(vog.`VariantOnGenome/DNA`, "(", ""), ")", ""), "?", "") = ? AND vog.chromosome = ?) ';
            $aArgs[] = $sGenomeVariant;
            $aArgs[] = $aData['chromosome'];
        }
        foreach ($aTranscriptVariants as $nTranscriptID => $sTranscriptVariant) {
            // SQL addition to check the transcript notation-transcript combination.
            $sWhere .= (!empty($sWhere) ? 'OR ' : '') . '(REPLACE(REPLACE(REPLACE(vot.`VariantOnTranscript/DNA`, "(", ""), ")", ""), "?", "") = ? AND vot.transcriptid = ?) ';
            $aArgs[] = $sTranscriptVariant;
            $aArgs[] = $nTranscriptID;
        }
        // SQL addition to check if the above combinations are found with the given DBID.
        $sWhere .= ') AND BINARY vog.`VariantOnGenome/DBID` = ? ';
        $aArgs[] = $aData['VariantOnGenome/DBID'];
        if ($nIDtoIgnore > 0) {
            // SQL addition to exclude the current variant, where the $aData belongs to.
            $sWhere .= 'AND vog.id != ? ';
            $aArgs[] = sprintf('%010d', $nIDtoIgnore);
        }
        $sSQL .= $sWhere . 'GROUP BY vog.id';
        $aOutput = $_DB->query($sSQL, $aArgs)->fetchAllRow();
        $nOptions = count($aOutput);
        if (!$nOptions) {
            return false;
        }
    } elseif (!empty($aGenes) && !in_array($sSymbol, $aGenes)) {
        // VOT, but DBID does not use the gene symbol of one of these VOT's.
        return false;
    } elseif (empty($aGenes)) {
        // VOG
        if (substr($aData['VariantOnGenome/DBID'], 0, 3) != 'chr') {
            if (!in_array($sSymbol, lovd_getGeneList())) {
                // Gene symbol used in the DBID does not exist in the database.
                return false;
            }
        } elseif ($sSymbol != 'chr' . $aData['chromosome']) {
            // Chromosome number in the DBID does not match the chromosome of the genomic variant.
            return false;
        }
    }
    return true;
}