Example #1
0
     $aFieldsTranscript[$sSymbol] = array();
     $_BAR->setMessage('Loading transcript information for ' . $sSymbol . '...', 'done');
     /* FIXME: Fatal error with unknown reason.
        try {
            // Can throw notice when TranscriptInfo is not present (when a gene recently has been renamed, for instance).
            $aTranscripts = $_Mutalyzer->getTranscriptsAndInfo(array('genomicReference' => 'UD_132085330279', 'geneName' => 'IVD')); // Works fine.
            $aTranscripts = $_Mutalyzer->getTranscriptsAndInfo(array('genomicReference' => 'UD_139396270809', 'geneName' => 'C1orf86')); // Error: list index out of range.
            var_dump($aTranscripts);
        } catch (SoapFault $e) {
            lovd_soapError($e);
        }
        var_dump($aTranscripts);exit;
        */
     try {
         // Can throw notice when TranscriptInfo is not present (when a gene recently has been renamed, for instance).
         $aTranscripts = @$_Mutalyzer->getTranscriptsAndInfo(array('genomicReference' => $aGenesChecked[$sSymbol]['refseq_UD'], 'geneName' => $sSymbol))->getTranscriptsAndInfoResult->TranscriptInfo;
     } catch (SoapFault $e) {
         // 2014-06-25; Can fail with no proper reason; for now, don't die on this error.
         // lovd_soapError($e);
     }
     if (!empty($aTranscripts) && is_array($aTranscripts)) {
         foreach ($aTranscripts as $oTranscript) {
             // Remember the data for each of this gene's transcripts. We may insert them as needed.
             $aFieldsTranscript[$sSymbol][$oTranscript->id] = array('geneid' => $sSymbol, 'name' => str_replace($aGenesChecked[$sSymbol]['name'] . ', ', '', $oTranscript->product), 'id_mutalyzer' => str_replace($sSymbol . '_v', '', $oTranscript->name), 'id_ncbi' => $oTranscript->id, 'id_ensembl' => '', 'id_protein_ncbi' => !isset($oTranscript->proteinTranscript) ? '' : $oTranscript->proteinTranscript->id, 'id_protein_ensembl' => '', 'id_protein_uniprot' => '', 'position_c_mrna_start' => $oTranscript->cTransStart, 'position_c_mrna_end' => $oTranscript->sortableTransEnd, 'position_c_cds_end' => $oTranscript->cCDSStop, 'position_g_mrna_start' => $oTranscript->chromTransStart, 'position_g_mrna_end' => $oTranscript->chromTransEnd, 'created_by' => 0, 'created_date' => date('Y-m-d H:i:s'));
         }
     }
     // Remove the 'Loading transcript information...' message.
     $_BAR->setMessage(' ', 'done');
 }
 // Now we do have all of this gene's transcripts ready for insertion; let's see if its in there.
 $bSuccess = false;
Example #2
0
// when exiting the script. We do it this way because the mapping script is called
// asynchronously, but the session data is locked by PHP to prevent race conditions.
// This forces it to become completely synchronous. Without closing the session, the
// user will not be able to do anything in LOVD until this script finishes.
session_write_close();
$sChromosome = null;
$nVariants = 0;
// Check if all transcripts have their positions and the mutalyzer ID correctly set; if not, fix before we start to do any type of mapping.
// 0.12 sec for 22K transcripts.
// FIXME: Would be better to pick a random gene to do this on, instead of a random transcript, and continuously repeat the call for each gene if there is more than one transcript.
$zTranscripts = $_DB->query('SELECT t.*, g.refseq_UD FROM ' . TABLE_TRANSCRIPTS . ' AS t INNER JOIN ' . TABLE_GENES . ' AS g ON (t.geneid = g.id) WHERE g.refseq_UD != "" AND (t.position_g_mrna_end = 0 OR t.id_mutalyzer IS NULL) ORDER BY RAND() LIMIT 10')->fetchAllAssoc();
if ($zTranscripts) {
    foreach ($zTranscripts as $aTranscript) {
        try {
            // Can throw notice when TranscriptInfo is not present (when a gene recently has been renamed, for instance).
            $aOutput = @$_Mutalyzer->getTranscriptsAndInfo(array('genomicReference' => $aTranscript['refseq_UD'], 'geneName' => $aTranscript['geneid']))->getTranscriptsAndInfoResult->TranscriptInfo;
        } catch (SoapFault $e) {
        }
        if (!empty($aOutput) && is_array($aOutput)) {
            foreach ($aOutput as $oTranscriptInfo) {
                $aTranscriptValues = get_object_vars($oTranscriptInfo);
                // Check if the given NM is in the output, disregard version for now.
                if (preg_replace('/\\.\\d+/', '', $aTranscript['id_ncbi']) == preg_replace('/\\.\\d+/', '', $aTranscriptValues['id'])) {
                    // 2014-06-12; 3.0-11; Sometimes we don't receive chrom* values, for instance when using an NG (doesn't always happen). Set this to prevent endless loop.
                    if (empty($aTranscriptValues['chromTransStart'])) {
                        $aTranscriptValues['chromTransStart'] = empty($aTranscriptValues['gTransStart']) ? 1 : $aTranscriptValues['gTransStart'];
                    }
                    if (empty($aTranscriptValues['chromTransEnd'])) {
                        $aTranscriptValues['chromTransEnd'] = empty($aTranscriptValues['gTransEnd']) ? 1 : $aTranscriptValues['gTransEnd'];
                    }
                    $_DB->query('UPDATE ' . TABLE_TRANSCRIPTS . ' SET id_mutalyzer = ?, position_c_mrna_start = ?, position_c_mrna_end = ?, position_c_cds_end = ?, position_g_mrna_start = ?, position_g_mrna_end = ?' . ($aTranscriptValues['id'] == $aTranscript['id_ncbi'] || strpos($aTranscript['id_ncbi'], 'expired') !== false ? '' : ', name = CONCAT(name, " (expired, new version available)")') . ' WHERE id = ?', array(str_replace($aTranscript['geneid'] . '_v', '', $aTranscriptValues['name']), $aTranscriptValues['cTransStart'], $aTranscriptValues['sortableTransEnd'], $aTranscriptValues['cCDSStop'], $aTranscriptValues['chromTransStart'], $aTranscriptValues['chromTransEnd'], $aTranscript['id']));
Example #3
0
 /**
  * This method returns transcripts and info from mutalyzer.
  * Note that transcripts that are already in the LOVD database are skipped.
  * @param string $sRefseqUD Genomic reference.
  * @param string $sSymbol HGNC gene symbol.
  * @param string $sGeneName HGNC gene name.
  * @param float $nProgress Variable is passed by reference and used to keep up the progress of the progress bar.
  * If the progress bar is initialized before this method is called, you can keep track of the progress with this variable.
  * The progress bar will start at zero when this variable is not set.
  * @return array $aTranscriptInfo Transcript information from mutalyzer.
  **/
 public function getTranscriptPositions($sRefseqUD, $sSymbol, $sGeneName, &$nProgress = 0.0)
 {
     global $_BAR, $_SETT, $_DB;
     $_Mutalyzer = new LOVD_SoapClient();
     $aTranscripts = array('id' => array(), 'name' => array(), 'mutalyzer' => array(), 'positions' => array(), 'protein' => array(), 'added' => array());
     $sAliasSymbol = $sSymbol;
     $aTranscripts['added'] = $_DB->query('SELECT id_ncbi FROM ' . TABLE_TRANSCRIPTS . ' WHERE geneid = ? ORDER BY id_ncbi', array($sSymbol))->fetchAllColumn();
     if (isset($_SETT['mito_genes_aliases'][$sSymbol])) {
         // For mitochondrial genes, an alias must be used to get the transcripts and info.
         // List of aliases are hard-coded in inc-init.php.
         $sAliasSymbol = $_SETT['mito_genes_aliases'][$sSymbol];
     }
     try {
         // Can throw notice when TranscriptInfo is not present (when a gene recently has been renamed, for instance).
         $aTranscripts['info'] = @$_Mutalyzer->getTranscriptsAndInfo(array('genomicReference' => $sRefseqUD, 'geneName' => $sAliasSymbol))->getTranscriptsAndInfoResult->TranscriptInfo;
     } catch (SoapFault $e) {
         lovd_soapError($e);
     }
     if (empty($aTranscripts['info'])) {
         // No transcripts found.
         $aTranscripts['info'] = array();
         return $aTranscripts;
     }
     $nTranscripts = count($aTranscripts['info']);
     foreach ($aTranscripts['info'] as $oTranscript) {
         $nProgress += (100 - $nProgress) / $nTranscripts;
         $_BAR->setMessage('Collecting ' . $oTranscript->id . ' info...');
         if (isset($_SETT['mito_genes_aliases'][$sSymbol])) {
             // For mitochondrial genes, we won't be able to get any proper transcript information. Fake one.
             // FIXME: This code only works, if there is just one transcript. Can we assume there is only one?
             //   Perhaps it's better to use the same array construction as for normal genes, which is shorter, faster, and more flexible.
             $sRefseqNM = $sRefseqUD . '(' . $sAliasSymbol . '_v001)';
             if (in_array($sRefseqNM, $aTranscripts['added'])) {
                 // Transcript already exists; continue to the next transcript.
                 continue;
             }
             $aTranscripts['id'] = array($sRefseqNM);
             $aTranscripts['protein'] = array($sRefseqNM => '');
             // Until revision 679 the transcript version was not used in the index. The version number was removed with preg_replace.
             // Can not figure out why version is not included. Therefore, for now we will do without preg_replace.
             $aTranscripts['mutalyzer'] = array($sRefseqNM => '001');
             $aTranscripts['name'] = array($sRefseqNM => 'transcript variant 1');
             // FIXME: Perhaps indicate this transcript is a fake one, reconstructed from the CDS?
             $aTranscripts['positions'] = array($sRefseqNM => array('chromTransStart' => isset($oTranscript->gTransStart) ? $oTranscript->gTransStart : 0, 'chromTransEnd' => isset($oTranscript->gTransEnd) ? $oTranscript->gTransEnd : 0, 'cTransStart' => isset($oTranscript->cTransStart) ? $oTranscript->cTransStart : 0, 'cTransEnd' => isset($oTranscript->sortableTransEnd) ? $oTranscript->sortableTransEnd : 0, 'cCDSStop' => isset($oTranscript->cCDSStop) ? $oTranscript->cCDSStop : 0));
         } else {
             if (in_array($oTranscript->id, $aTranscripts['added'])) {
                 // Transcript already exists; continue to the next transcript.
                 continue;
             }
             $aTranscripts['id'][] = $oTranscript->id;
             // Until revision 679 the transcript version was not used in the index. The version number was removed with preg_replace.
             // Can not figure out why version is not included. Therefore, for now we will do without preg_replace.
             $aTranscripts['name'][$oTranscript->id] = str_replace($sGeneName . ', ', '', $oTranscript->product);
             $aTranscripts['mutalyzer'][$oTranscript->id] = str_replace($sSymbol . '_v', '', $oTranscript->name);
             $aTranscripts['positions'][$oTranscript->id] = array('chromTransStart' => isset($oTranscript->chromTransStart) ? $oTranscript->chromTransStart : 0, 'chromTransEnd' => isset($oTranscript->chromTransEnd) ? $oTranscript->chromTransEnd : 0, 'cTransStart' => $oTranscript->cTransStart, 'cTransEnd' => $oTranscript->sortableTransEnd, 'cCDSStop' => $oTranscript->cCDSStop);
             $aTranscripts['protein'][$oTranscript->id] = !isset($oTranscript->proteinTranscript) ? '' : $oTranscript->proteinTranscript->id;
         }
         $_BAR->setProgress($nProgress);
     }
     return $aTranscripts;
 }