diff --git a/src/inc-init.php b/src/inc-init.php index 3c7f35bd..21ea4617 100644 --- a/src/inc-init.php +++ b/src/inc-init.php @@ -174,7 +174,7 @@ $_SETT = array( 'system' => array( - 'version' => '3.5-pre-02', + 'version' => '3.5-pre-03', ), 'user_levels' => array( diff --git a/src/inc-js-variants.php b/src/inc-js-variants.php index 182d7b92..42625925 100644 --- a/src/inc-js-variants.php +++ b/src/inc-js-variants.php @@ -4,14 +4,15 @@ * LEIDEN OPEN VARIATION DATABASE (LOVD) * * Created : 2011-11-08 - * Modified : 2020-07-23 - * For LOVD : 3.0-25 + * Modified : 2020-10-01 + * For LOVD : 3.5-pre-02 * * Copyright : 2004-2020 Leiden University Medical Center; http://www.LUMC.nl/ * Programmers : Ivar C. Lugtenburg * Ivo F.A.C. Fokkema * Daan Asscheman * M. Kroon + * L. Werkman * * * This file is part of LOVD. @@ -179,6 +180,17 @@ function lovd_convertPosition (oElement) // Function that can map a variant to other transcripts or the genome. var oThisDNA = $(oElement).siblings('input:first'); + var oVariantSource = $('input[name$="source"]'); + if (oVariantSource.val() == "") { + var sSource = ""; + if (oThisDNA.attr("name").indexOf("VariantOnTranscript") >= 0) { + sSource = "VOT"; + } else { + pos = oThisDNA.attr("name").lastIndexOf("/"); + sSource = oThisDNA.attr("name").substr(pos + 1); + } + oVariantSource.val(sSource); + } var oAllDNA = $('input[name$="_VariantOnTranscript/DNA"]'); $(oAllDNA).removeClass().siblings('img:first').attr({ src: 'gfx/trans.png', diff --git a/src/inc-upgrade.php b/src/inc-upgrade.php index f1793dbd..832bf646 100644 --- a/src/inc-upgrade.php +++ b/src/inc-upgrade.php @@ -833,6 +833,12 @@ function lovd_addConditionalSQL ($sCondition, $aConditionArgs, $sSQL) VALUES ("' . $_CONF['refseq_build'] . '", "' . $_CONF['refseq_build'] . ' / ' . $_SETT['human_builds'][$_CONF['refseq_build']]['ncbi_name'] . '", 0, NOW())', ), + '3.5-pre-03' => array( + 'ALTER TABLE ' . TABLE_VARIANTS . ' ADD COLUMN source VARCHAR(4) AFTER type', + 'UPDATE ' . TABLE_VARIANTS . ' AS vog + SET source = (SELECT id FROM ' . TABLE_GENOME_BUILDS . ' WHERE column_suffix = "") + WHERE vog.id NOT IN (SELECT id FROM ' . TABLE_VARIANTS_ON_TRANSCRIPTS . ')', + ), ); if ($sCalcVersionDB < lovd_calculateVersion('3.0-alpha-01')) { diff --git a/src/install/inc-sql-tables.php b/src/install/inc-sql-tables.php index ad44f181..e98e98fe 100644 --- a/src/install/inc-sql-tables.php +++ b/src/install/inc-sql-tables.php @@ -4,13 +4,14 @@ * LEIDEN OPEN VARIATION DATABASE (LOVD) * * Created : 2009-10-22 - * Modified : 2021-04-22 - * For LOVD : 3.0-27 + * Modified : 2021-10-01 + * For LOVD : 3.5-pre-02 * * Copyright : 2004-2021 Leiden University Medical Center; http://www.LUMC.nl/ * Programmers : Ivo F.A.C. Fokkema * Ivar C. Lugtenburg * M. Kroon + * L. Werkman * * * This file is part of LOVD. @@ -351,6 +352,7 @@ position_g_start INT(10) UNSIGNED, position_g_end INT(10) UNSIGNED, type VARCHAR(10), + source VARCHAR(4), mapping_flags TINYINT(3) UNSIGNED NOT NULL DEFAULT 0, average_frequency FLOAT, owned_by SMALLINT(5) UNSIGNED ZEROFILL, diff --git a/src/variants.php b/src/variants.php index 4cf163de..1dc76ad8 100644 --- a/src/variants.php +++ b/src/variants.php @@ -4,8 +4,8 @@ * LEIDEN OPEN VARIATION DATABASE (LOVD) * * Created : 2010-12-21 - * Modified : 2021-08-13 - * For LOVD : 3.0-27 + * Modified : 2021-10-05 + * For LOVD : 3.5-pre-03 * * Copyright : 2004-2021 Leiden University Medical Center; http://www.LUMC.nl/ * Programmers : Ivar C. Lugtenburg @@ -14,6 +14,7 @@ * Zuotian Tatum * Daan Asscheman * M. Kroon + * L. Werkman * * * This file is part of LOVD. @@ -805,7 +806,7 @@ function(sData) { if (!lovd_error()) { // Prepare the fields to be used for both genomic and transcript variant information. $aFieldsGenome = array_merge( - array('allele', 'effectid', 'chromosome', 'position_g_start', 'type', 'position_g_end', 'owned_by', 'statusid', 'created_by', 'created_date'), + array('allele', 'effectid', 'chromosome', 'position_g_start', 'type', 'source', 'position_g_end', 'owned_by', 'statusid', 'created_by', 'created_date'), $_DATA['Genome']->buildFields()); // Prepare values. @@ -823,6 +824,29 @@ function(sData) { $_POST['type'] = NULL; } + // Add the source of the variant if a source can be found. + if (empty($_POST['source'])) { + // If nothing is given, the source is set to null, meaning that the source is unknown. + unset($aFieldsGenome[array_search('source', $aFieldsGenome)]); + + } elseif ($_POST['source'] == 'VOT') { + // If the source is a transcript, we describe it with an empty string. + $_POST['source'] = ''; + + } else { + // If the source of the variant is not a transcript, it is a genome build. + // We will then send the ID of this genome build to the database. + // We have received the last piece of the field used, which may + // be a genome build (from VOG/DNA/hg38) or "DNA" (from VOG/DNA). + $sColumnSuffix = ($_POST['source'] == 'DNA'? '' : $_POST['source']); + + // Get the ID by its column suffix and give this as the source. + $sID = $_DB->query( + 'SELECT id FROM ' . TABLE_GENOME_BUILDS . ' + WHERE column_suffix = ?', array($sColumnSuffix))->fetchColumn(); + $_POST['source'] = $sID; + } + $_POST['owned_by'] = ($_AUTH['level'] >= LEVEL_CURATOR? $_POST['owned_by'] : $_AUTH['id']); $_POST['statusid'] = ($_AUTH['level'] >= LEVEL_CURATOR? $_POST['statusid'] : STATUS_IN_PROGRESS); $_POST['created_by'] = $_AUTH['id']; @@ -932,7 +956,8 @@ function(sData) { lovd_includeJS('inc-js-custom_links.php'); // Table. - print('
' . "\n"); + print(' ' . "\n" . + ' ' . "\n"); // Array which will make up the form table. $aForm = array_merge(