Skip to content

Fixed positions JSONL only loads last entry #133

@ssiddhantsharma

Description

@ssiddhantsharma

When using --fixed_positions_jsonl with multiple structures, it only keeps the last entry and throws KeyError for other structures.

Line ~108 in protein_mpnn_run.py:

for json_str in json_list:
    fixed_positions_dict = json.loads(json_str)  # overwrites instead of updates

Suggested fix:

fixed_positions_dict = {}
for json_str in json_list:
    fixed_positions_dict.update(json.loads(json_str))

What I did to remove errors: Convert JSONL to single JSON filw

import json
fixed_positions_dict = {}
with open('fixed_positions.jsonl', 'r') as f:
    for line in f:
        if line.strip():
            data = json.loads(line)
            fixed_positions_dict.update(data) 

# Write as single JSON file that ProteinMPNN can handle correctly
with open('fixed_positions.json', 'w') as f:
    json.dump(fixed_positions_dict, f)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions