Exemplo n.º 1
0
  def _featurize_complex(self, mol_pdb, protein_pdb):
    """
    Compute Binana fingerprint for complex.
    """
    mol_pdb_file = tempfile.NamedTemporaryFile(suffix="pdb")
    with open(mol_pdb_file.name, "w") as mol_f:
      mol_f.writelines(mol_pdb)
    protein_pdb_file = tempfile.NamedTemporaryFile(suffix="pdb")
    with open(protein_pdb_file.name, "w") as protein_f:
      protein_f.writelines(protein_pdb)

    mol_hyd_file = tempfile.NamedTemporaryFile(suffix="pdb")
    mol_pdbqt_file = tempfile.NamedTemporaryFile(suffix="pdbqt")
    hydrogenate_and_compute_partial_charges(
        mol_pdb_file.name, "pdb", mol_hyd_file.name,
        mol_pdbqt_file.name)

    protein_hyd_file = tempfile.NamedTemporaryFile(suffix="pdb")
    protein_pdbqt_file = tempfile.NamedTemporaryFile(suffix="pdbqt")
    hydrogenate_and_compute_partial_charges(
        protein_pdb_file.name, "pdb", protein_hyd_file.name,
        protein_pdbqt_file.name)

    mol_pdb_obj = PDB()
    mol_pdb_obj.load_from_files(mol_pdb_file.name, mol_pdbqt_file.name)

    protein_pdb_obj = PDB()
    protein_pdb_obj.load_from_files(
        protein_pdb_file.name, protein_pdbqt_file.name)

    features = self.binana.compute_input_vector(mol_pdb_obj, protein_pdb_obj)

    return features
Exemplo n.º 2
0
  def compute_input_vector_from_files(
      self, ligand_pdb_filename, receptor_pdb_filename, line_header):
    """Computes feature vector for ligand-receptor pair.

    Parameters
    ----------
    ligand_pdb_filename: string
      path to ligand's pdb file.
    receptor_pdb_filename: string
      path to receptor pdb file.
    line_header: string
      line separator in PDB files
    """
    # Load receptor and ligand from file.
    receptor = PDB()
    receptor.load_from_files(receptor_pdb_filename, line_header)
    receptor.assign_secondary_structure()
    ligand = PDB()
    ligand.load_from_files(ligand_pdb_filename, line_header)
    self.compute_input_vector(ligand, receptor)
Exemplo n.º 3
0
    def setUp(self):
        """
    Instantiate local copy of Binana object.
    """
        self.binana = Binana()

        ### 3zp9 comes from PDBBind-CN
        _3zp9_protein = PDB()
        _3zp9_protein_pdb = os.path.join(data_dir(), "3zp9_protein_hyd.pdb")
        _3zp9_protein_pdbqt = os.path.join(data_dir(),
                                           "3zp9_protein_hyd.pdbqt")
        _3zp9_protein.load_from_files(_3zp9_protein_pdb, _3zp9_protein_pdbqt)
        # The ligand is also specified by pdbbind
        _3zp9_ligand = PDB()
        _3zp9_ligand_pdb = os.path.join(data_dir(), "3zp9_ligand_hyd.pdb")
        _3zp9_ligand_pdbqt = os.path.join(data_dir(), "3zp9_ligand_hyd.pdbqt")
        _3zp9_ligand.load_from_files(_3zp9_ligand_pdb, _3zp9_ligand_pdbqt)

        ### 3bwf comes from PDBBind-CN
        _3bwf_protein = PDB()
        _3bwf_protein_pdb = os.path.join(data_dir(), "3bwf_protein_hyd.pdb")
        _3bwf_protein_pdbqt = os.path.join(data_dir(),
                                           "3bwf_protein_hyd.pdbqt")
        _3bwf_protein.load_from_files(_3bwf_protein_pdb, _3bwf_protein_pdbqt)
        # The ligand is also specified by pdbbind
        _3bwf_ligand = PDB()
        _3bwf_ligand_pdb = os.path.join(data_dir(), "3bwf_ligand_hyd.pdb")
        _3bwf_ligand_pdbqt = os.path.join(data_dir(), "3bwf_ligand_hyd.pdbqt")
        _3bwf_ligand.load_from_files(_3bwf_ligand_pdb, _3bwf_ligand_pdbqt)

        self.test_cases = [("3bwf", _3bwf_protein, _3bwf_ligand),
                           ("3zp9", _3zp9_protein, _3zp9_ligand)]
Exemplo n.º 4
0
  def setUp(self):
    """
    Instantiate local copy of Binana object.
    """
    self.binana = Binana()

    ### 3zp9 comes from PDBBind-CN
    _3zp9_protein = PDB()
    _3zp9_protein_pdb = os.path.join(data_dir(), "3zp9_protein_hyd.pdb")
    _3zp9_protein_pdbqt = os.path.join(data_dir(), "3zp9_protein_hyd.pdbqt")
    _3zp9_protein.load_from_files(_3zp9_protein_pdb, _3zp9_protein_pdbqt)
    # The ligand is also specified by pdbbind
    _3zp9_ligand = PDB()
    _3zp9_ligand_pdb = os.path.join(data_dir(), "3zp9_ligand_hyd.pdb")
    _3zp9_ligand_pdbqt = os.path.join(data_dir(), "3zp9_ligand_hyd.pdbqt")
    _3zp9_ligand.load_from_files(_3zp9_ligand_pdb, _3zp9_ligand_pdbqt)

    ### 3bwf comes from PDBBind-CN
    _3bwf_protein = PDB()
    _3bwf_protein_pdb = os.path.join(data_dir(), "3bwf_protein_hyd.pdb")
    _3bwf_protein_pdbqt = os.path.join(data_dir(), "3bwf_protein_hyd.pdbqt")
    _3bwf_protein.load_from_files(_3bwf_protein_pdb, _3bwf_protein_pdbqt)
    # The ligand is also specified by pdbbind
    _3bwf_ligand = PDB()
    _3bwf_ligand_pdb = os.path.join(data_dir(), "3bwf_ligand_hyd.pdb")
    _3bwf_ligand_pdbqt = os.path.join(data_dir(), "3bwf_ligand_hyd.pdbqt")
    _3bwf_ligand.load_from_files(_3bwf_ligand_pdb, _3bwf_ligand_pdbqt)

    self.test_cases = [("3bwf", _3bwf_protein, _3bwf_ligand),
                       ("3zp9", _3zp9_protein, _3zp9_ligand)]