aboutsummaryrefslogtreecommitdiff
path: root/app/misc/common.py
diff options
context:
space:
mode:
authorNavan Chauhan <navanchauhan@gmail.com>2020-09-27 01:11:23 +0530
committerNavan Chauhan <navanchauhan@gmail.com>2020-09-27 01:11:23 +0530
commit019c38039873cd60df915b8026bd8abd50e648b5 (patch)
tree53d7ae4bf1752acf336dd75d07df324c1075a886 /app/misc/common.py
parent12bcd3b48a1279cac3624b8d55c2286a6677a9de (diff)
removed common functions and added to misc
Diffstat (limited to 'app/misc/common.py')
-rw-r--r--app/misc/common.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/app/misc/common.py b/app/misc/common.py
new file mode 100644
index 0000000..1463c73
--- /dev/null
+++ b/app/misc/common.py
@@ -0,0 +1,33 @@
+import os
+import glob
+from shutil import copy
+
+def CopyContentOfFolder(sauce,destination):
+ src_files = os.listdir(sauce)
+ for file_name in src_files:
+ full_file_name = os.path.join(sauce, file_name)
+ if os.path.isfile(full_file_name):
+ copy(full_file_name, destination)
+
+def RemoveAllFilesMatching(directory,pattern):
+ print(directory+"/*"+pattern)
+ FileList = glob.glob(directory+"/*"+pattern)
+ for FilePath in FileList:
+ try:
+ os.remove(FilePath)
+ except:
+ print("Error in removing misc file")
+
+def get3DModel(protein,ligand):
+ try:
+ import pymol2
+ except ImportError:
+ print("🤭 PyMOL 2 has not been installed correctly")
+ return None
+ session = pymol2.PyMOL()
+ session.start()
+ cmd = session.cmd
+ cmd.load(protein,"target")
+ cmd.load(ligand,"ligand")
+ cmd.save("model.dae")
+ session.stop() \ No newline at end of file