Commit 16e0082f authored by Gustaf Ahdritz's avatar Gustaf Ahdritz
Browse files

Fix FASTA parsing bug in inference script, add option to save outputs

parent 9f558178
...@@ -78,10 +78,10 @@ def main(args): ...@@ -78,10 +78,10 @@ def main(args):
# Gather input sequences # Gather input sequences
with open(args.fasta_path, "r") as fp: with open(args.fasta_path, "r") as fp:
lines = [l.strip() for l in fp.readlines()] data = fp.read()
lines = [l.replace('\n', '') for l in data.split(">")]
tags, seqs = lines[::2], lines[1::2] tags, seqs = lines[::2], lines[1::2]
tags = [l[1:] for l in tags]
for tag, seq in zip(tags, seqs): for tag, seq in zip(tags, seqs):
fasta_path = os.path.join(args.output_dir, "tmp.fasta") fasta_path = os.path.join(args.output_dir, "tmp.fasta")
...@@ -179,6 +179,13 @@ def main(args): ...@@ -179,6 +179,13 @@ def main(args):
with open(relaxed_output_path, 'w') as f: with open(relaxed_output_path, 'w') as f:
f.write(relaxed_pdb_str) f.write(relaxed_pdb_str)
if(args.save_outputs):
output_dict_path = os.path.join(
args.output_dir, f'{tag}_{args.model_name}_output_dict.pkl'
)
with open(output_dict_path, "wb") as fp:
pickle.dump(out, fp, protocol=pickle.HIGHEST_PROTOCOL)
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
...@@ -213,6 +220,10 @@ if __name__ == "__main__": ...@@ -213,6 +220,10 @@ if __name__ == "__main__":
automatically according to the model name from automatically according to the model name from
openfold/resources/params""" openfold/resources/params"""
) )
parser.add_argument(
"--save_outputs", type=bool, default=False,
help="Whether to save all model outputs, including embeddings, etc."
)
parser.add_argument( parser.add_argument(
"--cpus", type=int, default=4, "--cpus", type=int, default=4,
help="""Number of CPUs with which to run alignment tools""" help="""Number of CPUs with which to run alignment tools"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment