From 5313c8d24257e14807def5bcb96574038b1ad093 Mon Sep 17 00:00:00 2001 From: AldovdN <90687940+AldovdN@users.noreply.github.com> Date: Wed, 27 Jul 2022 12:48:08 +0200 Subject: [PATCH] Remove testing code --- src/cport/modules/scannet.py | 17 ++++++++--------- src/cport/modules/utils.py | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/cport/modules/scannet.py b/src/cport/modules/scannet.py index 3908ad7..d2ff0ab 100644 --- a/src/cport/modules/scannet.py +++ b/src/cport/modules/scannet.py @@ -3,12 +3,9 @@ import logging import re import sys -import tempfile import time import mechanicalsoup as ms -import pandas as pd - from Bio import PDB from cport.url import SCANNET_URL @@ -61,7 +58,8 @@ def submit(self): input_form.set(name="chain", value=self.chain_id) browser.submit_selected() - processing_url = browser.links()[7] + browser.follow_link(browser.links()[7]) + processing_url = browser.get_url() log.debug(f"The url being looked at: {processing_url}") return processing_url @@ -112,7 +110,6 @@ def retrieve_prediction_link(self, url=None, page_text=None): return url - def parse_prediction(self, url=None, test_file=None): """ Take the results extracts the active and passive residue predictions. @@ -135,7 +132,9 @@ def parse_prediction(self, url=None, test_file=None): browser = ms.StatefulBrowser() browser.open(url) - pdb_string = re.findall(r"stringContainingTheWholePdbFile = (.*?);", str(browser.page), re.DOTALL)[0] + pdb_string = re.findall( + r"stringContainingTheWholePdbFile = (.*?);", str(browser.page), re.DOTALL + )[0] structure = parser.get_structure("pdb", io.StringIO(pdb_string)) model = structure[0] @@ -167,8 +166,8 @@ def run(self): log.info("Running ScanNet") log.info(f"Will try {self.tries} times waiting {self.wait}s between tries") - # submitted_url = self.submit() - # prediction_url = self.retrieve_prediction_link(url=result_url) - prediction_dict = self.parse_prediction(url=result_url) + submitted_url = self.submit() + prediction_url = self.retrieve_prediction_link(url=submitted_url) + prediction_dict = self.parse_prediction(url=prediction_url) return prediction_dict diff --git a/src/cport/modules/utils.py b/src/cport/modules/utils.py index 14501ca..923293d 100644 --- a/src/cport/modules/utils.py +++ b/src/cport/modules/utils.py @@ -233,7 +233,7 @@ def get_residue_range(result_dic): active_reslist += [x for x in result_dic[pred]["active"]] reslist = passive_reslist + active_reslist - absolute_range = list(range(min(reslist), max(reslist)+1)) + absolute_range = list(range(min(reslist), max(reslist) + 1)) return absolute_range