Commit 4537ce05 authored by Ivo Fokkema's avatar Ivo Fokkema Committed by GitHub

Merge pull request #397 from LOVDnl/feat/LOVD+

Include some features and code from LOVD+ to reduce the code diff between the two projects.
parents 4a3d3cbb 27217409
.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
......
......@@ -5,6 +5,7 @@ php:
# aliased to a recent 5.5.x version
- 5.5
# aliased to a recent 5.6.xversion
# This one is usually failing due to unexpected halting of the process (and Travis then killing the build).
- 5.6
# aliased to a recent 7.x version
- 7.0
......
......@@ -9,6 +9,10 @@
php_flag register_globals Off
php_flag magic_quotes_gpc Off
php_flag mysql.trace_mode Off
# Allow to select many genes for the gene panel. 15000 allows for some 3000 genes to be processed.
php_value max_input_vars 15000
php_value suhosin.post.max_vars 15000
php_value suhosin.request.max_vars 15000
# We rely on MultiViews or the RewriteEngine. We can't check on MultiViews here,
# nor can we cleanly try to enable it here without the need for AllowOverride All.
......@@ -22,6 +26,7 @@ php_flag mysql.trace_mode Off
RewriteRule ^analyses(.*)$ analyses.php
RewriteRule ^announcements(.*)$ announcements.php
RewriteRule ^api(.*)$ api.php
RewriteRule ^attachments(.*)$ attachments.php
RewriteRule ^check_update(.*)$ check_update.php
RewriteRule ^columns(.*)$ columns.php
RewriteRule ^configuration(.*)$ configuration.php
......@@ -46,6 +51,7 @@ php_flag mysql.trace_mode Off
RewriteRule ^setup(.*)$ setup.php
RewriteRule ^status(.*)$ status.php
RewriteRule ^submit(.*)$ submit.php
RewriteRule ^summary_annotations(.*)$ summary_annotations.php
RewriteRule ^transcripts(.*)$ transcripts.php
RewriteRule ^uninstall(.*)$ uninstall.php
RewriteRule ^users(.*)$ users.php
......
......@@ -36,7 +36,6 @@
4.0.0 class_exists
4.0.4 constant
4.0.0 count
4.0.1 create_function
4.0.4 ctype_digit
4.0.0 current
4.0.0 date
......
......@@ -8,8 +8,8 @@
* For LOVD : 3.0-16
*
* 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>
* Msc. Daan Asscheman <D.Asscheman@LUMC.nl>
* Programmers : Ivo F.A.C. Fokkema <I.F.A.C.Fokkema@LUMC.nl>
* Daan Asscheman <D.Asscheman@LUMC.nl>
* M. Kroon <m.kroon@lumc.nl>
*
*
......
......@@ -8,7 +8,7 @@
* For LOVD : 3.0-21
*
* Copyright : 2004-2018 Leiden University Medical Center; http://www.LUMC.nl/
* Programmer : Ivo F.A.C. Fokkema <I.F.A.C.Fokkema@LUMC.nl>
* Programmers : Ivo F.A.C. Fokkema <I.F.A.C.Fokkema@LUMC.nl>
* Daan Asscheman <D.Asscheman@LUMC.nl>
*
*
......
......@@ -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,14 +4,15 @@
* LEIDEN OPEN VARIATION DATABASE (LOVD)
*
* Created : 2010-07-28
* Modified : 2017-10-26
* For LOVD : 3.0-21
* Modified : 2019-09-05
* 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 : Ivo F.A.C. Fokkema <I.F.A.C.Fokkema@LUMC.nl>
* Ivar C. Lugtenburg <I.C.Lugtenburg@LUMC.nl>
* Daan Asscheman <D.Asscheman@LUMC.nl>
* M. Kroon <m.kroon@lumc.nl>
* Juny Kesumadewi <juny.kesumadewi@unimelb.edu.au>
*
*
* This file is part of LOVD.
......@@ -137,14 +138,14 @@ class LOVD_Disease extends LOVD_Object {
function __construct ()
{
// Default constructor.
global $_AUTH;
global $_AUTH, $_SETT;
// SQL code for preparing load entry query.
// Increase DB limits to allow concatenation of large number of gene IDs.
$this->sSQLPreLoadEntry = 'SET group_concat_max_len = 200000';
// SQL code for loading an entry for an edit form.
$this->sSQLLoadEntry = 'SELECT d.*, ' .
$this->sSQLLoadEntry = 'SELECT d.*, d.inheritance as _inheritance, ' .
'd.tissues AS _tissues, ' .
'GROUP_CONCAT(g2d.geneid ORDER BY g2d.geneid SEPARATOR ";") AS _genes ' .
'FROM ' . TABLE_DISEASES . ' AS d ' .
......@@ -180,6 +181,12 @@ class LOVD_Disease extends LOVD_Object {
$this->aSQLViewList['WHERE'] = 'd.id > 0';
$this->aSQLViewList['GROUP_BY'] = 'd.id';
$sInheritanceLegend = '<TABLE>';
foreach ($_SETT['diseases_inheritance'] as $sKey => $sDescription) {
$sInheritanceLegend .= '<TR><TD>' . $sKey . '</TD><TD>: ' . $sDescription . '</TD></TR>';
}
$sInheritanceLegend .= '</TABLE>';
// List of columns and (default?) order for viewing an entry.
$this->aColumnsViewEntry =
array(
......@@ -187,6 +194,7 @@ class LOVD_Disease extends LOVD_Object {
'name' => 'Name',
'id_omim' => 'OMIM ID',
'link_HPO_' => 'Human Phenotype Ontology Project (HPO)',
'inheritance' => 'Inheritance',
'individuals' => 'Individuals reported having this disease',
'phenotypes_' => 'Phenotype entries for this disease',
'genes_' => 'Associated with',
......@@ -214,6 +222,12 @@ class LOVD_Disease extends LOVD_Object {
'id_omim' => array(
'view' => array('OMIM ID', 75, 'style="text-align : right;"'),
'db' => array('d.id_omim', 'ASC', true)),
'inheritance' => array(
'view' => array('Inheritance', 75),
'db' => array('inheritance', 'ASC', true),
'legend' => array('Abbreviations:' . strip_tags(str_replace('<TR>', "\n", preg_replace('/\s+/', ' ', $sInheritanceLegend))),
'Values based on OMIM\'s and HPO\'s values for inheritance.<BR>' . str_replace(array("\r", "\n"), '', $sInheritanceLegend),
)),
'individuals' => array(
'view' => array('Individuals', 80, 'style="text-align : right;"'),
'db' => array('individuals', 'DESC', 'INT_UNSIGNED')),
......@@ -314,14 +328,13 @@ class LOVD_Disease extends LOVD_Object {
function getForm ()
{
// Build the form.
global $_AUTH, $_DB, $_SETT;
// 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 $_DB, $_AUTH, $_SETT;
// Get list of genes, to connect disease to gene.
if ($_AUTH['level'] == LEVEL_CURATOR) {
$aGenes = $_AUTH['curates'];
......@@ -352,6 +365,7 @@ class LOVD_Disease extends LOVD_Object {
array('Disease abbreviation', '', 'text', 'symbol', 15),
array('Disease name', '', 'text', 'name', 40),
array('OMIM ID (optional)', '', 'text', 'id_omim', 10),
array('Inheritance', '', 'select', 'inheritance', count($_SETT['diseases_inheritance']), $_SETT['diseases_inheritance'], false, true, false),
array('Associated tissues (optional)', '', 'select', 'tissues', 10, $_SETT['disease_tissues'],
false, true, false),
array('Disease features (optional)', '', 'textarea', 'features', 50, 5),
......
......@@ -4,8 +4,8 @@
* LEIDEN OPEN VARIATION DATABASE (LOVD)
*
* Created : 2010-12-15
* Modified : 2019-08-07
* For LOVD : 3.0-21
* Modified : 2019-08-28
* For LOVD : 3.0-22
*
* Copyright : 2004-2019 Leiden University Medical Center; http://www.LUMC.nl/
* Programmers : Ivar C. Lugtenburg <I.C.Lugtenburg@LUMC.nl>
......@@ -53,7 +53,7 @@ class LOVD_Gene extends LOVD_Object {
function __construct ()
{
// Default constructor.
global $_AUTH;
global $_AUTH, $_DB;
// SQL code for loading an entry for an edit form.
$this->sSQLLoadEntry = 'SELECT g.*, ' .
......@@ -216,6 +216,7 @@ class LOVD_Gene extends LOVD_Object {
// Unfortunately, we can't limit this for the genes VL on the gene panel page,
// because we also want it to work on the AJAX viewlist, so we can't use lovd_getProjectFile(),
// but neither can we use the sViewListID, because we're in the constructor.
$_DB->query('SET group_concat_max_len = 10240'); // Make sure you can deal with long transcript lists.
$this->aSQLViewList['SELECT'] .= ', IFNULL(CONCAT("<OPTION value=&quot;&quot;>-- select --</OPTION>", GROUP_CONCAT(CONCAT("<OPTION value=&quot;", t.id, "&quot;>", t.id_ncbi, "</OPTION>") ORDER BY t.id_ncbi SEPARATOR "")), "<OPTION value=&quot;&quot;>-- no transcripts available --</OPTION>") AS transcripts_HTML';
}
......@@ -525,7 +526,7 @@ class LOVD_Gene extends LOVD_Object {
$zData['diseases_'] .= (!$zData['diseases_']? '' : ', ') . '<A href="diseases/' . $nID . '">' . $sSymbol . '</A>';
if ($nOMIMID) {
// Add link to OMIM for each disease that has an OMIM ID.
$zData['disease_omim_'] .= (!$zData['disease_omim_'] ? '' : '<BR>') . '<A href="' . lovd_getExternalSource('omim', $nOMIMID, true) . '" target="_blank">' . $sSymbol . ($sSymbol == $sName? '' : ' (' . $sName . ')') . '</A>';
$zData['disease_omim_'] .= (!$zData['disease_omim_']? '' : '<BR>') . '<A href="' . lovd_getExternalSource('omim', $nOMIMID, true) . '" target="_blank">' . $sSymbol . ($sSymbol == $sName? '' : ' (' . $sName . ')') . '</A>';
}
}
......
......@@ -4,7 +4,7 @@
* LEIDEN OPEN VARIATION DATABASE (LOVD)
*
* Created : 2010-12-20
* Modified : 2019-02-08
* Modified : 2019-09-05
* 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';
......@@ -74,12 +74,6 @@ class LOVD_GenomeVariant extends LOVD_Custom {
'uo.name AS owned_by_, ' .
'uc.name AS created_by_, ' .
'ue.name AS edited_by_';
if (LOVD_plus) {
// Add curation status and confirmation status.
$this->aSQLViewEntry['SELECT'] .= ', ' .
'curs.name AS curation_status_, ' .
'cons.name AS confirmation_status_';
}
$this->aSQLViewEntry['FROM'] = TABLE_VARIANTS . ' AS vog ' .
'LEFT OUTER JOIN ' . TABLE_SCR2VAR . ' AS s2v ON (vog.id = s2v.variantid) ' .
'LEFT OUTER JOIN ' . TABLE_SCREENINGS . ' AS s ON (s.id = s2v.screeningid) ' .
......@@ -88,12 +82,6 @@ class LOVD_GenomeVariant extends LOVD_Custom {
'LEFT OUTER JOIN ' . TABLE_USERS . ' AS uo ON (vog.owned_by = uo.id) ' .
'LEFT OUTER JOIN ' . TABLE_USERS . ' AS uc ON (vog.created_by = uc.id) ' .
'LEFT OUTER JOIN ' . TABLE_USERS . ' AS ue ON (vog.edited_by = ue.id)';
if (LOVD_plus) {
// Add curation status and confirmation status.
$this->aSQLViewEntry['FROM'] .= ' ' .
'LEFT OUTER JOIN ' . TABLE_CURATION_STATUS . ' AS curs ON (vog.curation_statusid = curs.id)' .
'LEFT OUTER JOIN ' . TABLE_CONFIRMATION_STATUS . ' AS cons ON (vog.confirmation_statusid = cons.id)';
}
$this->aSQLViewEntry['GROUP_BY'] = 'vog.id';
// SQL code for viewing the list of variants
......@@ -216,7 +204,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 +277,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'])) {
......@@ -378,7 +365,7 @@ class LOVD_GenomeVariant extends LOVD_Custom {
// Check if we actually have any transcripts enabled. When creating a variant, the user may disable them.
// We need to know for the variant effect fields.
$nTranscripts = 0;
if (ACTION == 'create') {
if (ACTION == 'create' && !empty($_POST['aTranscripts'])) {
foreach (array_keys($_POST['aTranscripts']) as $nTranscriptID) {
if (empty($_POST['ignore_' . $nTranscriptID])) {
$nTranscripts ++;
......@@ -496,9 +483,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-09-04
* 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>
......@@ -54,7 +54,11 @@ class LOVD_Phenotype extends LOVD_Custom {
function __construct ($sObjectID = '', $nID = '')
{
// Default constructor.
global $_AUTH;
if (LOVD_plus) {
// We don't have shared custom columns in LOVD+.
$this->bShared = false;
}