Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store the original variant description as the source of the submission #561

Merged
merged 4 commits into from
Oct 5, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/inc-init.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
$_SETT = array(
'system' =>
array(
'version' => '3.5-pre-02',
'version' => '3.5-pre-03',
),
'user_levels' =>
array(
Expand Down
16 changes: 14 additions & 2 deletions src/inc-js-variants.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>
* Ivo F.A.C. Fokkema <[email protected]>
* Daan Asscheman <[email protected]>
* M. Kroon <[email protected]>
* L. Werkman <[email protected]>
*
*
* This file is part of LOVD.
Expand Down Expand Up @@ -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',
Expand Down
6 changes: 6 additions & 0 deletions src/inc-upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')) {
Expand Down
6 changes: 4 additions & 2 deletions src/install/inc-sql-tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>
* Ivar C. Lugtenburg <[email protected]>
* M. Kroon <[email protected]>
* L. Werkman <[email protected]>
*
*
* This file is part of LOVD.
Expand Down Expand Up @@ -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,
Expand Down
31 changes: 27 additions & 4 deletions src/variants.php
Original file line number Diff line number Diff line change
Expand Up @@ -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-01
* For LOVD : 3.5-pre-02
*
* Copyright : 2004-2021 Leiden University Medical Center; http://www.LUMC.nl/
* Programmers : Ivar C. Lugtenburg <[email protected]>
Expand All @@ -14,6 +14,7 @@
* Zuotian Tatum <[email protected]>
* Daan Asscheman <[email protected]>
* M. Kroon <[email protected]>
* L. Werkman <[email protected]>
*
*
* This file is part of LOVD.
Expand Down Expand Up @@ -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.
Expand All @@ -823,6 +824,27 @@ 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)]);
loeswerkman marked this conversation as resolved.
Show resolved Hide resolved

} 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.
$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();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how this is possible, but there is another space missing. I thought we tested this code - this should have caused a query error. Anyway, I'll fix it.

$_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'];
Expand Down Expand Up @@ -932,7 +954,8 @@ function(sData) {
lovd_includeJS('inc-js-custom_links.php');

// Table.
print(' <FORM id="variantForm" action="' . CURRENT_PATH . '?create&amp;reference=' . $_GET['reference'] . (isset($sGene)? '&amp;geneid=' . rawurlencode($sGene) : '') . (isset($_POST['screeningid'])? '&amp;target=' . $_GET['target'] : '') . '" method="post">' . "\n");
print(' <FORM id="variantForm" action="' . CURRENT_PATH . '?create&amp;reference=' . $_GET['reference'] . (isset($sGene)? '&amp;geneid=' . rawurlencode($sGene) : '') . (isset($_POST['screeningid'])? '&amp;target=' . $_GET['target'] : '') . '" method="post">' . "\n" .
' <INPUT name="source" type="hidden" value="' . (empty($_POST['source'])? '' : $_POST['source']) . '"> ' . "\n");

// Array which will make up the form table.
$aForm = array_merge(
Expand Down