Skip to content

Commit

Permalink
moved the temp_fasta_file to file_handlings.py
Browse files Browse the repository at this point in the history
  • Loading branch information
dingquanyu committed Mar 8, 2024
1 parent 4b1fcff commit 167e7f3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
12 changes: 1 addition & 11 deletions alphapulldown/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import tempfile
import os
import subprocess
import contextlib
import numpy as np
from alphafold.data.tools import jackhmmer
from alphafold.data import parsers
Expand All @@ -19,16 +18,7 @@
from colabfold.batch import unserialize_msa, get_msa_and_templates, msa_to_str, build_monomer_feature
from alphapulldown.multimeric_template_utils import (extract_multimeric_template_features_for_single_chain,
prepare_multimeric_template_meta_info)


@contextlib.contextmanager
def temp_fasta_file(sequence_str):
"""function that create temp file"""
with tempfile.NamedTemporaryFile("w", suffix=".fasta") as fasta_file:
fasta_file.write(sequence_str)
fasta_file.seek(0)
yield fasta_file.name

from alphapulldown.utils.file_handling_utils import temp_fasta_file

class MonomericObject:
"""
Expand Down
11 changes: 11 additions & 0 deletions alphapulldown/utils/file_handlings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
import os
from absl import logging
import csv
import contextlib

@contextlib.contextmanager
def temp_fasta_file(sequence_str):
"""function that create temp file"""
with tempfile.NamedTemporaryFile("w", suffix=".fasta") as fasta_file:
fasta_file.write(sequence_str)
fasta_file.seek(0)
yield fasta_file.name


def parse_csv_file(csv_path, fasta_paths, mmt_dir):
"""
csv_path (str): Path to the text file with descriptions
Expand Down

0 comments on commit 167e7f3

Please sign in to comment.