Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python-src/fastpdb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def read(file):
else:
if not is_text(file):
raise TypeError("A file opened in 'text' mode is required")
pdb_file._pdb_file = RustPDBFile(file.read().splitlines())
pdb_file._pdb_file = RustPDBFile([s.ljust(80) for s in file.read().splitlines()])

# Synchronize with PDB file representation in Rust
pdb_file.lines = pdb_file._pdb_file.lines
Expand Down
12 changes: 11 additions & 1 deletion tests/test_fastpdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,14 @@ def test_inferred_elements(tmp_path):
guessed_pdb_file = fastpdb.PDBFile.read(temp)
atoms_guessed_elements = guessed_pdb_file.get_structure()

assert atoms_guessed_elements.element.tolist() == atoms.element.tolist()
assert atoms_guessed_elements.element.tolist() == atoms.element.tolist()


def test_non_80_char_columns():
with open(DATA_PATH / "1l2y.pdb") as f:
lines = list(map(lambda s: s.rstrip(), f.readlines()))

pdb_file = fastpdb.PDBFile.read(StringIO(str.join("\n", lines)))
atoms = pdb_file.get_structure()

assert atoms is not None
Loading