if ($sChromosome == 'M') { // Instead of the UD, we just use the NC, it's small enough. $sRefseqUD = $_SETT['human_builds'][$_CONF['refseq_build']]['ncbi_sequences'][$sChromosome]; } else { // Get UD from mutalyzer. try { $sRefseqUD = lovd_getUDForGene($_CONF['refseq_build'], $sSymbol); if ($sRefseqUD === '') { // Function may return an empty string. This is not a SOAP error, but still an error. For instance a type of gene we don't support. // To prevent further problems (getting transcripts, let's handle this nicely, shall we? $_BAR->setMessage('Failed to retrieve gene reference sequence. This could be a temporary error, but it is likely that this gene is not supported by LOVD.', 'done'); $_BAR->setMessageVisibility('done', true); die('</BODY>' . "\n" . '</HTML>' . "\n"); } } catch (SoapFault $e) { lovd_soapError($e); } } // Get all transcripts and info. // FIXME: When changing code here, check in transcripts?create if you need to make changes there, too. $_BAR->setMessage('Collecting all available transcripts...'); $_BAR->setProgress($nProgress += 17); $aTranscripts = $_DATA['Transcript']->getTranscriptPositions($sRefseqUD, $sSymbol, $sGeneName, $nProgress); $_BAR->setProgress(100); $_BAR->setMessage('Information collected, now building form...'); $_BAR->setMessageVisibility('done', true); $_SESSION['work'][$sPath][$_POST['workID']]['step'] = '2'; $_SESSION['work'][$sPath][$_POST['workID']]['values'] = array('id' => $sSymbol, 'name' => $sGeneName, 'chromosome' => $sChromosome, 'chrom_band' => $sChromBand, 'id_hgnc' => $sHgncID, 'id_entrez' => $sEntrez, 'id_omim' => $nOmim, 'genomic_references' => $aRefseqGenomic, 'refseq_UD' => $sRefseqUD); if (!empty($aTranscripts)) { $_SESSION['work'][$sPath][$_POST['workID']]['values'] = array_merge($_SESSION['work'][$sPath][$_POST['workID']]['values'], array('transcripts' => $aTranscripts['id'], 'transcriptMutalyzer' => $aTranscripts['mutalyzer'], 'transcriptsProtein' => $aTranscripts['protein'], 'transcriptNames' => $aTranscripts['name'], 'transcriptPositions' => $aTranscripts['positions'])); }
/** * 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; }