Skip to content

Commit

Permalink
Merge pull request #16 from jamaliki/main-pr
Browse files Browse the repository at this point in the history
Fix hmmsearch
  • Loading branch information
jamaliki committed Jan 31, 2023
2 parents a5c1ce6 + 05e8364 commit 9fbccba
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion install_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ then
exit 1;
fi

conda install -y pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch
conda install -y pytorch torchvision torchaudio cudatoolkit=11.7 -c pytorch

if [ "${torch_home_path}" ]
then
Expand Down
17 changes: 8 additions & 9 deletions model_angelo/apps/hmm_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,9 @@ def main(parsed_args):
os.makedirs(parsed_args.output_dir, exist_ok=True)

pruned_hmms = [k for k in hmms if k[1].alphabet == alphabet]
with pyhmmer.easel.SequenceFile(
parsed_args.fasta_path, alphabet=alphabet, digital=True
) as sf:
digital_sequences = list(sf)
print(digital_sequences[0])

with pyhmmer.easel.SequenceFile(parsed_args.fasta_path, alphabet=alphabet, digital=True) as sf:
digital_sequences = sf.read_block()

pipeline = pyhmmer.plan7.Pipeline(
alphabet,
Expand All @@ -158,14 +156,15 @@ def main(parsed_args):
T=parsed_args.T,
)
for (name, hmm) in tqdm.tqdm(pruned_hmms):
hits = pipeline.search_hmm(hmm, digital_sequences)

try:
hits = pipeline.search_hmm(hmm, digital_sequences)
except Exception as e:
print(f"Chain {name} failed")
continue
if parsed_args.pipeline_control:
abort_if_relion_abort(parsed_args.output_dir)

with open(os.path.join(parsed_args.output_dir, f"{name}.hhr"), "wb") as f:
hits.write(f)

try:
msa = hits.to_msa(alphabet)
with open(os.path.join(parsed_args.output_dir, f"{name}.a2m"), "wb") as f:
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ matplotlib
mrcfile
pandas
fair-esm
pyhmmer
loguru
pyhmmer >= 0.7.1
loguru
7 changes: 7 additions & 0 deletions todos.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Todo's

- [ ] Proper error catching for shape errors, issues with FASTA files, etc
- [ ] Test fully if the poly-A works. Extend to proteins perhaps?
- [ ] Refinement program
- [ ] Do not run segmentation on masked out areas
- [ ] Switch poly-A nucleotide to poly-U (or any pyrimidine)

0 comments on commit 9fbccba

Please sign in to comment.