Skip to content

Commit 4c8b23e

Browse files
committed
add safeguard
1 parent f504dea commit 4c8b23e

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

chemicaltoolbox/data_source/get_pubchem/get_pubchem_as_smiles.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def main(output, processors = 4):
2929
result.get()
3030

3131
for filename in os.listdir(td):
32-
path = os.path.join(td, filename)
32+
path = os.path.join(td, filename) + '.smi'
3333
shutil.copyfileobj(open(path, 'rb'), output_handle)
3434

3535
output_handle.close()
@@ -38,9 +38,9 @@ def main(output, processors = 4):
3838
def fetch_convert(args):
3939
(filename, td) = args
4040

41-
tmp_name = os.path.join( tempfile.gettempdir(), filename)
41+
tmp_name = os.path.join( td, filename)
4242
subprocess.call( ['wget', '-O', tmp_name, os.path.join('ftp://ftp.ncbi.nih.gov/pubchem/Compound/CURRENT-Full/SDF/', filename)] )
43-
output = os.path.join(td, filename)
43+
output = os.path.join(td, filename) + '.smi'
4444
subprocess.call(["obabel", "-isdf", tmp_name, "-ocan", '-O', output])
4545
os.remove(tmp_name)
4646

chemicaltoolbox/data_source/get_pubchem/get_pubchem_as_smiles.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<tool id="ctb_pubchem_download_as_smiles" name="PubChem Download" Version="0.1" >
22
<description>as canonical SMILES</description>
3+
<requirements>
4+
<requirement type="package" version="2.3.2">openbabel</requirement>
5+
</requirements>
36
<command interpreter="python">
47
get_pubchem_as_smiles.py
58
-o $pubchem_smi
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0"?>
2+
<tool_dependency>
3+
<package name="openbabel" version="2.3.2">
4+
<repository name="package_openbabel_2_3" owner="iuc" />
5+
</package>
6+
</tool_dependency>

0 commit comments

Comments
 (0)