Skip to content

Commit

Permalink
make chains_to_design and parse_these_chains_only consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
dauparas committed May 7, 2024
1 parent b6a8b5a commit 84614f9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,24 +257,24 @@ python run.py \
```

### 17 --chains_to_design
Specify which chains (e.g. "ABC") need to be redesigned, other chains will be kept fixed. Outputs in seqs/backbones will still have atoms/sequences for the whole input PDB.
Specify which chains (e.g. "A,B,C") need to be redesigned, other chains will be kept fixed. Outputs in seqs/backbones will still have atoms/sequences for the whole input PDB.
```
python run.py \
--model_type "ligand_mpnn" \
--seed 111 \
--pdb_path "./inputs/4GYT.pdb" \
--out_folder "./outputs/chains_to_design" \
--chains_to_design "B"
--chains_to_design "A,B"
```
### 18 --parse_these_chains_only
Parse and design only specified chains (e.g. "ABC"). Outputs will have only specified chains.
Parse and design only specified chains (e.g. "A,B,C"). Outputs will have only specified chains.
```
python run.py \
--model_type "ligand_mpnn" \
--seed 111 \
--pdb_path "./inputs/4GYT.pdb" \
--out_folder "./outputs/parse_these_chains_only" \
--parse_these_chains_only "B"
--parse_these_chains_only "A,B"
```

### 19 --model_type "ligand_mpnn"
Expand Down
17 changes: 12 additions & 5 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,12 @@ def main(args) -> None:
device=device,
)

if len(args.parse_these_chains_only) != 0:
parse_these_chains_only_list = args.parse_these_chains_only.split(",")
else:
parse_these_chains_only_list = []


# loop over PDB paths
for pdb in pdb_paths:
if args.verbose:
Expand All @@ -192,7 +198,7 @@ def main(args) -> None:
protein_dict, backbone, other_atoms, icodes, _ = parse_PDB(
pdb,
device=device,
chains=args.parse_these_chains_only,
chains=parse_these_chains_only_list,
parse_all_atoms=parse_all_atoms_flag,
parse_atoms_with_zero_occupancy=args.parse_atoms_with_zero_occupancy,
)
Expand Down Expand Up @@ -269,10 +275,11 @@ def main(args) -> None:
protein_dict["membrane_per_residue_labels"] = (
args.global_transmembrane_label + 0 * fixed_positions
)
if type(args.chains_to_design) == str:
if len(args.chains_to_design) != 0:
chains_to_design_list = args.chains_to_design.split(",")
else:
chains_to_design_list = protein_dict["chain_letters"]

chain_mask = torch.tensor(
np.array(
[
Expand Down Expand Up @@ -876,15 +883,15 @@ def main(args) -> None:
argparser.add_argument(
"--chains_to_design",
type=str,
default=None,
help="Specify which chains to redesign, all others will be kept fixed.",
default="",
help="Specify which chains to redesign, all others will be kept fixed, 'A,B,C,F'",
)

argparser.add_argument(
"--parse_these_chains_only",
type=str,
default="",
help="Provide chains letters for parsing backbones, 'ABCF'",
help="Provide chains letters for parsing backbones, 'A,B,C,F'",
)

argparser.add_argument(
Expand Down
4 changes: 2 additions & 2 deletions run_examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ python run.py \
--seed 111 \
--pdb_path "./inputs/4GYT.pdb" \
--out_folder "./outputs/chains_to_design" \
--chains_to_design "B"
--chains_to_design "A,B"

#18
python run.py \
--model_type "ligand_mpnn" \
--seed 111 \
--pdb_path "./inputs/4GYT.pdb" \
--out_folder "./outputs/parse_these_chains_only" \
--parse_these_chains_only "B"
--parse_these_chains_only "A,B"

#19
python run.py \
Expand Down

0 comments on commit 84614f9

Please sign in to comment.