Commit e61b1da9 authored by Ivo Fokkema's avatar Ivo Fokkema

Fixed a minor data formatting bug in HPO terms and added some automated data...

Fixed a minor data formatting bug in HPO terms and added some automated data formatting for RNA and protein fields.
- HPO terms should not be stored as "HP:123456 (term)" but instead as "term (HP:123456)".
- If RNA has not been checked, the RNA description will automatically get parentheses if they are absent.
- If RNA has not been checked, the protein description will automatically get parentheses if they are absent.
- The default protein change is now only "-" for non-coding transcripts. For coding transcripts, it's now "p.(?)".
parent 7851c580
......@@ -4,10 +4,10 @@
* LEIDEN OPEN VARIATION DATABASE (LOVD)
*
* Created : 2016-11-22
* Modified : 2018-11-29
* Modified : 2019-08-08
* For LOVD : 3.0-22
*
* Copyright : 2004-2018 Leiden University Medical Center; http://www.LUMC.nl/
* Copyright : 2004-2019 Leiden University Medical Center; http://www.LUMC.nl/
* Programmer : Ivo F.A.C. Fokkema <I.F.A.C.Fokkema@LUMC.nl>
*
*
......@@ -403,7 +403,7 @@ class LOVD_API_Submissions {
if ($aPhenotypes['hpo']) {
$sPhenotype = '';
foreach ($aPhenotypes['hpo'] as $nAccession => $sTerm) {
$sPhenotype .= (!$sPhenotype ? '' : '; ') . 'HP:' . $nAccession . ' (' . $sTerm . ')';
$sPhenotype .= (!$sPhenotype ? '' : '; ') . $sTerm . ' (HP:' . $nAccession . ')';
}
// We're assuming here, that the Phenotype/Additional column is
// active. It's an LOVD-standard custom column added to new
......@@ -737,8 +737,19 @@ class LOVD_API_Submissions {
}
// Store RNA.
// Has RNA been checked?
$bRNAChecked = false;
foreach ($aData['Screenings'] as $aScreening) {
if (strpos($aScreening['Screening/Template'], 'RNA') !== false) {
$bRNAChecked = true;
break;
}
}
if (count($aRNAs) == 1) {
$sRNA = $aRNAs[0];
// When RNA has not been checked, the RNA field description requires parentheses.
$sRNA = (!$bRNAChecked && preg_match('/^r.[^(]/', $aRNAs[0])?
'r.(' . substr($aRNAs[0], 2) . ')' :
$aRNAs[0]);
} elseif (!$aRNAs) {
// Default value.
$sRNA = 'r.(?)';
......@@ -757,10 +768,17 @@ class LOVD_API_Submissions {
// Store Protein.
if (count($aProteins) == 1) {
$sProtein = $aProteins[0];
// When RNA has not been checked, the protein description requires parentheses.
$sProtein = (!$bRNAChecked && preg_match('/^p.[^(]/', $aProteins[0])?
'p.(' . substr($aProteins[0], 2) . ')' :
$aProteins[0]);
} elseif (!$aProteins) {
// Default value.
$sProtein = '-';
// Default value depends on transcript. '-' for non-coding transcripts, p.(?) otherwise.
if (in_array(substr($aVariantLevel2['ref_seq']['@accession'], 0, 2), array('NR', 'XR'))) {
$sProtein = '-';
} else {
$sProtein = 'p.(?)';
}
} else {
// Multiple Protein changes...
$sProtein = 'p.[';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment