예제 #1
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)
예제 #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)
예제 #3
0
    def _featurize_complex(self, mol_pdb, protein_pdb):
        """
    Compute Binana fingerprint for complex.
    """
        print("In _featurize_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)
        print("Written temp pdb files")

        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)
        print("Hydrogenated mol file")

        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)
        print("Hydrogenated protein file")

        mol_pdb_obj = PDB()
        mol_pdb_obj.load_from_files(mol_pdb_file.name, mol_pdbqt_file.name)
        print("Loaded mol pdb object")

        protein_pdb_obj = PDB()
        protein_pdb_obj.load_from_files(protein_pdb_file.name,
                                        protein_pdbqt_file.name)
        print("Loaded protein pdb object")

        features = self.binana.compute_input_vector(mol_pdb_obj,
                                                    protein_pdb_obj)
        print("Computed binana features.")

        return features
예제 #4
0
    def _featurize_complex(self, mol_pdb, protein_pdb):
        """
    Compute Binana fingerprint for complex.
    """
        print("In _featurize_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)
        print("Written temp pdb files")

        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)
        print("Hydrogenated mol file")

        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
        )
        print("Hydrogenated protein file")

        mol_pdb_obj = PDB()
        mol_pdb_obj.load_from_files(mol_pdb_file.name, mol_pdbqt_file.name)
        print("Loaded mol pdb object")

        protein_pdb_obj = PDB()
        protein_pdb_obj.load_from_files(protein_pdb_file.name, protein_pdbqt_file.name)
        print("Loaded protein pdb object")

        features = self.binana.compute_input_vector(mol_pdb_obj, protein_pdb_obj)
        print("Computed binana features.")

        return features
예제 #5
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)]
예제 #6
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)]