Commit 1a3a3b78 authored by Ivo Fokkema's avatar Ivo Fokkema

Large commit to decrease diff with LOVD+ by pulling in LOVD+ code.

- Mostly no changes to LOVD3 functionality.
- Some changes to support the new jQuery library.
parent 7f659c23
.idea
doc/tex/manual.aux
doc/tex/manual.html
doc/tex/manual.log
doc/tex/manual.out
doc/tex/manual.pdf
doc/tex/manual.toc
doc/tex/*.aux
doc/tex/*.html
doc/tex/*.log
doc/tex/*.out
doc/tex/*.pdf
doc/tex/*.toc
src/_sett
src/refseq
src/config.ini.php
......
......@@ -4,8 +4,8 @@
* LEIDEN OPEN VARIATION DATABASE (LOVD)
*
* Created : 2011-11-09
* Modified : 2016-11-18
* For LOVD : 3.0-18
* Modified : 2019-08-28
* For LOVD : 3.0-22
*
* Copyright : 2004-2016 Leiden University Medical Center; http://www.LUMC.nl/
* Programmers : Ivar C. Lugtenburg <I.C.Lugtenburg@LUMC.nl>
......@@ -94,7 +94,7 @@ if (!file_exists($sFile)) {
if (in_array($sObject, array('Phenotype', 'Transcript_Variant', 'Custom_ViewList'))) {
if (in_array($sObject, array('Phenotype', 'Transcript_Variant', 'Custom_ViewList', 'ScreeningMOD'))) {
// Exception for VOT viewEntry, we need to isolate the gene from the ID to correctly pass this to the data object.
if ($sObject == 'Transcript_Variant') {
// This line below is redundant as long as it's also called at the lovd_isAuthorized() call. Remove it here maybe...?
......
......@@ -4,7 +4,7 @@
* LEIDEN OPEN VARIATION DATABASE (LOVD)
*
* Created : 2010-02-18
* Modified : 2018-08-22
* Modified : 2019-08-28
* For LOVD : 3.0-22
*
* Copyright : 2004-2019 Leiden University Medical Center; http://www.LUMC.nl/
......@@ -55,6 +55,7 @@ $aNeededLevel =
'Disease' => 0,
'Gene' => 0,
'Gene_Panel' => LEVEL_SUBMITTER, // LOVD+
'Gene_Panel_Gene' => LEVEL_SUBMITTER, // LOVD+
'Gene_Panel_Gene_REV' => LEVEL_SUBMITTER, // LOVD+
'Gene_Statistic' => LEVEL_SUBMITTER, // LOVD+
'Genome_Variant' => 0,
......@@ -210,6 +211,8 @@ require $sFile;
$sObjectClassname = 'LOVD_' . str_replace('_', '', $sObject);
$_DATA = new $sObjectClassname($sObjectID, $nID);
if (POST && ACTION == 'applyFR') {
// Apply find & replace.
......
......@@ -4,8 +4,8 @@
* LEIDEN OPEN VARIATION DATABASE (LOVD)
*
* Created : 2010-03-04
* Modified : 2018-01-26
* For LOVD : 3.0-21
* Modified : 2019-08-28
* For LOVD : 3.0-22
*
* Copyright : 2004-2018 Leiden University Medical Center; http://www.LUMC.nl/
* Programmers : Ivo F.A.C. Fokkema <I.F.A.C.Fokkema@LUMC.nl>
......@@ -116,7 +116,7 @@ class LOVD_Column extends LOVD_Object {
'form_type_' => 'Form type',
'select_options' => 'Select options',
'preg_pattern' => 'Regular expression pattern',
'public_view_' => 'Show to public',
'public_view_' => (!LOVD_plus? 'Show to public' : 'Show column on data listing'),
'public_add_' => 'Show on submission form',
'allow_count_all_' => 'Include in search form',
'parent_objects' => 'Column activated for',
......@@ -152,7 +152,7 @@ class LOVD_Column extends LOVD_Object {
'db' => array('c.standard', 'DESC', true),
'legend' => array('Whether this column is activated by default. For shared columns (Phenotype or VariantOnTranscript columns) this means newly created diseases or genes, include this column by default.')),
'public_view_' => array(
'view' => array('Public', 60, 'style="text-align : center;"'),
'view' => array((!LOVD_plus? 'Public' : 'Visible'), 60, 'style="text-align : center;"'),
'db' => array('c.public_view', 'DESC', true),
'legend' => array('Whether the public can see this column\'s contents or not.')),
'col_order' => array(
......@@ -294,7 +294,7 @@ class LOVD_Column extends LOVD_Object {
'width' => array('Column display width in pixels', '', 'text', 'width', 5),
array('', '', 'print', '<IMG src="gfx/trans.png" alt="" width="' . (int) $_POST['width'] . '" height="3" style="background : #000000;"><BR><SPAN class="form_note">(This is ' . (int) $_POST['width'] . ' pixels)</SPAN>'),
'mandatory' => array('Mandatory field', '', 'checkbox', 'mandatory'),
'public_view' => array('Show contents to public', '', 'checkbox', 'public_view'),
'public_view' => array((LOVD_plus? 'Show column on data listings' :'Show contents to public'), '', 'checkbox', 'public_view'),
'public_add' => array('Show field on submission form', '', 'checkbox', 'public_add'),
'hr',
// FIXME; implement this later.
......
......@@ -4,7 +4,7 @@
* LEIDEN OPEN VARIATION DATABASE (LOVD)
*
* Created : 2011-02-17
* Modified : 2019-02-14
* Modified : 2019-08-28
* For LOVD : 3.0-22
*
* Copyright : 2004-2019 Leiden University Medical Center; http://www.LUMC.nl/
......@@ -341,9 +341,12 @@ class LOVD_Custom extends LOVD_Object {
// Gathers the columns which are active for the current data type and returns them in a viewList format
// Note: object_custom_viewlists.php implements their own version of this code.
global $_AUTH;
$aViewList = array();
foreach ($this->aColumns as $sID => $aCol) {
if (!$aCol['public_view'] && $_AUTH['level'] < LEVEL_COLLABORATOR) {
// In LOVD_plus, the public_view field is used to set if a custom column will be displayed in a VL or not.
// So, in LOVD_plus we need to check for ALL USERS if a custom column has public_view flag turned on or not.
if (!$aCol['public_view'] && (LOVD_plus? true : $_AUTH['level'] < LEVEL_COLLABORATOR)) {
continue;
}
$bAlignRight = preg_match('/^(DEC|FLOAT|(TINY|SMALL|MEDIUM|BIG)?INT)/', $aCol['mysql_type']);
......@@ -394,7 +397,10 @@ class LOVD_Custom extends LOVD_Object {
// Disabled for LOVD+, to speed up the import.
$this->checkInputRegExp($sCol, $aData[$sCol]);
}
$this->checkSelectedInput($sCol, $aData[$sCol]);
if (!(LOVD_plus && lovd_getProjectFile() == '/import.php')) {
// We disable this check in LOVD+, to speed up the import.
$this->checkSelectedInput($sCol, $aData[$sCol]);
}
}
}
......
......@@ -4,7 +4,7 @@
* LEIDEN OPEN VARIATION DATABASE (LOVD)
*
* Created : 2011-08-15
* Modified : 2019-08-06
* Modified : 2019-08-28
* For LOVD : 3.0-22
*
* Copyright : 2004-2019 Leiden University Medical Center; http://www.LUMC.nl/
......@@ -87,6 +87,16 @@ class LOVD_CustomViewList extends LOVD_Object {
'SELECT c.id, sc.width, c.head_column, c.description_legend_short, c.description_legend_full, c.mysql_type, c.form_type, c.select_options, sc.col_order, CONCAT(sc.geneid, ":", sc.public_view) AS public_view FROM ' . TABLE_COLS . ' AS c INNER JOIN ' . TABLE_SHARED_COLS . ' AS sc ON (c.id = sc.colid) WHERE sc.geneid = ? ' .
($_AUTH['level'] >= LEVEL_COLLABORATOR? '' : 'AND sc.public_view = 1 ')) .
'ORDER BY col_order';
if (LOVD_plus) {
// In LOVD_plus, the shared cols table is empty and the public_view field is used to set if a custom column will be displayed in a VL or not.
// So, in LOVD_plus we need to check for ALL USERS if a custom column has public_view flag turned on or not.
$sSQL = 'SELECT c.id, c.width, c.head_column, c.description_legend_short, c.description_legend_full, c.mysql_type, c.form_type, c.select_options, c.col_order, c.public_view FROM ' . TABLE_ACTIVE_COLS . ' AS ac INNER JOIN ' . TABLE_COLS . ' AS c ON (c.id = ac.colid) ' .
'WHERE c.public_view = 1 AND (c.id LIKE ?' . str_repeat(' OR c.id LIKE ?', count($aObjects)-1) . ') ' .
'GROUP BY c.id ' .
'ORDER BY col_order';
// And then we don't need this.
$sGene = '';
}
$aSQL = array();
foreach ($aObjects as $sObject) {
$aSQL[] = $sObject . '/%';
......@@ -138,7 +148,7 @@ class LOVD_CustomViewList extends LOVD_Object {
switch ($sObject) {
case 'Gene':
if (!$bSetRowID) {
$aSQL['SELECT'] .= (!$aSQL['SELECT'] ? '' : ', ') . 'g.id AS row_id';
$aSQL['SELECT'] .= (!$aSQL['SELECT']? '' : ', ') . 'g.id AS row_id';
$bSetRowID = true;
}
if (!$aSQL['FROM']) {
......@@ -149,7 +159,7 @@ class LOVD_CustomViewList extends LOVD_Object {
break;
case 'Transcript':
$aSQL['SELECT'] .= (!$aSQL['SELECT'] ? '' : ', ') . 't.id AS tid, ' .
$aSQL['SELECT'] .= (!$aSQL['SELECT']? '' : ', ') . 't.id AS tid, ' .
't.geneid, t.name, t.id_ncbi, t.id_protein_ncbi';
if (!$bSetRowID) {
$aSQL['SELECT'] .= ', t.id AS row_id';
......@@ -195,12 +205,13 @@ class LOVD_CustomViewList extends LOVD_Object {
break;
case 'VariantOnGenome':
$bLoadVOGEffect = (LOVD_plus || !$nKey); // LOVD+ always needs the VOG effect. For LOVD, show vog_effect when it's the first table in the list of objects.
$nKeyVOTUnique = array_search('VariantOnTranscriptUnique', $aObjects);
if ($nKeyVOTUnique === false) {
// Not viewing the unique variants view.
$aSQL['SELECT'] .= (!$aSQL['SELECT']? '' : ', ') .
'vog.id AS vogid, vog.chromosome, a.name AS allele_' .
($nKey? '' : ', eg.name AS vog_effect') . // Show vog_effect when it's the first table in the list of objects.
(!$bLoadVOGEffect? '' : ', eg.name AS vog_effect') .
(in_array('Individual', $aObjects)? '' : ', uo.name AS owned_by_, CONCAT_WS(";", uo.id, uo.name, uo.email, uo.institute, uo.department, IFNULL(uo.countryid, "")) AS _owner') .
', dsg.id AS var_statusid, dsg.name AS var_status';
}
......@@ -243,8 +254,7 @@ class LOVD_CustomViewList extends LOVD_Object {
$aSQL['SELECT'] .= ', ' . $sCustomCols;
}
$aSQL['FROM'] .= ' LEFT OUTER JOIN ' . TABLE_ALLELES . ' AS a ON (vog.allele = a.id)';
if (!$nKey) {
// Show vog_effect only when it's the first table in the list of objects.
if ($bLoadVOGEffect) {
$aSQL['FROM'] .= ' LEFT OUTER JOIN ' . TABLE_EFFECT . ' AS eg ON (vog.effectid = eg.id)';
}
if (!in_array('Individual', $aObjects)) {
......@@ -262,10 +272,12 @@ class LOVD_CustomViewList extends LOVD_Object {
break;
case 'VariantOnTranscript':
$bLoadVOTEffect = (!LOVD_plus); // LOVD+ never uses this.
$nKeyVOG = array_search('VariantOnGenome', $aObjects);
$nKeyT = array_search('Transcript', $aObjects);
if ($nKeyVOG === false || $nKeyVOG > $nKey) {
$aSQL['SELECT'] .= (!$aSQL['SELECT']? '' : ', ') . 'vot.id AS votid, vot.transcriptid, vot.position_c_start, vot.position_c_start_intron, vot.position_c_end, vot.position_c_end_intron, et.name as vot_effect';
$aSQL['SELECT'] .= (!$aSQL['SELECT']? '' : ', ') . 'vot.id AS votid, vot.transcriptid, vot.position_c_start, vot.position_c_start_intron, vot.position_c_end, vot.position_c_end_intron' .
(!$bLoadVOTEffect? '' : ', et.name as vot_effect');
}
if (!$bSetRowID) {
$aSQL['SELECT'] .= ', vot.id AS row_id';
......@@ -313,7 +325,9 @@ class LOVD_CustomViewList extends LOVD_Object {
if (($sCustomCols = $this->getCustomColQuery($sObject, $aSQL['SELECT'])) != '') {
$aSQL['SELECT'] .= ', ' . $sCustomCols;
}
$aSQL['FROM'] .= ' LEFT OUTER JOIN ' . TABLE_EFFECT . ' AS et ON (vot.effectid = et.id)';
if ($bLoadVOTEffect) {
$aSQL['FROM'] .= ' LEFT OUTER JOIN ' . TABLE_EFFECT . ' AS et ON (vot.effectid = et.id)';
}
break;
case 'VariantOnTranscriptUnique':
......@@ -355,7 +369,7 @@ class LOVD_CustomViewList extends LOVD_Object {
case 'Screening':
if (!$bSetRowID) {
$aSQL['SELECT'] .= (!$aSQL['SELECT'] ? '' : ', ') . 's.id AS row_id';
$aSQL['SELECT'] .= (!$aSQL['SELECT']? '' : ', ') . 's.id AS row_id';
$bSetRowID = true;
}
if (!$aSQL['FROM']) {
......@@ -396,7 +410,7 @@ class LOVD_CustomViewList extends LOVD_Object {
case 'Scr2Var':
if (!$bSetRowID) {
$aSQL['SELECT'] .= (!$aSQL['SELECT'] ? '' : ', ') . 's2v.id AS row_id';
$aSQL['SELECT'] .= (!$aSQL['SELECT']? '' : ', ') . 's2v.id AS row_id';
$bSetRowID = true;
}
if ($aSQL['FROM']) {
......@@ -574,8 +588,7 @@ class LOVD_CustomViewList extends LOVD_Object {
str_replace('the protein', 'a protein', $aLegendVarEffect[0]),
str_replace('the protein', 'a protein', $aLegendVarEffect[1]))),
));
if ($nKey) {
// Show vog_effect only when it's the first table in the list of objects.
if (empty($bLoadVOGEffect)) {
unset($this->aColumnsViewList['vog_effect']);
}
if (!$this->sSortDefault) {
......@@ -621,8 +634,8 @@ class LOVD_CustomViewList extends LOVD_Object {
if (array_search('Scr2Var', $aObjects) === false) {
unset($this->aColumnsViewList['genes']);
}
if ($aObjects[0] == 'VariantOnGenome') {
// Show vog_effect instead of vot_effect when VOG is the first table in the list of objects.
if (!empty($bLoadVOGEffect) || empty($bLoadVOTEffect)) {
// Show vog_effect instead of vot_effect when requested.
unset($this->aColumnsViewList['vot_effect']);
}
if (!$this->sSortDefault) {
......@@ -841,9 +854,11 @@ class LOVD_CustomViewList extends LOVD_Object {
}
foreach ($this->aColumns as $sCol => $aCol) {
if ($_AUTH['level'] < LEVEL_MANAGER && !$this->nID && substr($sCol, 0, 19) == 'VariantOnTranscript') {
if (!LOVD_plus && $_AUTH['level'] < LEVEL_MANAGER && !$this->nID && substr($sCol, 0, 19) == 'VariantOnTranscript') {
// Not a special authorized person, no gene selected, VOT column.
// Empty the field if the column is not actually active for the gene(s) of this entry.
// A column that has been disabled for this gene, may still show its value to collaborators and higher.
// For LOVD+, shared columns are no longer shared, and public_view is not an array, so this code won't work.
if ((!$_AUTH || !in_array($zData['geneid'], $_AUTH['allowed_to_view'])) && ((is_array($zData['geneid']) && count(array_diff($zData['geneid'], $aCol['public_view']))) || (!is_array($zData['geneid']) && !in_array($zData['geneid'], $aCol['public_view'])))) {
$zData[$sCol] = '';
}
......
......@@ -4,7 +4,7 @@
* LEIDEN OPEN VARIATION DATABASE (LOVD)
*
* Created : 2010-12-20
* Modified : 2019-02-08
* Modified : 2019-08-28
* For LOVD : 3.0-22
*
* Copyright : 2004-2019 Leiden University Medical Center; http://www.LUMC.nl/
......@@ -43,7 +43,7 @@ require_once ROOT_PATH . 'class/object_custom.php';
class LOVD_GenomeVariant extends LOVD_Custom {
// This class extends the basic Object class and it handles the Link object.
// This class extends the basic Object class and it handles the GenomeVariant object.
var $sObject = 'Genome_Variant';
var $sCategory = 'VariantOnGenome';
var $sTable = 'TABLE_VARIANTS';
......@@ -216,7 +216,7 @@ class LOVD_GenomeVariant extends LOVD_Custom {
function buildForm ($sPrefix = '')
{
$aForm = parent::buildForm($sPrefix);
// Link to HVS for nomenclature.
// Link to HGVS for nomenclature.
if (isset($aForm[$sPrefix . 'VariantOnGenome/DNA'])) {
$aForm[$sPrefix . 'VariantOnGenome/DNA'][0] = str_replace('(HGVS format)', '(<A href="http://varnomen.hgvs.org/recommendations/DNA" target="_blank">HGVS format</A>)', $aForm[$sPrefix . 'VariantOnGenome/DNA'][0]);
}
......@@ -289,14 +289,13 @@ class LOVD_GenomeVariant extends LOVD_Custom {
function getForm ()
{
// Build the form.
global $_AUTH, $_CONF, $_DB, $_SETT, $zData, $_DATA;
// If we've built the form before, simply return it. Especially imports will repeatedly call checkFields(), which calls getForm().
if (!empty($this->aFormData)) {
return parent::getForm();
}
global $_AUTH, $_CONF, $_DB, $_SETT, $zData, $_DATA;
$aSelectAllele = $_DB->query('SELECT id, name FROM ' . TABLE_ALLELES . ' ORDER BY display_order')->fetchAllCombine();
if (!empty($_GET['geneid'])) {
......@@ -496,9 +495,12 @@ class LOVD_GenomeVariant extends LOVD_Custom {
$aArgs[] = STATUS_MARKED;
}
$n = $_DB->query($sQ, $aArgs)->fetchColumn();
if ($n > 1) {
if ($n > 1 && (!LOVD_plus || !lovd_verifyInstance('mgha', false))) {
list($sPrefix,) = explode('_', $zData['VariantOnGenome/DBID'], 2);
$sLink = '<A href="' . (substr($sPrefix, 0, 3) == 'chr'? 'variants' : 'view/' . $sPrefix) . '?search_VariantOnGenome%2FDBID=%3D%22' . $zData['VariantOnGenome/DBID'] . '%22">See all ' . $n . ' reported entries</A>';
if (LOVD_plus) {
$sLink = '<A href="variants/DBID/' . $zData['VariantOnGenome/DBID'] .'">See all ' . $n . ' reported entries</A>';
}
// This is against our coding policy of never modifying actual contents of values (we always create a copy with _ appended), but now I simply can't without
// modifying the column list manually. If only array_splice() would work on associative arrays... I'm not going to create a workaround here.
$zData['VariantOnGenome/DBID'] .= ' <SPAN style="float:right">' . $sLink . '</SPAN>';
......
......@@ -4,7 +4,7 @@
* LEIDEN OPEN VARIATION DATABASE (LOVD)
*
* Created : 2011-02-16
* Modified : 2019-02-08
* Modified : 2019-08-28
* For LOVD : 3.0-22
*
* Copyright : 2004-2019 Leiden University Medical Center; http://www.LUMC.nl/
......@@ -97,9 +97,11 @@ class LOVD_Individual extends LOVD_Custom {
'GROUP_CONCAT(DISTINCT d.id) AS diseaseids, ' .
// FIXME; Can we get this order correct, such that diseases without abbreviation nicely mix with those with? Right now, the diseases without symbols are in the back.
'GROUP_CONCAT(DISTINCT IF(CASE d.symbol WHEN "-" THEN "" ELSE d.symbol END = "", d.name, d.symbol) ORDER BY (d.symbol != "" AND d.symbol != "-") DESC, d.symbol, d.name SEPARATOR ", ") AS diseases_, ' .
'GROUP_CONCAT(DISTINCT s2g.geneid ORDER BY s2g.geneid SEPARATOR ", ") AS genes_screened_, ' .
'GROUP_CONCAT(DISTINCT t.geneid ORDER BY t.geneid SEPARATOR ", ") AS variants_in_genes_, ' .
'COUNT(DISTINCT ' . ($_AUTH['level'] >= LEVEL_COLLABORATOR? 's2v.variantid' : 'vog.id') . ') AS variants_, ' . // Counting s2v.variantid will not include the limit opposed to vog in the join's ON() clause.
(LOVD_plus? '' :
'GROUP_CONCAT(DISTINCT s2g.geneid ORDER BY s2g.geneid SEPARATOR ", ") AS genes_screened_, ' .
'GROUP_CONCAT(DISTINCT t.geneid ORDER BY t.geneid SEPARATOR ", ") AS variants_in_genes_, ' .
'COUNT(DISTINCT ' . ($_AUTH['level'] >= LEVEL_COLLABORATOR? 's2v.variantid' : 'vog.id') . ') AS variants_, ' // Counting s2v.variantid will not include the limit opposed to vog in the join's ON() clause.
) .
'uo.name AS owned_by_, ' .
'CONCAT_WS(";", uo.id, uo.name, uo.email, uo.institute, uo.department, IFNULL(uo.countryid, "")) AS _owner, ' .
'ds.name AS status';
......@@ -112,12 +114,14 @@ class LOVD_Individual extends LOVD_Custom {
'LEFT OUTER JOIN ' . TABLE_IND2DIS . ' AS i2d ON (i.id = i2d.individualid) ' .
'LEFT OUTER JOIN ' . TABLE_DISEASES . ' AS d ON (i2d.diseaseid = d.id) ' .
'LEFT OUTER JOIN ' . TABLE_SCREENINGS . ' AS s ON (i.id = s.individualid) ' .
'LEFT OUTER JOIN ' . TABLE_SCR2VAR . ' AS s2v ON (s2v.screeningid = s.id) ' .
($_AUTH['level'] >= LEVEL_COLLABORATOR? '' :
'LEFT OUTER JOIN ' . TABLE_VARIANTS . ' AS vog ON (s2v.variantid = vog.id AND (vog.statusid >= ' . STATUS_MARKED . (!$_AUTH? '' : ' OR vog.created_by = "' . $_AUTH['id'] . '" OR vog.owned_by IN (' . $sOwnerIDsSQL . ')') . ')) ') .
'LEFT OUTER JOIN ' . TABLE_SCR2GENE . ' AS s2g ON (s.id = s2g.screeningid) ' .
'LEFT OUTER JOIN ' . TABLE_VARIANTS_ON_TRANSCRIPTS . ' AS vot ON (' . ($_AUTH['level'] >= LEVEL_COLLABORATOR? 's2v.variantid' : 'vog.id') . ' = vot.id) ' .
'LEFT OUTER JOIN ' . TABLE_TRANSCRIPTS . ' AS t ON (t.id = vot.transcriptid) ' .
(LOVD_plus? '' :
'LEFT OUTER JOIN ' . TABLE_SCR2VAR . ' AS s2v ON (s2v.screeningid = s.id) ' .
($_AUTH['level'] >= LEVEL_COLLABORATOR? '' :
'LEFT OUTER JOIN ' . TABLE_VARIANTS . ' AS vog ON (s2v.variantid = vog.id AND (vog.statusid >= ' . STATUS_MARKED . (!$_AUTH? '' : ' OR vog.created_by = "' . $_AUTH['id'] . '" OR vog.owned_by IN (' . $sOwnerIDsSQL . ')') . ')) ') .
'LEFT OUTER JOIN ' . TABLE_SCR2GENE . ' AS s2g ON (s.id = s2g.screeningid) ' .
'LEFT OUTER JOIN ' . TABLE_VARIANTS_ON_TRANSCRIPTS . ' AS vot ON (' . ($_AUTH['level'] >= LEVEL_COLLABORATOR? 's2v.variantid' : 'vog.id') . ' = vot.id) ' .
'LEFT OUTER JOIN ' . TABLE_TRANSCRIPTS . ' AS t ON (t.id = vot.transcriptid) '
) .
'LEFT OUTER JOIN ' . TABLE_USERS . ' AS uo ON (i.owned_by = uo.id) ' .
'LEFT OUTER JOIN ' . TABLE_DATA_STATUS . ' AS ds ON (i.statusid = ds.id)';
// Conditional inclusion of a JOIN that is only needed to search. This prevents long delays when using HAVING on
......@@ -174,6 +178,8 @@ class LOVD_Individual extends LOVD_Custom {
'diseases_' => array(
'view' => array('Disease', 175),
'db' => array('diseases_', 'ASC', true)),
),
(LOVD_plus? array() : array(
'phenotypes_' => array(
'view' => false), // Placeholder for Phenotype/Additional.
'genes_searched' => array(
......@@ -189,6 +195,8 @@ class LOVD_Individual extends LOVD_Custom {
'variants_' => array(
'view' => array('Variants', 75, 'style="text-align : right;"'),
'db' => array('variants_', 'DESC', 'INT_UNSIGNED')),
)),
array(
'panel_size' => array(
'view' => array('Panel size', 70, 'style="text-align : right;"'),
'db' => array('i.panel_size', 'DESC', true),
......
......@@ -4,12 +4,12 @@
* LEIDEN OPEN VARIATION DATABASE (LOVD)
*
* Created : 2010-01-28
* Modified : 2016-10-14
* For LOVD : 3.0-18
* Modified : 2019-08-28
* For LOVD : 3.0-22
*
* Copyright : 2004-2016 Leiden University Medical Center; http://www.LUMC.nl/
* Programmers : Ing. Ivo F.A.C. Fokkema <I.F.A.C.Fokkema@LUMC.nl>
* Ing. Ivar C. Lugtenburg <I.C.Lugtenburg@LUMC.nl>
* Copyright : 2004-2019 Leiden University Medical Center; http://www.LUMC.nl/
* Programmers : Ivo F.A.C. Fokkema <I.F.A.C.Fokkema@LUMC.nl>
* Ivar C. Lugtenburg <I.C.Lugtenburg@LUMC.nl>
* M. Kroon <m.kroon@lumc.nl>
*
*
......@@ -115,6 +115,7 @@ class LOVD_Log extends LOVD_Object {
case 'AnalysisClose':
case 'AnalysisOpen':
case 'AnalysisRun':
case 'AnalysisRunClone':
case 'AnalysisRunModify':
case 'AnalysisRunDelete':
$zData['entry'] = preg_replace('/(individual) ([0-9]+):([0-9]+)( |$)/', '$1 <A href="individuals/$2/analyze/$3">$2</A> (analysis $3)$4', $zData['entry']);
......
......@@ -4,10 +4,10 @@
* LEIDEN OPEN VARIATION DATABASE (LOVD)
*
* Created : 2011-02-16
* Modified : 2017-11-30
* For LOVD : 3.0-21
* Modified : 2019-08-28
* For LOVD : 3.0-22
*
* Copyright : 2004-2017 Leiden University Medical Center; http://www.LUMC.nl/
* Copyright : 2004-2019 Leiden University Medical Center; http://www.LUMC.nl/
* Programmers : Ivar C. Lugtenburg <I.C.Lugtenburg@LUMC.nl>
* Ivo F.A.C. Fokkema <I.F.A.C.Fokkema@LUMC.nl>
* Daan Asscheman <D.Asscheman@LUMC.nl>
......@@ -45,7 +45,7 @@ require_once ROOT_PATH . 'class/object_custom.php';
class LOVD_Phenotype extends LOVD_Custom {
// This class extends the basic Object class and it handles the Link object.
var $sObject = 'Phenotype';
var $bShared = true;
var $bShared = (LOVD_plus? false : true);
......
......@@ -4,10 +4,10 @@
* LEIDEN OPEN VARIATION DATABASE (LOVD)
*
* Created : 2011-05-12
* Modified : 2018-01-16
* For LOVD : 3.0-21
* Modified : 2019-08-28
* 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/
* Programmers : Ivar C. Lugtenburg <I.C.Lugtenburg@LUMC.nl>
* Ivo F.A.C. Fokkema <I.F.A.C.Fokkema@LUMC.nl>
* Daan Asscheman <D.Asscheman@LUMC.nl>
......@@ -61,6 +61,8 @@ class LOVD_TranscriptVariant extends LOVD_Custom {
// Default constructor.
global $_DB;
$this->bShared = (LOVD_plus? false : true);
// SQL code for loading an entry for an edit form.
$this->sSQLLoadEntry = 'SELECT vot.* ' .
'FROM ' . TABLE_VARIANTS_ON_TRANSCRIPTS . ' AS vot ' .
......@@ -70,7 +72,7 @@ class LOVD_TranscriptVariant extends LOVD_Custom {
// SQL code for viewing an entry.
$this->aSQLViewEntry['SELECT'] = 'vot.*, ' .
't.geneid, t.id_ncbi';
't.geneid, t.id_ncbi, vog.chromosome'; // MGHA needs chromosome to get the Genomizer link to work.
$this->aSQLViewEntry['FROM'] = TABLE_VARIANTS_ON_TRANSCRIPTS . ' AS vot ' .
'INNER JOIN ' . TABLE_VARIANTS . ' AS vog ON (vot.id = vog.id) ' . // Only done so that the vog.statusid can be checked.
'LEFT OUTER JOIN ' . TABLE_TRANSCRIPTS . ' AS t ON (vot.transcriptid = t.id)';
......@@ -82,11 +84,19 @@ class LOVD_TranscriptVariant extends LOVD_Custom {
't.geneid, t.id_ncbi, ' .
'e.name AS effect, ' .
'ds.name AS status';
// LOVD+ adds the check if this transcript is a preferred transcript.
if (LOVD_plus) {
$this->aSQLViewList['SELECT'] .= ', gp2g.genepanelid';
}
$this->aSQLViewList['FROM'] = TABLE_VARIANTS_ON_TRANSCRIPTS . ' AS vot ' .
'INNER JOIN ' . TABLE_VARIANTS . ' AS vog ON (vot.id = vog.id) ' .
'LEFT OUTER JOIN ' . TABLE_EFFECT . ' AS e ON (vot.effectid = e.id) ' .
'LEFT OUTER JOIN ' . TABLE_DATA_STATUS . ' AS ds ON (vog.statusid = ds.id) ' .
'LEFT OUTER JOIN ' . TABLE_TRANSCRIPTS . ' AS t ON (t.id = vot.transcriptid)';
// LOVD+ adds the check if this transcript is a preferred transcript in any gene panel.
if (LOVD_plus) {
$this->aSQLViewList['FROM'] .= ' LEFT OUTER JOIN ' . TABLE_GP2GENE . ' AS gp2g ON (vot.transcriptid = gp2g.transcriptid)';
}
$this->sObjectID = $sObjectID;
$this->nID = $nID;
......@@ -100,10 +110,19 @@ class LOVD_TranscriptVariant extends LOVD_Custom {
'effect_reported' => 'Affects function (as reported)',
'effect_concluded' => 'Affects function (by curator)',
),
(!LOVD_plus || !lovd_verifyInstance('mgha', false)? array() :
// MGHA entry for the Genomizer link in the VOT ViewEntry.
array(
'genomizer_url_' => 'Genomizer',
'clinvar_' => "ClinVar Description (dbNSFP)"
)),
$this->buildViewEntry());
if (LOVD_plus) {
unset($this->aColumnsViewEntry['effect_reported']);
unset($this->aColumnsViewEntry['effect_concluded']);
if (lovd_verifyInstance('mgha', false) && !isset($this->aColumnsViewEntry['VariantOnTranscript/dbNSFP/ClinVar/Clinical_Significance'])) {
unset($this->aColumnsViewEntry['clinvar_']);
}
}
// List of columns and (default?) order for viewing a list of entries.
......@@ -219,7 +238,9 @@ class LOVD_TranscriptVariant extends LOVD_Custom {
if ($aCol['mandatory']) {
$this->aCheckMandatory[] = $sCol;
}
if (isset($aData[$sCol])) {
if (!(LOVD_plus && lovd_getProjectFile() == '/import.php') && isset($aData[$sCol])) {
// These checks are disabled in LOVD+ to speed up the import.
$this->checkInputRegExp($sCol, $aData[$sCol]);
$this->checkSelectedInput($sCol, $aData[$sCol]);
}
......@@ -387,6 +408,12 @@ class LOVD_TranscriptVariant extends LOVD_Custom {
$zData['id_ncbi_'] = '<A href="transcripts/' . $zData['transcriptid'] . '">' . $zData['id_ncbi'] . '</A>';
$zData['effect_reported'] = $_SETT['var_effect'][$zData['effectid']{0}];
$zData['effect_concluded'] = $_SETT['var_effect'][$zData['effectid']{1}];
if (LOVD_plus && lovd_verifyInstance('mgha', false)) { // Display the Genomizer URL in the VOT ViewEntry. TODO Once the ref and alt are separated we need to add it into this URL. Should we add this to the links table so as it can be used elsewhere?
$zData['genomizer_url_'] = '<A href="http://genomizer.com/?chr=' . $zData['chromosome'] . '&gene=' . $zData['geneid'] . '&ref_seq=' . $zData['id_ncbi'] . '&variant=' . $zData['VariantOnTranscript/DNA'] . '" target="_blank">Genomizer Link</A>';
if (isset($zData['VariantOnTranscript/dbNSFP/ClinVar/Clinical_Significance'])) {
$zData['clinvar_'] = implode(', ', lovd_mapCodeToDescription(explode(',', $zData['VariantOnTranscript/dbNSFP/ClinVar/Clinical_Significance']), $_SETT['clinvar_var_effect']));
}
}
}
return $zData;
......
......@@ -4,10 +4,10 @@
* LEIDEN OPEN VARIATION DATABASE (LOVD)
*
* Created : 2010-12-20
* Modified : 2018-01-24
* For LOVD : 3.0-21
* Modified : 2019-08-28
* 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/
* Programmers : Ivar C. Lugtenburg <I.C.Lugtenburg@LUMC.nl>
* Ivo F.A.C. Fokkema <I.F.A.C.Fokkema@LUMC.nl>
* Daan Asscheman <D.Asscheman@LUMC.nl>
......@@ -77,21 +77,27 @@ class LOVD_Transcript extends LOVD_Object {
// SQL code for viewing the list of transcripts
$this->aSQLViewList['SELECT'] = 't.*, ' .
'g.chromosome, ' .
'COUNT(DISTINCT ' . ($_AUTH['level'] >= LEVEL_COLLABORATOR? 'vot.id' : 'vog.id') . ') AS variants';
'g.chromosome';
if (!LOVD_plus) {
// Speed optimization by skipping variant counts.
$this->aSQLViewList['SELECT'] .= ', ' .
'COUNT(DISTINCT ' . ($_AUTH['level'] >= LEVEL_COLLABORATOR? 'vot.id' : 'vog.id') . ') AS variants';
}
$this->aSQLViewList['FROM'] = TABLE_TRANSCRIPTS . ' AS t ' .
'LEFT OUTER JOIN ' . TABLE_GENES . ' AS g ON (t.geneid = g.id) ' .
'LEFT OUTER JOIN ' . TABLE_VARIANTS_ON_TRANSCRIPTS . ' AS vot ON (t.id = vot.transcriptid)' .
// If user is less than a collaborator, only show public variants and
// variants owned/created by him.
($_AUTH['level'] >= LEVEL_COLLABORATOR? '' :
'LEFT OUTER JOIN ' . TABLE_VARIANTS . ' AS vog ON ' .
'(vot.id = vog.id AND (vog.statusid >= ' . STATUS_MARKED .
(!$_AUTH? '' :
' OR vog.created_by = "' . $_AUTH['id'] . '" OR ' .
'vog.owned_by = "' . $_AUTH['id'] . '"'
) . ')) '
);
(LOVD_plus? '' :
// Speed optimization by skipping variant counts.
'LEFT OUTER JOIN ' . TABLE_VARIANTS_ON_TRANSCRIPTS . ' AS vot ON (t.id = vot.transcriptid) ' .
// If user is less than a collaborator, only show public variants and
// variants owned/created by him.
($_AUTH['level'] >= LEVEL_COLLABORATOR? '' :
'LEFT OUTER JOIN ' . TABLE_VARIANTS . ' AS vog ON ' .
'(vot.id = vog.id AND (vog.statusid >= ' . STATUS_MARKED .
(!$_AUTH? '' :
' OR vog.created_by = "' . $_AUTH['id'] . '" OR ' .
'vog.owned_by = "' . $_AUTH['id'] . '"'
) . ')) '
));
$this->aSQLViewList['GROUP_BY'] = 't.id';
// List of columns and (default?) order for viewing an entry.
......@@ -138,6 +144,11 @@ class LOVD_Transcript extends LOVD_Object {
'view' => array('Variants', 70, 'style="text-align : right;"'),
'db' => array('variants', 'DESC', 'INT_UNSIGNED')),
);
if (LOVD_plus) {
// Diagnostics: Speed up view by removing the variants column.
unset($this->aColumnsViewList['variants']);
}
$this->sSortDefault = 'geneid';
// Because the disease information is publicly available, remove some columns for the public.
......
......@@ -4,7 +4,7 @@
* LEIDEN OPEN VARIATION DATABASE (LOVD)
*
* Created : 2012-03-27
* Modified : 2019-08-27
* Modified : 2019-08-28
* For LOVD : 3.0-22
*
* Copyright : 2004-2019 Leiden University Medical Center; http://www.LUMC.nl/
......@@ -243,9 +243,14 @@ class LOVD_Template {
unset($this->aMenu['configuration'], $this->aMenu['configuration_']);
unset($this->aMenu['setup_']['/download/columns']);
unset($this->aMenu['setup_']['/download/all']);
if ($_AUTH && $_AUTH['level'] <= LEVEL_ANALYZER) {
if (!$_AUTH || $_AUTH['level'] <= LEVEL_ANALYZER) {
unset($this->aMenu['diseases'], $this->aMenu['diseases_']);
}
// Gene statistics is really just for MGHA.
if (!lovd_verifyInstance('mgha', false)) {
unset($this->aMenu['genes_']['/gene_statistics']);
}
} else {
// Remove menu items for non-LOVD+.
unset($this->aMenu['gene_panels']);
......@@ -348,7 +353,7 @@ class LOVD_Template {
}
print(' Powered by <A href="' . $_SETT['upstream_URL'] . $_STAT['tree'] . '/" target="_blank">LOVD v.' . $_STAT['tree'] . '</A> Build ' . $_STAT['build'] . '<BR>' . "\n" .
' LOVD software &copy;2004-2019 <A href="http://www.lumc.nl/" target="_blank">Leiden University Medical Center</A>' . "\n");
' LOVD' . (LOVD_plus? '+' : '') . ' software &copy;2004-2019 <A href="http://www.lumc.nl/" target="_blank">Leiden University Medical Center</A>' . "\n");
?>
</TD>
<TD width="42" align="right">
......@@ -392,7 +397,7 @@ class LOVD_Template {
<SCRIPT type="text/javascript">
<!--
<?php
if (!((ROOT_PATH == '../' && !(defined('TAB_SELECTED') && TAB_SELECTED == 'docs')) || defined('NOT_INSTALLED'))) {
if (!LOVD_plus && !((ROOT_PATH == '../' && !(defined('TAB_SELECTED') && TAB_SELECTED == 'docs')) || defined('NOT_INSTALLED'))) {
// In install directory.
print('
function lovd_mapVariants ()
......@@ -635,7 +640,7 @@ foreach ($zAnnouncements as $zAnnouncement) {
<TR>
<?php
if (!is_readable(ROOT_PATH . $_CONF['logo_uri'])) {
$_CONF['logo_uri'] = 'gfx/' . (LOVD_plus? 'LOVD_plus_logo200x50' : 'LOVD3_logo145x50') . '.jpg';
$_CONF['logo_uri'] = 'gfx/LOVD' . (LOVD_plus? '_plus' : '3') . '_logo145x50.jpg';
}
$aImage = @getimagesize(ROOT_PATH . $_CONF['logo_uri']);
if (!is_array($aImage)) {
......
......@@ -4,11 +4,11 @@
* LEIDEN OPEN VARIATION DATABASE (LOVD)
*
* Created : 2012-11-27
* Modified : 2016-08-31
* For LOVD : 3.0-17
* Modified : 2019-08-28
* For LOVD : 3.0-22
*
* Copyright : 2004-2016 Leiden University Medical Center; http://www.LUMC.nl/
* Programmer : Ing. Ivo F.A.C. Fokkema <I.F.A.C.Fokkema@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>
*
*
* This file is part of LOVD.
......@@ -40,13 +40,19 @@ if (PATH_COUNT == 1 && !ACTION) {
// URL: /docs
// Provide link to PDF and HTML file.
define('PAGE_TITLE', 'LOVD 3.0 documentation');
define('PAGE_TITLE', 'LOVD' . (LOVD_plus? '+' : ' 3.0') . ' documentation');
$_T->printHeader();
$_T->printTitle();
print(' The LOVD 3.0 documentation is continuously being updated.<BR>Currently available is the LOVD 3.0 user manual, in PDF and HTML formats.<BR>' .
' <UL>' . "\n" .
' <LI>LOVD manual 3.0-21 (<A href="docs/LOVD_manual_3.0.pdf" target="_blank"><B>PDF</B>, 85 pages, 1.5Mb</A>) (<A href="docs/manual.html" target="_blank"><B>HTML</B>, single file, 4.5Mb</A>) - last updated February 27th 2018</LI></UL>' . "\n\n");
if (LOVD_plus) {
print(' The LOVD+ documentation is continuously being updated.<BR>Currently available is the LOVD+ user manual, in PDF format.<BR>' .
' <UL>' . "\n" .
' <LI>LOVD manual 3.0-17r (<A href="docs/LOVD+_manual.pdf" target="_blank"><B>PDF</B>, 21 pages, 1.2Mb</A>) - last updated March 13th, 2019</LI></UL>' . "\n\n");
} else {
print(' The LOVD 3.0 documentation is continuously being updated.<BR>Currently available is the LOVD 3.0 user manual, in PDF and HTML formats.<BR>' .
' <UL>' . "\n" .
' <LI>LOVD manual 3.0-21 (<A href="docs/LOVD_manual_3.0.pdf" target="_blank"><B>PDF</B>, 85 pages, 1.5Mb</A>) (<A href="docs/manual.html" target="_blank"><B>HTML</B>, single file, 4.5Mb</A>) - last updated February 27th 2018</LI></UL>' . "\n\n");
}
$_T->printFooter();
exit;
......
......@@ -4,12 +4,12 @@
* LEIDEN OPEN VARIATION DATABASE (LOVD)
*
* Created : 2009-10-23
* Modified : 2011-10-12
* For LOVD : 3.0-alpha-05
* Modified : 2019-08-28
* For LOVD : 3.0-22
*
* Copyright : 2004-2011 Leiden University Medical Center; http://www.LUMC.nl/
* Programmers : Ing. Ivo F.A.C. Fokkema <I.F.A.C.Fokkema@LUMC.nl>
* Ing. Ivar C. Lugtenburg <I.C.Lugtenburg@LUMC.nl>
* Copyright : 2004-2019 Leiden University Medical Center; http://www.LUMC.nl/
* Programmers : Ivo F.A.C. Fokkema <I.F.A.C.Fokkema@LUMC.nl>
* Ivar C. Lugtenburg <I.C.Lugtenburg@LUMC.nl>
*
*
* This file is part of LOVD.
......@@ -61,8 +61,8 @@ function lovd_checkForm () {
// ... but is now changed!