Skip to content

Commit

Permalink
Merge pull request #279 from susannasiebert/reponse_text
Browse files Browse the repository at this point in the history
respone_text from IEDB is byte not str - handle accordingly
  • Loading branch information
susannasiebert authored Mar 2, 2017
2 parents a05ccb7 + 777db63 commit 7a019d3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions pvacseq/lib/call_iedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
from subprocess import run, PIPE

def filter_response(response_text):
lines = response_text.split("\n")
lines = response_text.splitlines()
remaining_lines = lines.copy()
for line in lines:
if line.startswith("allele"):
return "\n".join(remaining_lines)
if line.startswith(b"allele"):
return b"\n".join(remaining_lines)
else:
remaining_lines.pop(0)

Expand Down
8 changes: 4 additions & 4 deletions tests/test_call_iedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ class FilterResponseTests(CallIEDBTests):
def test_filter_response_ok(self):
unfiltered_file = os.path.join(self.test_data_dir, 'unfiltered.txt')
filtered_file = os.path.join(self.test_data_dir, 'filtered.txt')
with open(unfiltered_file, 'r') as f:
unfiltered_file_contents = f.read()
with open(filtered_file, 'r') as f:
filtered_file_contents = f.read()
with open(unfiltered_file, 'rb') as f:
unfiltered_file_contents = f.read().rstrip()
with open(filtered_file, 'rb') as f:
filtered_file_contents = f.read().rstrip()
filtered_response = pvacseq.lib.call_iedb.filter_response(unfiltered_file_contents)
self.assertEqual(filtered_response, filtered_file_contents)
filtered_response_on_filtered_file = pvacseq.lib.call_iedb.filter_response(filtered_file_contents)
Expand Down

0 comments on commit 7a019d3

Please sign in to comment.