コード例 #1
0
def getTheMol(filename):
#    from MolKit.protein import Protein
    from MolKit.pdbParser import PdbParser    
    parser = PdbParser(filename=filename)
    mol = parser.parse()
#    mol.read( filename, PdbParser() )
    return mol    
コード例 #2
0
def test_parseMol_HelixRec():
    from MolKit.pdbParser import PdbParser
    parser = PdbParser('Data/1crn.pdb')
    parser.SetReadOptions('HELIX')
    assert 'HELIX' in parser.pdbRecordParser.keys()
    mols = parser.parse()
    assert parser.recordInfo.has_key('HELIX')
コード例 #3
0
def test_parseHYDBND_3():
    """
    check that HYDBND records are read correctly
    when names start with a space (eg residue name "  A1")
    """
    from MolKit.pdbParser import PdbParser
    parser = PdbParser("Data/bdna_HS.pdb")
    m = parser.parse()[0]
    assert len(m.allAtoms.get(lambda x: hasattr(x, 'hbonds')))==110
コード例 #4
0
def test_parseHYDBND_2():
    """
    """
    from MolKit.pdbParser import PdbParser
    parser = PdbParser("Data/smfx_goodHYDBND.pdb")
    parser.parse()
    mol = parser.mol
    atmsInHBond = mol.allAtoms.get(lambda x: hasattr(x, 'hbonds'))
    hbonds = atmsInHBond.hbonds
    assert len(hbonds) == 21
コード例 #5
0
 def __init__(self, filename, recSpecs):
     PdbParser.__init__(self, filename)
     assert isinstance(recSpecs, AtomRecFieldSpecs)
     self.recSpecs = recSpecs
     # what type of parsing, by column or by index
     self.specType = recSpecs.specType
     self.atomCounter = 0  # what about model??? i think it's ok
     self.residueCounter = 0
     self.HOHCounter = 0
     self.chaincounter = 0
コード例 #6
0
def test_parseSSData_2():
    """ Calling parseSSData after setting the readOption to parse HELIX,
    STRAND, TURN, etc..."""
    from MolKit.pdbParser import PdbParser
    parser = PdbParser('Data/1crn.pdb')
    parser.SetReadOptions('HELIX')
    parser.SetReadOptions('SHEET')
    parser.SetReadOptions('TURN')
    mols = parser.parse()
    assert parser.recordInfo.has_key('HELIX')
    assert parser.recordInfo.has_key('SHEET')
    assert parser.recordInfo.has_key('TURN')
    ssDataForMol = parser.parseSSData(mols[0])
コード例 #7
0
def test_parseFileWrongFormat():
    from MolKit.pdbParser import PdbParser
    parser = PdbParser("Data/fakePDB.pdb")
    mols = parser.parse()
    assert mols is None or len(mols)==0


    parser = PdbParser("Data/hpi1s.mol2")
    mols = parser.parse()
    assert mols is None or len(mols)==0

    from MolKit.mol2Parser import Mol2Parser
    parser = Mol2Parser("Data/1crn.pdb")
    mols=parser.parse()
    assert mols is None or len(mols)==0
コード例 #8
0
def Read(filename, modelsAs='molecules'):
    if not os.path.exists(filename):
         raise AssertionError , "%s does't exist" %filename
    from MolKit.pdbParser import PdbParser, PdbqParser,PdbqsParser,\
            PdbqtParser, PQRParser
    from MolKit.mol2Parser import Mol2Parser
    from MolKit.mmcifParser import MMCIFParser
    ext = string.split(filename, '.')
    if ext[-1]=='pdb':
        parser = PdbParser(filename, modelsAs=modelsAs)

    elif ext[-1]=='pdbq':
        parser = PdbqParser(filename, modelsAs=modelsAs)
    
    elif ext[-1]=='pdbqt':
        parser = PdbqtParser(filename, modelsAs=modelsAs)

    elif ext[-1]=='pdbqs':
        parser = PdbqsParser(filename, modelsAs=modelsAs)

    elif ext[-1]=='pqr':
        parser = PQRParser(filename, modelsAs=modelsAs)

    elif ext[-1]=='mol2':
        parser = Mol2Parser(filename) #??should modelsAs be available for mol2 format??

    elif ext[-1]=='cif':
        parser = MMCIFParser(filename, modelsAs=modelsAs)


    else:
        print "File Format unknown can't parse it"
        return []
    molecules = parser.parse()
    return molecules
コード例 #9
0
def test_parsegetRecords():
    # Test the change made in the lambda function of getRecords method
    from MolKit.pdbParser import PdbParser
    parser = PdbParser("Data/1crn.pdb")
    parser.readFile()
    parser.getKeys()
    
    atmRec = parser.getRecords(parser.allLines,"ATOM")
    assert len(atmRec) == 327
コード例 #10
0
ファイル: __init__.py プロジェクト: 8848/Pymol-script-repo
def Read(filename):
    from MolKit.pdbParser import PdbParser, PdbqParser,PdbqsParser, PQRParser
    from MolKit.mol2Parser import Mol2Parser
    ext = string.split(filename, '.')
    if ext[-1]=='pdb':
        parser = PdbParser(filename)

    elif ext[-1]=='pdbq':
        parser = PdbqParser(filename)
    
    elif ext[-1]=='pdbqs':
        parser = PdbqsParser(filename)

    elif ext[-1]=='pqr':
        parser = PQRParser(filename)

    elif ext[-1]=='mol2':
        parser = Mol2Parser(filename)

    else:
        print "File Format unknown can't parse it"
        return []
    molecules = parser.parse()
    return molecules
コード例 #11
0
def test_parseHYDBND_1():
    """
    """
    from MolKit.pdbParser import PdbParser
    parser = PdbParser("Data/smfx_badHYDBND.pdb")
    parser.PDBtags.remove("HYDBND")
    del parser.pdbRecordParser['HYDBND']
    parser.parse()
    failure = False
    hdbndLines = parser.getRecords(parser.allLines, "HYDBND")
    try:
        parser.parse_PDB_HYDBND(hbndLines)
    except:
        failure = True
    assert failure 
コード例 #12
0
def test_parseSSData():
    from MolKit.pdbParser import PdbParser
    parser = PdbParser('Data/1crn.pdb')
    mols = parser.parse()
    ssDataForMol = parser.parseSSData(mols[0])
コード例 #13
0
def test_parseMol_BasicRec():
    from MolKit.pdbParser import PdbParser
    parser = PdbParser('Data/1crn.pdb')
    mols = parser.parse()