Example #1
0
                 // If the insert succeeded, save some data in the variant array for lovd_fetchDBID().
                 $aVariant['aTranscripts'][$nID] = array($aFieldsTranscript['id_ncbi'], $sSymbol);
                 $aVariant[$nID . '_VariantOnTranscript/DNA'] = $aVariantOnTranscriptSQL[1][7];
             }
             // Also remember that we've got this gene and transcript now.
             $aTranscriptsInLOVD[$sSymbol][$nID] = array('id' => $nID, 'id_ncbi' => $aFieldsTranscript['id_ncbi']);
         } else {
             // Mutalyzer does not have the transcript we're looking for. Don't retry this gene!
             $aFailedGenes[$sGene] = true;
         }
     }
 }
 // Try to get a DBID if the variant doesn't have one.
 if (empty($aVariant['VariantOnGenome/DBID'])) {
     // Also set the DBID if that's possible.
     $sDBID = lovd_fetchDBID($aVariant);
 } else {
     $sDBID = null;
 }
 // Now see if the above script actually mapped it and define the update query.
 if (!empty($aVariant['aTranscripts'])) {
     // It did.
     $sUpdateSQL = 'mapping_flags = ' . ($aVariant['mapping_flags'] | MAPPING_DONE) . ', edited_by = 0, edited_date = NOW()';
 } elseif (empty($aVariant['alreadyMappedTranscripts']) && !empty($aVariant['errorDetected'])) {
     // This variant cannot be mapped, probably because it's malformed.
     $sUpdateSQL = 'mapping_flags = ' . ($aVariant['mapping_flags'] | MAPPING_NOT_RECOGNIZED);
 } else {
     // This variant can't be mapped to anything (other than what it is mapped to already) right now.
     $sUpdateSQL = 'mapping_flags = ' . ($aVariant['mapping_flags'] | MAPPING_DONE);
 }
 // Update the variant.
Example #2
0
 }
 if (isset($aData['motherid'])) {
     $aData['motherid'] = lovd_findImportedID('Individuals', $aData['motherid']);
 }
 if (isset($aData['panelid'])) {
     $aData['panelid'] = lovd_findImportedID('Individuals', $aData['panelid']);
 }
 if (isset($aData['transcriptid'])) {
     $aData['transcriptid'] = lovd_findImportedID('Transcripts', $aData['transcriptid']);
 }
 if ($sSection == 'Variants_On_Genome') {
     // We want the DBID to be generated automatically, but it relies on the database contents, so we have to do it just before inserting the data.
     // In theory, we should be first importing the variants which have their DBID set, since the IDs that will be generated here might conflict
     // with these, but the chances are slim and we can put the responsibility of not doing this in the hands of the uploaders.
     if (!$aData['VariantOnGenome/DBID']) {
         $aData['VariantOnGenome/DBID'] = lovd_fetchDBID($aData);
     }
 }
 if ($sSection == 'Variants_On_Transcripts') {
     $aData['id'] = lovd_findImportedID('Variants_On_Genome', $aData['variantid']);
 }
 $nNewID = $aSection['object']->insertEntry($aData, $aFields);
 $aParsed[$sSection]['data'][$nID]['newID'] = $nNewID;
 if (isset($aData['statusid']) && $aData['statusid'] >= STATUS_MARKED) {
     // These updated IDs are used to determine which genes are updated.
     $aParsed[$sSection]['updatedIDs'][] = $nNewID;
 }
 if ($sSection == 'Diseases') {
     // New diseases need to have the default custom columns enabled.
     lovd_addAllDefaultCustomColumns('disease', $nNewID);
 }
Example #3
0
                 // End of c. loop
             }
             // End of VOG loop
         }
         // End of "we've got transcript information"
     }
     // End of "we've got a gene information"
 }
 // End of accession loop
 foreach ($aFieldsVariantOnGenome as $i => $aFieldsVOG) {
     // Now that we know the VariantOnTranscript entries, we can
     // fetch a DBID for the VariantOnGenome and insert everything.
     if (empty($aTranscriptDataForDBID[$i])) {
         $aTranscriptDataForDBID[$i] = array();
     }
     $aFieldsVOG['VariantOnGenome/DBID'] = lovd_fetchDBID(array_merge($aFieldsVOG, $aTranscriptDataForDBID[$i]));
     // Now finally insert the VariantOnGenome!
     $_DB->query('INSERT INTO ' . TABLE_VARIANTS . ' (`' . implode('`, `', array_keys($aFieldsVOG)) . '`) VALUES (?' . str_repeat(', ?', count($aFieldsVOG) - 1) . ')', array_values($aFieldsVOG));
     $nVariantID = $_DB->lastInsertId();
     $aUploadData['num_variants']++;
     // Link this variant to the current screening if applicable.
     if (isset($_POST['screeningid'])) {
         $qInsertScr2Var->execute(array($_POST['screeningid'], $nVariantID));
     }
     if (!empty($aFieldsVariantOnTranscript[$i])) {
         // Also got some VariantOnTranscripts.
         foreach ($aFieldsVariantOnTranscript[$i] as $sAccession => $aFieldsVOT) {
             if (($nTranscriptID = $_DB->query('SELECT id FROM ' . TABLE_TRANSCRIPTS . ' WHERE id_ncbi = ?', array($sAccession))->fetchColumn()) === false) {
                 // We don't have the transcript in the database, se we need to insert it first.
                 foreach ($aFieldsTranscript as $sSymbol => &$aFieldsTranscriptsOfGene) {
                     if (!empty($aFieldsTranscriptsOfGene[$sAccession])) {
Example #4
0
 function checkFields($aData, $zData = false)
 {
     global $_AUTH, $_CONF, $_SETT;
     // Mandatory fields.
     $this->aCheckMandatory = array('chromosome', 'effect_reported', 'owned_by', 'statusid');
     if ($_AUTH['level'] >= LEVEL_CURATOR) {
         $this->aCheckMandatory[] = 'effect_concluded';
     } elseif (isset($aData['effect_reported']) && $aData['effect_reported'] === '0') {
         // Submitters must fill in the variant effect field; '0' is not allowed for them.
         unset($aData['effect_reported']);
     }
     // Do this before running checkFields so that we have time to predict the DBID and fill it in.
     if (!empty($aData['VariantOnGenome/DNA']) && isset($this->aColumns['VariantOnGenome/DBID']) && ($this->aColumns['VariantOnGenome/DBID']['public_add'] || $_AUTH['level'] >= LEVEL_CURATOR)) {
         // VOGs with at least one VOT, which still have a chr* DBID, will get an error. So we'll empty the DBID field, allowing the new VOT value to be autofilled in.
         if (!empty($aData['aTranscripts']) && !empty($aData['VariantOnGenome/DBID']) && strpos($aData['VariantOnGenome/DBID'], 'chr' . $aData['chromosome'] . '_') !== false) {
             $aData['VariantOnGenome/DBID'] = '';
         }
         if (empty($aData['VariantOnGenome/DBID'])) {
             if (lovd_getProjectFile() != '/import.php') {
                 // Only predict an DBID, if we're actually going to use it (which doesn't happen when we're importing).
                 $aData['VariantOnGenome/DBID'] = $_POST['VariantOnGenome/DBID'] = lovd_fetchDBID($aData);
             }
         } elseif (!lovd_checkDBID($aData)) {
             lovd_errorAdd('VariantOnGenome/DBID', 'Please enter a valid ID in the ' . (lovd_getProjectFile() == '/import.php' ? 'VariantOnGenome/DBID' : '\'ID\'') . ' field or leave it blank and LOVD will predict it. Incorrect ID: "' . htmlspecialchars($aData['VariantOnGenome/DBID']) . '".');
         }
     }
     parent::checkFields($aData);
     // Checks fields before submission of data.
     if (isset($aData['effect_reported']) && !isset($_SETT['var_effect'][$aData['effect_reported']])) {
         lovd_errorAdd('effect_reported', 'Please select a proper functional effect from the \'Affects function (reported)\' selection box.');
     }
     if (isset($aData['effect_concluded']) && !isset($_SETT['var_effect'][$aData['effect_concluded']])) {
         lovd_errorAdd('effect_concluded', 'Please select a proper functional effect from the \'Affects function (concluded)\' selection box.');
     }
     if (!empty($aData['chromosome']) && !isset($_SETT['human_builds'][$_CONF['refseq_build']]['ncbi_sequences'][$aData['chromosome']])) {
         lovd_errorAdd('chromosome', 'Please select a proper chromosome from the \'Chromosome\' selection box.');
     }
     lovd_checkXSS();
 }