Skip to content

Commit

Permalink
Merge pull request #9 from UniOfLeicester/v0.0_series
Browse files Browse the repository at this point in the history
V0.0 series
  • Loading branch information
pjdp2 authored Jan 18, 2019
2 parents 11670bf + ed84ca8 commit 23e9e39
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 36 deletions.
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.0_dev_pre_a
v0.2
14 changes: 10 additions & 4 deletions VariantValidator/configuration/config.ini
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -9,8 +9,14 @@ user = vvadmin
password = var1ant

[logging]
# string = error file console trace
string = debug file console trace
#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
Expand Down
1 change: 1 addition & 0 deletions VariantValidator/testing/test_vv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
66 changes: 37 additions & 29 deletions VariantValidator/variantValidator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -234,15 +243,10 @@ 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()),
'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

Expand Down Expand Up @@ -1117,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()
Expand Down Expand Up @@ -1976,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)
Expand Down Expand Up @@ -2257,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)):
Expand All @@ -2270,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
Expand All @@ -2285,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
"""
Expand Down Expand Up @@ -8429,15 +8436,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
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
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['variantvalidator_version'] = VERSION
metadata['variantvalidator_hgvs_version'] = hgvs_version
metadata['uta_schema'] = str(hdp.data_version())
Expand Down Expand Up @@ -8689,7 +8697,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
Expand Down
13 changes: 11 additions & 2 deletions VariantValidator/variantanalyser/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(strung)
except hgvs.exceptions.HGVSError:
continue
except TypeError:
continue
else:
code_var.append(str(variant))
return code_var


Expand Down

0 comments on commit 23e9e39

Please sign in to comment.