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

Improve/variant creation form #588

Open
wants to merge 99 commits into
base: release/3.5
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 82 commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
475c3ee
Add 'relative to' message to both DNA fields
loeswerkman Oct 6, 2021
998fd1b
Allow element data to be added into HTML via viewForm
loeswerkman Oct 7, 2021
eb3b9ea
Add genome build as element data into viewForm
loeswerkman Oct 7, 2021
1d121fd
Redo code to add source to variants using element data
loeswerkman Oct 7, 2021
2fc7097
Add map button to all DNA fields in variant data entry form
loeswerkman Oct 7, 2021
1d3dad7
Remove disabled method.
ifokkema Oct 8, 2021
e607423
When adding to the DNA field description, don't overwrite anything.
ifokkema Oct 8, 2021
77a3e86
Improved efficiency of variables a bit, shortening the code.
ifokkema Oct 8, 2021
68f4ff4
Clean up the code a bit, and simply selecting VOG/DNA fields in JS.
ifokkema Oct 8, 2021
a9dbc6d
Add IsHGVS function and Unit test
loeswerkman Oct 15, 2021
4e83069
Open checkHGVS dialogue in variant creation form
loeswerkman Jan 21, 2022
8949e05
Create and implement the isHGVS wrapper function
loeswerkman Jan 27, 2022
5ef4aeb
Merge branch 'release/3.5' into improve/variantCreationForm
loeswerkman Feb 10, 2022
d94faee
Add an '@' before the ob_end_flush()
loeswerkman Feb 10, 2022
2d9c9c7
Add 'supported_by_VV' to GBs in
loeswerkman Feb 10, 2022
b1ccf66
Fix spelling
loeswerkman Feb 10, 2022
e0b4d90
WIP: Redoing the mapping and validation through VV
loeswerkman Feb 10, 2022
63e05e5
Simplify and clean up code; shorten the output
loeswerkman Feb 21, 2022
fce7fb8
Document the fact that flush() does not work here
loeswerkman Feb 21, 2022
d7d5282
Replaced flush() calls with recursive calls
loeswerkman Feb 23, 2022
4f3e8e5
Allow variants which VV cannot validate into the DB
loeswerkman Feb 24, 2022
5227038
Clean up the output and accredit VariantValidator
loeswerkman Feb 24, 2022
723cd57
Remove redundant VV call for multiple transcripts
loeswerkman Feb 24, 2022
32cbf30
Change line separators from CRLF to LF
loeswerkman Feb 24, 2022
9915eda
Reset the output if the variant is an empty string
loeswerkman Feb 24, 2022
6e4e443
Handle exit as a statement instead of a function
loeswerkman Feb 24, 2022
ea1e4bd
Clean up bits of the code
loeswerkman Feb 25, 2022
4f57803
WIP: Save md5 translation of validated variants
loeswerkman Feb 26, 2022
4562560
WIP: Save md5 translation of validated variants
loeswerkman Feb 26, 2022
0ba1f0c
Fix bug when no transcripts are given
loeswerkman Mar 1, 2022
b0ffbbe
Fix issue causing blocked fields to not reach POST
loeswerkman Mar 1, 2022
a8afce5
Fix issue when setting the md5 key after validation
loeswerkman Mar 1, 2022
aa272d0
Merge branch 'improve/variantCreationForm' of github.com:LOVDnl/LOVD3…
loeswerkman Mar 1, 2022
07b52e6
Update documentation to better fit the code
loeswerkman Mar 1, 2022
7e75c35
Fix indentation
loeswerkman Mar 1, 2022
cc0dcda
Merge branch 'release/3.5' into gb/mapNewVariants
loeswerkman Mar 1, 2022
82abf86
Merge branch 'gb/mapNewVariants' into improve/variantCreationForm
loeswerkman Mar 1, 2022
fc90491
Fetch GB IDs using the data element and not SQL
loeswerkman Mar 2, 2022
afda306
Clean up code that checks refSeqs in description
loeswerkman Mar 2, 2022
20ea1e3
Stop blocking the 'Ignore this transcript' button
loeswerkman Mar 2, 2022
d9bf913
Fix bug and add comment to code which resets values
loeswerkman Mar 2, 2022
0a82e7f
Reset all values when the dialogue is called
loeswerkman Mar 3, 2022
a9f8773
Add the source of the variant when it is mapped
loeswerkman Mar 3, 2022
daee268
Trigger HGVS check when the chromosome is updated
loeswerkman Mar 3, 2022
ee315bb
Stop expiring the cache for inc-js-variants.php
loeswerkman Mar 3, 2022
3e3b691
Add css classes to the input fields to show status
loeswerkman Mar 3, 2022
fb3ce67
Fix bug when resetting the script
loeswerkman Mar 3, 2022
534d05f
Simplify code and add class to RNA&Protein fields
loeswerkman Mar 3, 2022
bc8b39c
Disable the Enter for all DNA fields
loeswerkman Mar 3, 2022
83b07f0
Fix all code that has to do with URL encoding
loeswerkman Mar 3, 2022
4fa5279
Reset all values based on whether mapping status
loeswerkman Mar 3, 2022
bb648a1
Make sure the dialog is closed if an error occurs
loeswerkman Mar 3, 2022
3ea60b2
Remove md5 key; Use checkFields to check input
loeswerkman Mar 3, 2022
186176b
Add documentation to the checkFields addition
loeswerkman Mar 3, 2022
c9cbda4
Get rid of the $_GET['chromosome'] usage
loeswerkman Mar 3, 2022
b4abbe2
Remove MD5 key function that is no longer used
loeswerkman Mar 4, 2022
6f154b2
Remove hidden codedVariants field (md5 key)
loeswerkman Mar 4, 2022
be5f3e6
Removing flush()
loeswerkman Mar 4, 2022
ca7a8e4
Take string, not int in update_images_per_step()
loeswerkman Mar 4, 2022
34b397e
Clean up code around update_dialogue() calls
loeswerkman Mar 4, 2022
e691e0e
Add documentation to the possible reset
loeswerkman Mar 4, 2022
4f976d6
Fix old typing in documentation
loeswerkman Mar 4, 2022
58e2165
Add and update documentation
loeswerkman Mar 4, 2022
0e983f3
Add addslashes() for safe keeping
loeswerkman Mar 4, 2022
88e9ba7
Remove old code related to the md5 key
loeswerkman Mar 4, 2022
3f9d7e3
Fix strange line separation
loeswerkman Mar 4, 2022
7a63d5e
Restore cache header
loeswerkman Mar 4, 2022
08cbb5f
Add documentation to lovd_checkHGVS()
loeswerkman Mar 4, 2022
4362e90
Update header
loeswerkman Mar 25, 2022
e9eea63
Clear up class name 'acc' to 'accept
loeswerkman Mar 25, 2022
b11ff02
Stop resetting values if an empty string is passed
loeswerkman Mar 25, 2022
f436950
Remove use of variables for buttons and images
loeswerkman Mar 25, 2022
aa1c715
Remove display:none and .show() for all imgs
loeswerkman Mar 25, 2022
9e450dc
Fix issue regarding oChromosome variable
loeswerkman Mar 25, 2022
e783dc0
Clean up the selection of an object by its data
loeswerkman Mar 25, 2022
ff584cf
Fill in fields that remained empty after mapping
loeswerkman Mar 25, 2022
752fd19
Use strpos instead of regex to find DNA fields
loeswerkman Mar 25, 2022
f626d4e
Fix and clean code that checks the variant format
loeswerkman Mar 25, 2022
ac3de94
Use 'https' instead of 'http' for the HGVS link
loeswerkman Mar 25, 2022
9436ec7
Fill and deactivate empty fields after mapping
loeswerkman Mar 25, 2022
2d443ac
Clarify message when VV threw a syntax/build
loeswerkman Mar 25, 2022
121a300
Remove RefSeq from description in OKCouldBeValid
loeswerkman Mar 25, 2022
6f9bef4
Fix concatenations of strings and strings
loeswerkman Mar 31, 2022
66f7a76
Get rid of negative selection to fill empty fields
loeswerkman Mar 31, 2022
5c3cc75
Fix code around strpos that finds 'DNA'
loeswerkman Mar 31, 2022
a96825a
Fix dates
loeswerkman Mar 31, 2022
a906b9c
Only reset values if the DB holds human GBs
loeswerkman Apr 8, 2022
e156a4e
Fix dates
loeswerkman Apr 8, 2022
a00ddfc
WIP: Only mapping GBs recognised by LOVD and VV
loeswerkman Apr 11, 2022
03c995a
Remove floating var_dump
loeswerkman Apr 12, 2022
03f5a4b
Remove refseq from not-accepted variants
loeswerkman Apr 12, 2022
3639e62
Update dates
loeswerkman Apr 12, 2022
b5d5c49
Use htmlspecialchars around all REQUEST variables
loeswerkman Apr 12, 2022
c89a307
Add documentation regarding REQUEST/POST/GET
loeswerkman Apr 12, 2022
eda072b
Make sure all variables in output are safe
loeswerkman Apr 13, 2022
8d6dfa0
Fix minor issue in refSeq ternary if
loeswerkman Apr 13, 2022
cd542ba
Update dates
loeswerkman Apr 13, 2022
6c9c5c2
Clarify error message that is thrown when VV fails
loeswerkman Apr 13, 2022
6a38123
Fix issues concerning URL en- & decoding
loeswerkman Jun 9, 2022
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
614 changes: 614 additions & 0 deletions src/ajax/check_hgvs_dialogue.php

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion src/ajax/mobidetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,14 @@
$_SESSION['csrf_tokens']['mobidetails_confirm'] = md5(uniqid());
$sFormConfirmation = str_replace('{{CSRF_TOKEN}}', $_SESSION['csrf_tokens']['mobidetails_confirm'], $sFormConfirmation);

// This print statement and flush do not work.
// It seems that flush successfully forces the output
// to the browser, but the browser does not seem to
// execute the JS until the page has finished loading. (Chrome)
print('
$("#mobidetails_dialog").html("<IMG src=\'gfx/ajax_loading.gif\' alt=\'Please wait...\' width=\'100\' height=\'100\'>");
');
ob_end_flush();
@ob_end_flush();
flush();

// Now check with MobiDetails.
Expand Down
6 changes: 6 additions & 0 deletions src/class/object_custom.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,12 @@ function buildForm ($sPrefix = '')
$aFormData[$sPrefix . $sCol] = $aEntry;
}

// The element data will be passed on, so that viewForm() can make sure it will be added to the HTML.
// NOTE: Element data is not stored in the database, but added by, for instance, getForm().
if (!empty($aCol['element_data'])) {
$aFormData[$sPrefix . $sCol][] = $aCol['element_data'];
}

// Any custom links we want to mention?
if (!empty($aCol['custom_links'])) {
$sLinks = '';
Expand Down
2 changes: 1 addition & 1 deletion src/class/object_genome_builds.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function prepareData ($zData = '', $sView = 'list')
$sDNAColumn = 'VariantOnGenome/DNA' . (!$zData['column_suffix']? '' : '/') . $zData['column_suffix'];
$nPercentComplete = (int) $_DB->query(
'SELECT ROUND(
(SELECT COUNT(*) FROM ' . TABLE_VARIANTS. '
(SELECT COUNT(*) FROM ' . TABLE_VARIANTS . '
WHERE `' . $sDNAColumn . '` IS NOT NULL AND
`' . $sDNAColumn . '` != "") / (
SELECT COUNT(*) FROM ' . TABLE_VARIANTS . ') * 100)')->fetchColumn();
Expand Down
46 changes: 29 additions & 17 deletions src/class/object_genome_variants.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,20 +222,6 @@ function __construct ()



function buildForm ($sPrefix = '')
{
$aForm = parent::buildForm($sPrefix);
// 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]);
}
return $aForm;
}





loeswerkman marked this conversation as resolved.
Show resolved Hide resolved
function checkFields ($aData, $zData = false, $aOptions = array())
{
global $_AUTH, $_SETT;
Expand Down Expand Up @@ -268,6 +254,26 @@ function checkFields ($aData, $zData = false, $aOptions = array())
}
}

foreach ($aData as $sField => $sVariant) {
if (strpos($sField, '/DNA/') !== false) {
loeswerkman marked this conversation as resolved.
Show resolved Hide resolved
// We want to check the input of all DNA fields: are these variant
// descriptions indeed cleanly formatted? And if our check seems
// to fail, is this perhaps because it holds syntax that we do
// not support? If we DO support the syntax but the variant does
// not seem to be HGVS, we will send an error.
if (lovd_isHGVS($sVariant)) {
// The variant looks good!
continue;
}
$aVariantInfo = lovd_getVariantInfo($sVariant, false);
if (array_diff(array_keys($aVariantInfo['errors']), array('ENOTSUPPORTED')) // Are there any errors other than ENOTSUPPORTED?
|| array_diff(array_keys($aVariantInfo['warnings']), array('WNOTSUPPORTED'))) { // Are there any warnings other than WNOTSUPPORTED?
// There are problems that are not caused by lack of syntax support.
lovd_errorAdd($sField, 'The variant ' . $sVariant . ' did not pass our checks. Please take another look and try again.');
}
}
}

loeswerkman marked this conversation as resolved.
Show resolved Hide resolved
// Do this before running checkFields so that we have time to predict the DBID and fill it in.
if (!empty($aData['VariantOnGenome/DNA']) // DNA filled in.
&& isset($this->aColumns['VariantOnGenome/DBID']) // DBID column active.
Expand Down Expand Up @@ -351,9 +357,15 @@ function getForm ()
}
}

// Add genome build name to VOG/DNA field.
$this->aColumns['VariantOnGenome/DNA']['description_form'] = '<B>Relative to ' . $_CONF['refseq_build'] . ' / ' . $_SETT['human_builds'][$_CONF['refseq_build']]['ncbi_name'] . '.</B>' .
(!$this->aColumns['VariantOnGenome/DNA']['description_form']? '' : '<BR>' . $this->aColumns['VariantOnGenome/DNA']['description_form']);
// Add genome build name and element data to VOG/DNA fields, and add in the link to the HGVS website.
$aActiveBuilds = $_DB->query('SELECT id, name, column_suffix FROM ' . TABLE_GENOME_BUILDS)->fetchAllGroupAssoc();
foreach ($aActiveBuilds as $sBuild => $aBuild) {
$sColumn = 'VariantOnGenome/DNA' . (!$aBuild['column_suffix']? '' : '/' . $aBuild['column_suffix']);
$this->aColumns[$sColumn]['description_form'] = '<B>Relative to ' . $aBuild['name'] . '.</B>' .
(!$this->aColumns[$sColumn]['description_form']? '' : '<BR>' . $this->aColumns[$sColumn]['description_form']);
$this->aColumns[$sColumn]['element_data'] = array('genome_build' => $sBuild);
$this->aColumns[$sColumn]['form_type'][0] = str_replace('(HGVS format)', '(<A href="https://varnomen.hgvs.org/recommendations/DNA" target="_blank">HGVS format</A>)', $this->aColumns[$sColumn]['form_type'][0]);
}
ifokkema marked this conversation as resolved.
Show resolved Hide resolved

// FIXME; right now two blocks in this array are put in, and optionally removed later. However, the if() above can build an entire block, such that one of the two big unset()s can be removed.
// A similar if() to create the "authorization" block, or possibly an if() in the building of this form array, is easier to understand and more efficient.
Expand Down
2 changes: 1 addition & 1 deletion src/class/variant_validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ public function verifyVariant ($sVariant, $aOptions = array())
// NM, we end up with only one NM here.
$aJSON = current($aJSON);

// Add a warning in case we submitted a intronic variant while not
// Add a warning in case we submitted an intronic variant while not
// using an NC reference sequence.
if (preg_match('/^N[MR]_.+[0-9]+[+-][0-9]+/', $sVariant)) {
$aData['warnings']['WINTRONICWITHOUTNC'] = 'Without using a genomic reference sequence, intronic bases can not be verified.' .
Expand Down
3 changes: 3 additions & 0 deletions src/inc-init.php
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@
'hg18' =>
array(
'ncbi_name' => 'Build 36.1',
'supported_by_VV' => false,
// FIXME: This information is also stored in the chromosomes table.
// Remove it from here?
'ncbi_sequences' =>
Expand Down Expand Up @@ -394,6 +395,7 @@
'hg19' =>
array(
'ncbi_name' => 'GRCh37',
'supported_by_VV' => true,
// FIXME: This information is also stored in the chromosomes table.
// Remove it from here?
'ncbi_sequences' =>
Expand Down Expand Up @@ -429,6 +431,7 @@
'hg38' =>
array(
'ncbi_name' => 'GRCh38',
'supported_by_VV' => true,
// FIXME: This information is also stored in the chromosomes table.
// Remove it from here?
'ncbi_sequences' =>
Expand Down
Loading