dauparas / LigandMPNN

MIT License
236 stars 47 forks source link

If redesigned_residues_multi is supplied, the list of residues to redesign in not correct #9

Open oteri opened 8 months ago

oteri commented 8 months ago

Hello, thank you for the hard work you have been doing. I think I spotted a bug at this line: https://github.com/dauparas/LigandMPNN/blob/b16141460dd3d30b5ae093528fbf8eb2aaa11cf4/run.py#L107

I think, after the files is loaded, the list of residues must be split like it is done at line 109.

This is how I fixed the bug ( don't know if it is right, though):

    if args.redesigned_residues_multi:
        with open(args.redesigned_residues_multi, "r") as fh:
            redesigned_residues_multi = json.load(fh)
            redesigned_residues_multi = { pdb:redesigned_residues.split() for pdb,redesigned_residues in redesigned_residues_multi.items() }

Thank you again

geraseva commented 6 months ago

Same problem

geraseva commented 6 months ago

This is how I fixed the bug ( don't know if it is right, though):

    if args.redesigned_residues_multi:
        with open(args.redesigned_residues_multi, "r") as fh:
            redesigned_residues_multi = json.load(fh)
            redesigned_residues_multi = { pdb:redesigned_residues.split() for pdb,redesigned_residues in redesigned_residues_multi.items() }

Your fix worked for me, thank you!

joel-chubb commented 5 months ago

This is how I fixed the bug ( don't know if it is right, though):

    if args.redesigned_residues_multi:
        with open(args.redesigned_residues_multi, "r") as fh:
            redesigned_residues_multi = json.load(fh)
            redesigned_residues_multi = { pdb:redesigned_residues.split() for pdb,redesigned_residues in redesigned_residues_multi.items() }

This fixed also worked for me, thanks.

annie393 commented 3 months ago

In run.py, the residues to be fixed are defined as at line 193 and line 244:

# line 193
fixed_residues = fixed_residues_multi[os.path.basename(pdb).replace('.pdb', '')]
# line 244
fixed_positions = torch.tensor(
            [int(item not in fixed_residues) for item in encoded_residues],
            device=device,
        )

with input in the example as: --fixed_residues "C1 C2 C3 C4 C5 C6 C7 C8 C9 C10"

In that case, if C72 is included in fixed_residues, then C7 is included in fixed_residues. Maybe a line should be added after line 193: fixed_residues = fixed_residues.split(' ')

I am not sure whether this will be helpful for this problem.