Skip to content

Commit

Permalink
Changes in tests as per new input format
Browse files Browse the repository at this point in the history
  • Loading branch information
samriddhi99 committed Aug 23, 2023
1 parent 1d6921d commit 9a32ac9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 2 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ def blat_for_tests(dat):
blat_url = f"https://genome.ucsc.edu/cgi-bin/hgBlat?userSeq={seq}&type={type_}&db={database}&output=json"
response = requests.get(blat_url)
blat_output = response.json()
print(blat_output)
hsp = blat_output["blat"][0]
if "fix" in hsp[13]:
hsp = blat_output["blat"][1]
Expand Down Expand Up @@ -70,7 +69,7 @@ def full_mapping(request):
scores_path = f"{data_file_path}scores-{(request.param)[11:]}"
scores_csv = open(scores_path)
with open(scoreset_path) as scoreset:
mave_dat,scores = metadata_obtain(scoreset,scores_csv)
mave_dat, scores = metadata_obtain(scoreset, scores_csv)
mave_blat = blat_for_tests(mave_dat)
mappings_dict = main(mave_blat, mave_dat)
vrs_mapped = vrs_mapping(mave_dat, mappings_dict, mave_blat, scores)
Expand All @@ -83,7 +82,7 @@ def obtain_transcripts(request):
scores_path = f"{data_file_path}scores-{(request.param)[11:]}"
scores_csv = open(scores_path)
with open(scoreset_path) as scoreset:
mave_dat,scores = metadata_obtain(scoreset,scores_csv)
mave_dat, scores = metadata_obtain(scoreset, scores_csv)
mave_blat = blat_for_tests(mave_dat)
mappings_dict = main(mave_blat, mave_dat)
return mappings_dict
9 changes: 6 additions & 3 deletions tests/test_for_invalid_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,18 @@ def test_for_scoreset_if_blat_successful(self):
The mapping raises an Exception"""

scoreset = open(f"{data_file_path}urn:mavedb:00000010-a-1", "r")
scores_csv = open(f"{data_file_path}scores-00000010-a-1")
with pytest.raises(Exception):
main_map(scoreset)
main_map(scoreset, scores_csv)

def test_for_scoreset_if_blat_not_successful(self):
"""Test to check for non human scoreset where BLAT Alignment is not successful, and gives no output.
The mapping raises a ValueError"""

scoreset = open(f"{data_file_path}urn:mavedb:00000004-a-1", "r")
scores_csv = open(f"{data_file_path}scores-00000004-a-1")
with pytest.raises(ValueError):
main_map(scoreset)
main_map(scoreset, scores_csv)


class TestForUnsuccessfulMappingScoresets:
Expand All @@ -34,5 +36,6 @@ def test_for_no_transcripts_found(self):
"""Testing for a scoreset for which transcripts could not be found"""
# TODO: create test for 53
scoreset = open(f"{data_file_path}urn:mavedb:00000097-c-1", "r")
scores_csv = open(f"{data_file_path}scores-00000097-c-1")
with pytest.raises(Exception):
main_map(scoreset)
main_map(scoreset, scores_csv)

0 comments on commit 9a32ac9

Please sign in to comment.