SMILES input handling @btrojan-official
This commit is contained in:
commit
d4f955ebc9
4
.gitignore
vendored
4
.gitignore
vendored
@ -4,4 +4,6 @@ __pycache__
|
||||
data
|
||||
*.ipynb
|
||||
secret_key.txt
|
||||
.venv
|
||||
|
||||
.venv
|
||||
venv
|
||||
9
serve.py
9
serve.py
@ -191,6 +191,12 @@ def search_rank(q: str = ''):
|
||||
scores = [p[0] for p in pairs]
|
||||
return pids, scores
|
||||
|
||||
def chemical_formulas_rank(q: str = ''):
|
||||
# Here we will implement logic for our chemical formulas search engine,
|
||||
# but for now, we will just return random results.
|
||||
|
||||
return random_rank()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# primary application endpoints
|
||||
|
||||
@ -217,6 +223,7 @@ def main():
|
||||
opt_time_filter = request.args.get('time_filter', default_time_filter) # number of days to filter by
|
||||
opt_skip_have = request.args.get('skip_have', default_skip_have) # hide papers we already have?
|
||||
opt_svm_c = request.args.get('svm_c', '') # svm C parameter
|
||||
opt_smiles_input = request.args.get('smiles_input', '')
|
||||
opt_page_number = request.args.get('page_number', '1') # page number for pagination
|
||||
|
||||
# if a query is given, override rank to be of type "search"
|
||||
@ -242,6 +249,8 @@ def main():
|
||||
pids, scores = time_rank()
|
||||
elif opt_rank == 'random':
|
||||
pids, scores = random_rank()
|
||||
elif opt_rank == 'chemical_formulas':
|
||||
pids, scores = chemical_formulas_rank(opt_smiles_input)
|
||||
else:
|
||||
raise ValueError("opt_rank %s is not a thing" % (opt_rank, ))
|
||||
|
||||
|
||||
@ -269,6 +269,9 @@ body {
|
||||
#svm_c_field {
|
||||
width: 30px;
|
||||
}
|
||||
#smiles_input{
|
||||
width: 300px;
|
||||
}
|
||||
#tagList {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
@ -44,6 +44,7 @@ var move_page = function(int_offset) {
|
||||
<option value="pid" {{ gvars.rank == 'pid' and 'selected' }}>pid</option>
|
||||
<option value="time" {{ gvars.rank == 'time' and 'selected' }}>time</option>
|
||||
<option value="random" {{ gvars.rank == 'random' and 'selected' }}>random</option>
|
||||
<option value="chemical_formulas" {{ gvars.rank == 'chemical_formulas' and 'selected' }}>chemical formulas</option>
|
||||
</select>
|
||||
|
||||
<!-- current tags, simply in a text field -->
|
||||
@ -62,6 +63,9 @@ var move_page = function(int_offset) {
|
||||
<label for="svm_c">svm_c: </label>
|
||||
<input name="svm_c" type="text" id="svm_c_field" value="{{ gvars.svm_c }}">
|
||||
|
||||
<label for="smiles_input">chemical SMILES: </label>
|
||||
<input name="smiles_input" type="text" id="smiles_input" value="{{ gvars.smiles_input }}">
|
||||
|
||||
<!-- current skip_have: one of yes or no -->
|
||||
<label for="skip_have">skip_have: </label>
|
||||
<select name="skip_have" id="skip_have_select">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user