Skip to content

Commit

Permalink
num of output columns as a fixed variable
Browse files Browse the repository at this point in the history
  • Loading branch information
dmx2 committed Jun 10, 2024
1 parent 3457b8e commit 5c0875f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pepmatch/matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
from .hamming import hamming


NUM_OUTPUT_COLUMNS = 14
VALID_OUTPUT_FORMATS = ['dataframe', 'csv', 'tsv', 'xlsx', 'json', 'html']


class Matcher:
"""
Object class that class takes in a query (either FASTA file or Python list)
Expand Down Expand Up @@ -321,7 +323,7 @@ def _process_exact_matches(

all_matches = []
if not matches:
all_matches.append((peptide,) + (np.nan,) * 13)
all_matches.append((peptide,) + (np.nan,) * NUM_OUTPUT_COLUMNS)
else:
for match in matches:
protein_number = (match - (match % 1000000)) // 1000000
Expand Down Expand Up @@ -629,7 +631,7 @@ def _process_mismatch_matches(

all_matches = []
if not matches:
all_matches.append((peptide,) + (np.nan,) * 13)
all_matches.append((peptide,) + (np.nan,) * NUM_OUTPUT_COLUMNS)
else:
for match in matches:
metadata_key = (match[2] - (match[2] % 1000000)) // 1000000
Expand Down Expand Up @@ -760,7 +762,7 @@ def discontinuous_search(self) -> list:

if not match:
all_matches.append(
(', '.join([x[0] + str(x[1]) for x in dis_epitope]),) + (np.nan,) * 14
(', '.join([x[0] + str(x[1]) for x in dis_epitope]),) + (np.nan,) * NUM_OUTPUT_COLUMNS
)

return all_matches
Expand Down

0 comments on commit 5c0875f

Please sign in to comment.