Skip to content

Commit

Permalink
make linux gui script runnable from other directories & update Protei…
Browse files Browse the repository at this point in the history
…nGym URLs
  • Loading branch information
niklases committed Oct 23, 2024
1 parent ab0389c commit dee73cf
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
12 changes: 6 additions & 6 deletions gui/qt_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,51 +186,51 @@ def on_readyReadStandardOutput(self):

@QtCore.Slot()
def pypef_mklsts(self):
self.version_text.setText("Running MKLSTS...")
wt_fasta_file = QtWidgets.QFileDialog.getOpenFileName(self, "Select WT FASTA File")[0]
csv_variant_file = QtWidgets.QFileDialog.getOpenFileName(self, "Select variant CSV File")[0]
if wt_fasta_file and csv_variant_file:
self.version_text.setText("Running MKLSTS...")
self.exec_pypef(f'mklsts --wt {wt_fasta_file} --input {csv_variant_file}')

@QtCore.Slot()
def pypef_gremlin(self):
self.version_text.setText("Running GREMLIN (DCA) optimization on MSA...")
wt_fasta_file = QtWidgets.QFileDialog.getOpenFileName(self, "Select WT FASTA File")[0]
msa_file = QtWidgets.QFileDialog.getOpenFileName(self, "Select Multiple Sequence Alignment (MSA) file (in FASTA or A2M format)")[0]
if wt_fasta_file and msa_file:
self.version_text.setText("Running GREMLIN (DCA) optimization on MSA...")
self.exec_pypef(f'param_inference --wt {wt_fasta_file} --msa {msa_file}') # --opt_iter 100

@QtCore.Slot()
def pypef_gremlin_dca_test(self):
self.version_text.setText("Testing GREMLIN (DCA) performance on provided test set...")
test_set_file = QtWidgets.QFileDialog.getOpenFileName(self, "Select Test Set File in \"FASL\" format")[0]
params_pkl_file = QtWidgets.QFileDialog.getOpenFileName(self, "GREMLIN parameter Pickle file")[0]
if test_set_file and params_pkl_file:
self.version_text.setText("Testing GREMLIN (DCA) performance on provided test set...")
self.exec_pypef(f'hybrid --ts {test_set_file} -m {params_pkl_file} --params {params_pkl_file}') # --opt_iter 100

@QtCore.Slot()
def pypef_gremlin_dca_predict(self):
self.version_text.setText("Predicting using the GREMLIN (DCA) model on provided prediction set...")
prediction_file = QtWidgets.QFileDialog.getOpenFileName(self, "Select Prediction Set File in FASTA format")[0]
params_pkl_file = QtWidgets.QFileDialog.getOpenFileName(self, "Select GREMLIN parameter Pickle file")[0]
if prediction_file and params_pkl_file:
self.version_text.setText("Predicting using the GREMLIN (DCA) model on provided prediction set...")
self.exec_pypef(f'hybrid --ps {prediction_file} -m {params_pkl_file} --params {params_pkl_file}') # --opt_iter 100

@QtCore.Slot()
def pypef_gremlin_hybrid_train(self):
self.version_text.setText("Hybrid (DCA-supervised) model training...")
training_file = QtWidgets.QFileDialog.getOpenFileName(self, "Select Training Set File in \"FASL\" format")[0]
params_pkl_file = QtWidgets.QFileDialog.getOpenFileName(self, "Select GREMLIN parameter Pickle file")[0]
if training_file and params_pkl_file:
self.version_text.setText("Hybrid (DCA-supervised) model training...")
self.exec_pypef(f'hybrid --ls {training_file} --ts {training_file} -m {params_pkl_file} --params {params_pkl_file}') # --opt_iter 100

@QtCore.Slot()
def pypef_gremlin_hybrid_train_test(self):
self.version_text.setText("...")
training_file = QtWidgets.QFileDialog.getOpenFileName(self, "Select Training Set File in \"FASL\" format")[0]
test_file = QtWidgets.QFileDialog.getOpenFileName(self, "Select Test Set File in \"FASL\" format")[0]
params_pkl_file = QtWidgets.QFileDialog.getOpenFileName(self, "Select GREMLIN parameter Pickle file")[0]
if training_file and test_file and params_pkl_file:
self.version_text.setText("Hybrid (DCA-supervised) model training and testing...")
self.exec_pypef(f'hybrid --ls {training_file} --ts {test_file} -m {params_pkl_file} --params {params_pkl_file}') # --opt_iter 100

def exec_pypef(self, cmd):
Expand Down
8 changes: 6 additions & 2 deletions gui_setup.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/bash
set -e

# Only required for WSL(?):
# sudo apt-get install -y libxcb-cursor-dev

python -m pip install -U pypef pyside6

printf "
Expand All @@ -11,8 +14,9 @@ if __name__ == '__main__':
run_main()
" > run.py

printf "#!/bin/bash
python gui/qt_window.py
printf "#!/bin/bash\n
SCRIPT_DIR=\$( cd -- \"\$( dirname -- \"\${BASH_SOURCE[0]}\" )\" &> /dev/null && pwd )\n
python "\${SCRIPT_DIR}/gui/qt_window.py"\n
" > run_pypef_gui.sh

echo "Finished installation..."
Expand Down
10 changes: 5 additions & 5 deletions scripts/ProteinGym_runs/download_proteingym_and_extract_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,26 @@



def download_proteingym_data():
url = 'https://marks.hms.harvard.edu/proteingym/DMS_substitutions.csv'
def download_proteingym_data(version: str = '1.1'):
url = f'https://marks.hms.harvard.edu/proteingym/ProteinGym_v{version}/DMS_substitutions.csv'
print(f'Getting {url}...')
urllib.request.urlretrieve(url, os.path.join(os.path.dirname(__file__), '_Description_DMS_substitutions_data.csv'))

url = 'https://marks.hms.harvard.edu/proteingym/DMS_ProteinGym_substitutions.zip'
url = f'https://marks.hms.harvard.edu/proteingym/ProteinGym_v{version}/DMS_ProteinGym_substitutions.zip'
print(f'Getting {url}...')
urllib.request.urlretrieve(url, os.path.join(os.path.dirname(__file__), 'DMS_ProteinGym_substitutions.zip'))
with zipfile.ZipFile(os.path.join(os.path.dirname(__file__), 'DMS_ProteinGym_substitutions.zip'), "r") as zip_ref:
zip_ref.extractall(os.path.join(os.path.dirname(__file__), 'DMS_ProteinGym_substitutions'))
os.remove(os.path.join(os.path.dirname(__file__), 'DMS_ProteinGym_substitutions.zip'))

url = 'https://marks.hms.harvard.edu/proteingym/DMS_msa_files.zip'
url = f'https://marks.hms.harvard.edu/proteingym/ProteinGym_v{version}/DMS_msa_files.zip'
print(f'Getting {url}...')
urllib.request.urlretrieve(url, os.path.join(os.path.dirname(__file__), 'DMS_msa_files.zip'))
with zipfile.ZipFile(os.path.join(os.path.dirname(__file__), 'DMS_msa_files.zip'), "r") as zip_ref:
zip_ref.extractall(os.path.join(os.path.dirname(__file__), 'DMS_msa_files'))
os.remove(os.path.join(os.path.dirname(__file__), 'DMS_msa_files.zip'))

url = 'https://marks.hms.harvard.edu/proteingym/ProteinGym_AF2_structures.zip'
url = f'https://marks.hms.harvard.edu/proteingym/ProteinGym_v{version}/ProteinGym_AF2_structures.zip'
print(f'Getting {url}...')
urllib.request.urlretrieve(url, os.path.join(os.path.dirname(__file__), 'ProteinGym_AF2_structures.zip'))
with zipfile.ZipFile(os.path.join(os.path.dirname(__file__), 'ProteinGym_AF2_structures.zip'), "r") as zip_ref:
Expand Down

0 comments on commit dee73cf

Please sign in to comment.