Esempio n. 1
0
 def test_from_url(self):
     """Check parser can fetch a record from its PDB ID."""
     parser = MMTFParser()
     with warnings.catch_warnings():
         warnings.simplefilter('ignore', PDBConstructionWarning)
         struct = parser.get_structure_from_url("4ZHL")
     atoms = [x for x in struct.get_atoms()]
     self.assertEqual(len(atoms), 2080)
Esempio n. 2
0
 def test_from_url(self):
     """Check parser can fetch a record from its PDB ID."""
     parser = MMTFParser()
     with warnings.catch_warnings():
         warnings.simplefilter('ignore', PDBConstructionWarning)
         struct = parser.get_structure_from_url("4ZHL")
     atoms = [x for x in struct.get_atoms()]
     self.assertEqual(len(atoms), 2080)
Esempio n. 3
0
def downloadUsingMmtf(pdbId, fnameOut, maxNumberOfChains=MAX_NUMBER_OF_CHAINS):
    print("downloadUsingMmtf")
    try:
        parser = MMTFParser()
        struct = parser.get_structure_from_url(pdbId)
        if not 0 in struct:
            return False
        if len(struct[0]) > maxNumberOfChains:
            raise NoValidPDBFile(
                "The maximun number of allowed chains is %d (%d) for %s" %
                (maxNumberOfChains, len(struct[0]), pdbId))
        writter = PDBIO()
        writter.set_structure(struct)
        writter.save(fnameOut)
        return True
    except (Exception, ValueError, HTTPError) as e:
        print(e)
        if isinstance(e, NoValidPDBFile):
            raise e
        return False
Esempio n. 4
0
from Bio.PDB import Selection
from Bio.PDB import NeighborSearch
from Bio.PDB.DSSP import DSSP
from Bio.PDB.NACCESS import *
from Bio.PDB import PDBIO

thr = 6
pdb_list = open('../437_dimers_list.merge.tsv')
for pdb_chi_chj in pdb_list:
    print(pdb_chi_chj)
    x = pdb_chi_chj.rstrip().split("\t")
    pdb = x[0]
    chi = x[1]
    chj = x[2]
    p = MMTFParser()
    structure = MMTFParser.get_structure_from_url(pdb)

    s = structure[0]

    atom_list = [atom for atom in s[chi].get_atoms() if atom.name != 'H']
    atom_list.extend([atom for atom in s[chj].get_atoms() if atom.name != 'H'])
    RRI = NeighborSearch(atom_list).search_all(thr, 'A')
    MAP = {}
    for rri in RRI:
        if (rri[0].get_parent().get_id()[0][0:2] == "H_"
                or rri[0].get_parent().get_id()[0] == 'W'):
            #print(rri[0].get_parent().get_id()[0][0:2])
            continue
        if (rri[1].get_parent().get_id()[0][0:2] == "H_"
                or rri[1].get_parent().get_id()[0] == 'W'):
            #print(rri[1].get_parent().get_id()[0][0:2])
Esempio n. 5
0
from Bio.PDB.mmtf import MMTFParser
# read structure from file
structure = MMTFParser.get_structure("PDB/4CUP.mmtf")
# read structure from PDB
structure = MMTFParser.get_structure_from_url("4CUP")