Skip to content

Commit

Permalink
test case for non existing unitprot
Browse files Browse the repository at this point in the history
  • Loading branch information
thorstenwagner committed Sep 29, 2023
1 parent 4d45b32 commit 71ecec6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ options:

You can provide the optional argument `--pdbpath` if you want to use an experimental PDB, otherwise it will instead download the alphafold predicted PDB.

For example, to reproduce [Figure 3D](https://www.science.org/doi/10.1126/science.adg7492#F3) (the middle one) and the generate the PDB shown in [Figure 3E](https://www.science.org/doi/10.1126/science.adg7492#F3) do:
For example, to reproduce [Figure 3D](https://www.science.org/doi/10.1126/science.adg7492#F3) (the middle one) and generates the PDB shown in [Figure 3E](https://www.science.org/doi/10.1126/science.adg7492#F3) do:

```
wget https://files.rcsb.org/download/7UPI.pdb
Expand Down
6 changes: 5 additions & 1 deletion missense/missense.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ def create_parser() -> argparse.ArgumentParser:
parser.add_argument(
"--tsv",
type=str,
help="You can provide the path to the tsv file if you want to skip the downloading part.",
help="You can provide the path to the tsv file if you want to skip the download.",
default=None
)

Expand Down Expand Up @@ -579,6 +579,10 @@ def _run(uniprot_id: str,

pos_to_val = get_data_tuple(uniprot_id=uniprot_id, tsv_path=tsvpath)

if len(pos_to_val) == 0:
print(f"Could not find any data in the AlphaMissense database for uniprot id {uniprot_id}")
sys.exit(1)

out_fig_pth = os.path.join(output_path, f"{uniprot_id}.pdf")
img_raw_data = make_and_save_plot(pos_to_val, out_fig_pth, maxacid)
print(f"Save plot to {out_fig_pth}")
Expand Down
14 changes: 14 additions & 0 deletions tests/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@ def test_pdf_and_and_are_generated(self):
self.assertEqual(True, os.path.exists(os.path.join(tmpdirname,"Q9UQ13.pdf")))
self.assertEqual(True, os.path.exists(os.path.join(tmpdirname, "Q9UQ13-edit.pdb")))

def test_pdf_and_and_are_generated_non_existing_uniprot(self):

shutil.copyfile(os.path.join(os.path.dirname(__file__), "../resources/tests/Q9UQ13/alpha.tsv"),
os.path.join(tempfile.gettempdir(), "alpha.tsv"))

with tempfile.TemporaryDirectory() as tmpdirname:
with self.assertRaises(SystemExit):
ms._run(uniprot_id="Q9UQ13234234",
output_path=tmpdirname,
maxacid=200,
pdbpath=None,
tsvpath=None
)

def test_pdf_and_and_are_generated_tsv_by_path(self):

with tempfile.TemporaryDirectory() as tmpdirname:
Expand Down

0 comments on commit 71ecec6

Please sign in to comment.