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

Add changes to achieve progress described #177

Merged
merged 3 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 4 additions & 7 deletions molSimplify/Classes/globalvars.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,13 +458,10 @@
"""
p = subprocess.Popen(
cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
stdout = []
while True:
line = p.stdout.readline()
stdout.append(line)
if line == '' and p.poll() is not None:
break
return ''.join(stdout)
stdout, stderr = p.communicate()
lines = stdout.decode('utf-8').splitlines()
lines = [line+"\n" for line in lines if line !=""]
return ''.join(lines)

Check warning on line 464 in molSimplify/Classes/globalvars.py

View check run for this annotation

Codecov / codecov/patch

molSimplify/Classes/globalvars.py#L461-L464

Added lines #L461 - L464 were not covered by tests


# Defines global variables used throughout the code
Expand Down
10 changes: 6 additions & 4 deletions molSimplify/Scripts/dbinteract.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,13 @@
print(('database set up :' + str(dbsdf) + ' || ' + str(dbfs)))
print(('Finding results similar, comparing to ' + smi))

obab = 'babel'
obab = 'obabel' # babel -> obabel

Check warning on line 165 in molSimplify/Scripts/dbinteract.py

View check run for this annotation

Codecov / codecov/patch

molSimplify/Scripts/dbinteract.py#L165

Added line #L165 was not covered by tests
if dbfs and args.dbfs:
com = obab + ' ' + dbfs + ' ' + 'simres.smi -d -xf' + \
finger + ' -s"' + smi + '" -al' + nmols
else:
mybash(obab + ' -isdf ' + dbsdf + ' -osdf -O tmp.sdf -d')
com = obab + ' tmp.sdf simres.smi -xf' + finger + ' -s"' + smi + '"'
com = obab + ' tmp.sdf -O simres.smi -xf' + finger + ' -s"' + smi + '"' # babel -> obabel

Check warning on line 171 in molSimplify/Scripts/dbinteract.py

View check run for this annotation

Codecov / codecov/patch

molSimplify/Scripts/dbinteract.py#L171

Added line #L171 was not covered by tests

Check warning

Code scanning / CodeQL

Unsafe shell command constructed from library input Medium

This string concatenation which depends on
library input
is later used in a
shell command
.
This string concatenation which depends on
library input
is later used in a
shell command
.
This string concatenation which depends on
library input
is later used in a
shell command
.
This string concatenation which depends on
library input
is later used in a
shell command
.
# perform search using bash commandline
print('Performing substructure search:')
print(('running: ' + str(com)))
Expand Down Expand Up @@ -306,7 +306,7 @@
# @param outf Filename containing SMILES strings to be processed
# @param n Number of dissimilar molecules required
def dissim(outf, n):
obab = 'babel'
obab = 'obabel' # babel -> obabel

Check warning on line 309 in molSimplify/Scripts/dbinteract.py

View check run for this annotation

Codecov / codecov/patch

molSimplify/Scripts/dbinteract.py#L309

Added line #L309 was not covered by tests

# clone hitlist file
hit_list_path = "hitlist.smi"
Expand All @@ -317,7 +317,7 @@
f.writelines(smiles_list)

# generate fs of original hit list
mybash(obab + ' -ismi ' + hit_list_path + ' -osdf tmp.sdf')
mybash(obab + ' -ismi ' + hit_list_path + ' -osdf -O tmp.sdf') # babel -> obabel

Check warning on line 320 in molSimplify/Scripts/dbinteract.py

View check run for this annotation

Codecov / codecov/patch

molSimplify/Scripts/dbinteract.py#L320

Added line #L320 was not covered by tests
mybash(obab + ' tmp.sdf -ofs')
# number of hits
numcpds = mybash('obabel tmp.sdf -onul')
Expand Down Expand Up @@ -553,6 +553,8 @@
shutil.copy('simres.smi', outf)
except FileNotFoundError:
pass
except shutil.SameFileError: # babel -> obabel
pass # babel -> obabel

Check warning on line 557 in molSimplify/Scripts/dbinteract.py

View check run for this annotation

Codecov / codecov/patch

molSimplify/Scripts/dbinteract.py#L556-L557

Added lines #L556 - L557 were not covered by tests

if args.debug:
print(('after similarity search, outf is ' + str(outputf)))
Expand Down
Loading