Skip to content

Commit a8552a4

Browse files
roccomorettinscorley
authored andcommitted
fix: Be more robust to nulls in a3m files.
The MMseqs2 server can return .a3m files with a null character at the end of the file. This currently messes up parsing. Strip this character out of the file, as it has no semantic meaning.
1 parent ec0942f commit a8552a4

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/atomworks/ml/transforms/msa/_msa_loading_utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ def parse_a3m(
163163
fstream = remove_header_from_msa_file(open_file(filename))
164164

165165
for index, line in enumerate(fstream):
166+
line = line.replace('\x00','') # Files from the mmseq server may have stray null characters
167+
if len(line) == 0:
168+
continue
166169
# Extract taxonomy ID from the header line, but don't process like the rest of the MSA
167170
if line[0] == ">":
168171
if index == 0:

0 commit comments

Comments
 (0)