From f82eb6bbbba0443ec8fbec202383d369e978174c Mon Sep 17 00:00:00 2001 From: Peter Causey-Freeman Date: Thu, 17 Jan 2019 10:37:55 +0000 Subject: [PATCH 1/6] Update version numbers in the config and version.txt to 0.2. Please make a hashed list of logging options with comments. Please also set the metadata outputs to the useful minimum as discussed. Ifmeta fails to set properly on testing, I'll make the meta object and plug it in. --- VERSION.txt | 2 +- VariantValidator/configuration/config.ini | 8 ++++---- VariantValidator/variantValidator.py | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index 08a623bd..e2cfc99c 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -0.1.0_dev_pre_a \ No newline at end of file +v0.2 \ No newline at end of file diff --git a/VariantValidator/configuration/config.ini b/VariantValidator/configuration/config.ini index ea820deb..ce6fc356 100644 --- a/VariantValidator/configuration/config.ini +++ b/VariantValidator/configuration/config.ini @@ -1,6 +1,6 @@ [variantValidator] -version = 0.1.0_dev_pre_a -release_date = tbc +version = v0.2 +release_date = 2019-01-18 [mysql] host = 127.0.0.1 @@ -9,8 +9,8 @@ user = vvadmin password = var1ant [logging] -# string = error file console trace -string = debug file console trace +# string = error file console trace - please make this a simple provide hashed options +string = info console [EntrezID] entrezid = admin@variantvalidator.org diff --git a/VariantValidator/variantValidator.py b/VariantValidator/variantValidator.py index 23b4f62c..cd30d87f 100644 --- a/VariantValidator/variantValidator.py +++ b/VariantValidator/variantValidator.py @@ -239,10 +239,10 @@ def my_config(): 'py_liftover_directory': PYLIFTOVER_DIR, 'variantvalidator_data_url': VALIDATOR_DB_URL, 'entrez_id': ENTREZ_ID, - 'variantvalidator_version': VERSION, - 'variantvalidator_hgvs_version': hgvs_version, - 'uta_schema': str(hdp.data_version()), - 'seqrepo_db': HGVS_SEQREPO_DIR.split('/')[-1] + 'variantvalidator_version': VERSION, # + 'variantvalidator_hgvs_version': hgvs_version, # + 'uta_schema': str(hdp.data_version()), # + 'seqrepo_db': HGVS_SEQREPO_DIR.split('/')[-1] # } return locate From 306d20c84b94bacdcde3237dfda7c5317e089c67 Mon Sep 17 00:00:00 2001 From: buran Date: Thu, 17 Jan 2019 13:41:16 +0000 Subject: [PATCH 2/6] Fixed Petes raised issues --- VariantValidator/configuration/config.ini | 10 ++++-- VariantValidator/testing/test_vv.py | 1 + VariantValidator/variantValidator.py | 39 +++++++++++++---------- 3 files changed, 31 insertions(+), 19 deletions(-) diff --git a/VariantValidator/configuration/config.ini b/VariantValidator/configuration/config.ini index ce6fc356..ea3f5c32 100644 --- a/VariantValidator/configuration/config.ini +++ b/VariantValidator/configuration/config.ini @@ -9,8 +9,14 @@ user = vvadmin password = var1ant [logging] -# string = error file console trace - please make this a simple provide hashed options -string = info console +#Levels control verbosity and can be set to "critical" "error" "warning" "info" or "debug". +level = info +#level = debug +console = true +# Beware - file logging has permission issues. +file = false +# Trace is used for debugging to track variants through the validator function +trace = false [EntrezID] entrezid = admin@variantvalidator.org diff --git a/VariantValidator/testing/test_vv.py b/VariantValidator/testing/test_vv.py index d8a7e0f1..c1f2a297 100644 --- a/VariantValidator/testing/test_vv.py +++ b/VariantValidator/testing/test_vv.py @@ -44,6 +44,7 @@ def constructValidation(request): # print request.param selectTranscripts='all' selectedAssembly='GRCh37' + os.environ["ADD_LOGS"]="True" return hub,hub.vv.validator(request.param,selectedAssembly,selectTranscripts) def test_validation_output(constructValidation): diff --git a/VariantValidator/variantValidator.py b/VariantValidator/variantValidator.py index cd30d87f..fc5f5798 100644 --- a/VariantValidator/variantValidator.py +++ b/VariantValidator/variantValidator.py @@ -83,7 +83,7 @@ import external import output_formatter import variantanalyser -from vvLogging import logger +from variantanalyser.vvLogging import logger from variantanalyser import functions as va_func from variantanalyser import dbControls as va_dbCrl from variantanalyser import hgvs2vcf as va_H2V @@ -150,11 +150,20 @@ def loadConfigFile(): if re.match('^\d+\.\d+\.\d+$', __version__) is not None: _is_released_version = True # Load database environments from config - - logString = ConfigSectionMap("logging", Config)['string'] + levelString = ConfigSectionMap("logging", Config)['level'] + consoleString = ConfigSectionMap("logging", Config)['console'] + if consoleString.lower()=="true": + consoleString="console" + fileString = ConfigSectionMap("logging", Config)['file'] + if fileString.lower()=="true": + fileString="file" + traceString = ConfigSectionMap("logging", Config)['trace'] + if traceString.lower()=="true": + traceString="trace" + logString = levelString+" "+consoleString+" "+fileString+" "+traceString os.environ["VALIDATOR_DEBUG"] = logString - print "ac", os.environ["VALIDATOR_DEBUG"] - print("ls", logString) + #print "ac", os.environ["VALIDATOR_DEBUG"] + #print("ls", logString) # Custom Exceptions @@ -234,11 +243,6 @@ def my_config(): hgvs_version = hgvs.__version__, hgvs_version = str(hgvs_version[0]) locate = { - 'seqrepo_directory': HGVS_SEQREPO_DIR, - 'uta_url': UTA_DB_URL, - 'py_liftover_directory': PYLIFTOVER_DIR, - 'variantvalidator_data_url': VALIDATOR_DB_URL, - 'entrez_id': ENTREZ_ID, 'variantvalidator_version': VERSION, # 'variantvalidator_hgvs_version': hgvs_version, # 'uta_schema': str(hdp.data_version()), # @@ -8429,15 +8433,16 @@ def validator(batch_variant, selected_assembly, select_transcripts, transcriptSe logString = logger.getString() for l in logger.getString().split("\n"): logs.append(l) - metadata["logs"] = logString + if os.environ.get("ADD_LOGS")=="True": + metadata["logs"] = logString metadata["variant"] = batch_variant metadata["assembly"] = selected_assembly metadata["transcripts"] = select_transcripts - metadata['seqrepo_directory'] = HGVS_SEQREPO_DIR - metadata['uta_url'] = UTA_DB_URL - metadata['py_liftover_directory'] = PYLIFTOVER_DIR - metadata['variantvalidator_data_url'] = VALIDATOR_DB_URL - metadata['entrez_id'] = ENTREZ_ID + #metadata['seqrepo_directory'] = HGVS_SEQREPO_DIR + #metadata['uta_url'] = UTA_DB_URL + #metadata['py_liftover_directory'] = PYLIFTOVER_DIR + #metadata['variantvalidator_data_url'] = VALIDATOR_DB_URL + #metadata['entrez_id'] = ENTREZ_ID metadata['variantvalidator_version'] = VERSION metadata['variantvalidator_hgvs_version'] = hgvs_version metadata['uta_schema'] = str(hdp.data_version()) @@ -8689,7 +8694,7 @@ def hgvs2ref(query): def update_vv_data(): import sys - logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) + #logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) # import update modules import mysql_refSeqGene_noMissmatch import compile_lrg_data From fcb99747199592fe68eb4008d6b33f952f90d2d8 Mon Sep 17 00:00:00 2001 From: "Peter J. Causey-Freeman" Date: Thu, 17 Jan 2019 15:20:09 +0000 Subject: [PATCH 3/6] spruce up metadata --- VariantValidator/variantValidator.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/VariantValidator/variantValidator.py b/VariantValidator/variantValidator.py index fc5f5798..1f56df70 100644 --- a/VariantValidator/variantValidator.py +++ b/VariantValidator/variantValidator.py @@ -8435,9 +8435,9 @@ def validator(batch_variant, selected_assembly, select_transcripts, transcriptSe logs.append(l) if os.environ.get("ADD_LOGS")=="True": metadata["logs"] = logString - metadata["variant"] = batch_variant - metadata["assembly"] = selected_assembly - metadata["transcripts"] = select_transcripts + #metadata["variant"] = batch_variant + #metadata["assembly"] = selected_assembly + #metadata["transcripts"] = select_transcripts #metadata['seqrepo_directory'] = HGVS_SEQREPO_DIR #metadata['uta_url'] = UTA_DB_URL #metadata['py_liftover_directory'] = PYLIFTOVER_DIR From 4af56bfcb683e328abbd3fd8c49cb2aea7b1a45d Mon Sep 17 00:00:00 2001 From: Peter Causey-Freeman Date: Fri, 18 Jan 2019 10:22:14 +0000 Subject: [PATCH 4/6] "sort LRG handling when upper casing accession" --- VariantValidator/variantValidator.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/VariantValidator/variantValidator.py b/VariantValidator/variantValidator.py index 1f56df70..42afb94b 100644 --- a/VariantValidator/variantValidator.py +++ b/VariantValidator/variantValidator.py @@ -1121,7 +1121,10 @@ def validator(batch_variant, selected_assembly, select_transcripts, transcriptSe except hgvs.exceptions.HGVSError as e: error = str(e) if error == 'false': - input_parses.ac = input_parses.ac.upper() + if 'LRG' in input_parses.ac: + input_parses.ac.replace('T', 't') + else: + input_parses.ac = input_parses.ac.upper() if hasattr(input_parses.posedit.edit, 'alt'): if input_parses.posedit.edit.alt is not None: input_parses.posedit.edit.alt = input_parses.posedit.edit.alt.upper() From b33f11808ad183d0c6603b4099a4e74d1a419316 Mon Sep 17 00:00:00 2001 From: Peter Causey-Freeman Date: Fri, 18 Jan 2019 13:02:07 +0000 Subject: [PATCH 5/6] Loop out rel_var variants that fail to generate correctly --- VariantValidator/variantValidator.py | 8 ++++---- VariantValidator/variantanalyser/functions.py | 13 +++++++++++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/VariantValidator/variantValidator.py b/VariantValidator/variantValidator.py index 42afb94b..873985b0 100644 --- a/VariantValidator/variantValidator.py +++ b/VariantValidator/variantValidator.py @@ -1983,7 +1983,7 @@ def validator(batch_variant, selected_assembly, select_transcripts, transcriptSe continue else: # Any transcripts? - rel_var = va_func.relevant_transcripts(hgvs_mito, evm, hdp, alt_aln_method, reverse_normalizer) + rel_var = va_func.relevant_transcripts(hgvs_mito, evm, hdp, alt_aln_method, reverse_normalizer, hp) hgvs_genomic = copy.deepcopy(hgvs_mito) if len(rel_var) == 0: validation['genomic_g'] = valstr(hgvs_mito) @@ -2264,7 +2264,7 @@ def validator(batch_variant, selected_assembly, select_transcripts, transcriptSe Initial simple projection from the provided g. position all overlapping transcripts """ - rel_var = va_func.relevant_transcripts(hgvs_genomic, evm, hdp, alt_aln_method, reverse_normalizer) + rel_var = va_func.relevant_transcripts(hgvs_genomic, evm, hdp, alt_aln_method, reverse_normalizer, hp) # Double check rel_vars have not been missed when mapping from a RefSeqGene if len(rel_var) != 0 and re.match('NG_', str(hgvs_genomic.ac)): @@ -2277,7 +2277,7 @@ def validator(batch_variant, selected_assembly, select_transcripts, transcriptSe try_rel_var = [] else: try_rel_var = va_func.relevant_transcripts(hgvs_genomic, evm, hdp, alt_aln_method, - reverse_normalizer) + reverse_normalizer, hp) if len(try_rel_var) > len(rel_var): rel_var = try_rel_var break @@ -2292,7 +2292,7 @@ def validator(batch_variant, selected_assembly, select_transcripts, transcriptSe vcf_dict['alt'] hgvs_not_di = hp.parse_hgvs_variant(not_di) rel_var = va_func.relevant_transcripts(hgvs_not_di, evm, hdp, alt_aln_method, - reverse_normalizer) + reverse_normalizer, hp) # list return statements """ diff --git a/VariantValidator/variantanalyser/functions.py b/VariantValidator/variantanalyser/functions.py index f43e7048..667149b8 100644 --- a/VariantValidator/variantanalyser/functions.py +++ b/VariantValidator/variantanalyser/functions.py @@ -2393,7 +2393,7 @@ def tx_exons(tx_ac, alt_ac, alt_aln_method, hdp): """ -def relevant_transcripts(hgvs_genomic, evm, hdp, alt_aln_method, reverse_normalizer): +def relevant_transcripts(hgvs_genomic, evm, hdp, alt_aln_method, reverse_normalizer, hp): reverse_hn = reverse_normalizer # Pass relevant transcripts for the input variant to rts # Note, the evm method misses one end, the hdp. method misses the other. Combine both @@ -2468,7 +2468,16 @@ def relevant_transcripts(hgvs_genomic, evm, hdp, alt_aln_method, reverse_normali rev_hgvs_genomic = reverse_hn.normalize(hgvs_genomic) # map back to coding variant = evm.g_to_t(rev_hgvs_genomic, tx_ac) - code_var.append(str(variant)) + + strung = str(variant) + try: + hp.parse_hgvs_variant(variant) + except hgvs.exceptions.HGVSError: + continue + except TypeError: + continue + else: + code_var.append(str(variant)) return code_var From ed84ca81fa1b2d9a2b301467b3402aaaf024f1ac Mon Sep 17 00:00:00 2001 From: Peter Causey-Freeman Date: Fri, 18 Jan 2019 13:13:19 +0000 Subject: [PATCH 6/6] Correct typo in rel_var - doh --- VariantValidator/variantanalyser/functions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VariantValidator/variantanalyser/functions.py b/VariantValidator/variantanalyser/functions.py index 667149b8..4e34c3cf 100644 --- a/VariantValidator/variantanalyser/functions.py +++ b/VariantValidator/variantanalyser/functions.py @@ -2471,7 +2471,7 @@ def relevant_transcripts(hgvs_genomic, evm, hdp, alt_aln_method, reverse_normali strung = str(variant) try: - hp.parse_hgvs_variant(variant) + hp.parse_hgvs_variant(strung) except hgvs.exceptions.HGVSError: continue except TypeError: