Exemple #1
0
    def __contains__(self, res):
        """True if the given residue is in any of the mapped fragments.

        @type res: L{Residue}
        """
        return (res in self.fd)

    def __getitem__(self, res):
        """
        @type res: L{Residue}

        @return: fragment classification
        @rtype: L{Fragment}
        """
        return self.fd[res]


if __name__ == "__main__":

    import sys

    p = PDBParser()
    s = p.get_structure("X", sys.argv[1])
    m = s[0]
    fm = FragmentMapper(m, 10, 5, "levitt_data")

    for r in Selection.unfold_entities(m, "R"):
        print("%s:" % r)
        if r in fm:
            print(fm[r])
Exemple #2
0
    def _test_dist(self, c, n):
        """Return 1 if distance between atoms<radius (PRIVATE)."""
        if (c-n)<self.radius:
            return 1
        else:
            return 0


if __name__=="__main__":
    import sys
    from SAP.Bio.PDB.PDBParser import PDBParser

    p=PDBParser(PERMISSIVE=True)

    s=p.get_structure("scr", sys.argv[1])

    ppb=PPBuilder()

    print("C-N")
    for pp in ppb.build_peptides(s):
        print(pp.get_sequence())
    for pp in ppb.build_peptides(s[0]):
        print(pp.get_sequence())
    for pp in ppb.build_peptides(s[0]["A"]):
        print(pp.get_sequence())

    for pp in ppb.build_peptides(s):
        for phi, psi in pp.get_phi_psi_list():
            print("%f %f" % (phi, psi))
Exemple #3
0
                    fp.write("TER\n")
            if model_flag and model_residues_written:
                fp.write("ENDMDL\n")
            if write_end:
                fp.write('END\n')
        if close_file:
            fp.close()

if __name__=="__main__":

    from SAP.Bio.PDB.PDBParser import PDBParser

    import sys

    p=PDBParser(PERMISSIVE=True)

    s=p.get_structure("test", sys.argv[1])

    io=PDBIO()
    io.set_structure(s)
    io.save("out1.pdb")

    with open("out2.pdb", "w") as fp:
        s1=p.get_structure("test1", sys.argv[1])
        s2=p.get_structure("test2", sys.argv[2])
        io=PDBIO(1)
        io.set_structure(s1)
        io.save(fp)
        io.set_structure(s2)
        io.save(fp, write_end=1)
Exemple #4
0
    def accept_atom(self, atom):
        # atoms - get rid of hydrogens
        name=atom.get_id()
        if _hydrogen.match(name):
            return 0
        else:
            return 1


def extract(structure, chain_id, start, end, filename):
    """
    Write out selected portion to filename.
    """
    sel=ChainSelector(chain_id, start, end)
    io=PDBIO()
    io.set_structure(structure)
    io.save(filename, sel)


if __name__=="__main__":

    from SAP.Bio.PDB.PDBParser import PDBParser

    import sys

    p=PDBParser()
    s=p.get_structure("scr", sys.argv[1])

    extract(s, " ", 1, 100, "out.pdb")
Exemple #5
0
    def __contains__(self, res):
        """True if the given residue is in any of the mapped fragments.

        @type res: L{Residue}
        """
        return (res in self.fd)

    def __getitem__(self, res):
        """
        @type res: L{Residue}

        @return: fragment classification
        @rtype: L{Fragment}
        """
        return self.fd[res]


if __name__=="__main__":

    import sys

    p = PDBParser()
    s = p.get_structure("X", sys.argv[1])
    m = s[0]
    fm = FragmentMapper(m, 10, 5, "levitt_data")

    for r in Selection.unfold_entities(m, "R"):
        print("%s:" % r)
        if r in fm:
            print(fm[r])
Exemple #6
0
                chain_id=r1.get_parent().get_id()
                # Fill the 3 data structures
                fs_map[(chain_id, res_id)]=fs
                fs_list.append((r1, fs))
                fs_keys.append((chain_id, res_id))
                # Add to xtra
                r1.xtra['EXP_CN']=fs
        AbstractPropertyMap.__init__(self, fs_map, fs_keys, fs_list)


if __name__=="__main__":

    import sys

    p=PDBParser()
    s=p.get_structure('X', sys.argv[1])
    model=s[0]

    # Neighbor sphere radius
    RADIUS=13.0
    OFFSET=0

    hse=HSExposureCA(model, radius=RADIUS, offset=OFFSET)
    for l in hse:
        print(l)
    print("")

    hse=HSExposureCB(model, radius=RADIUS, offset=OFFSET)
    for l in hse:
        print(l)
    print("")
Exemple #7
0
            if model_flag and model_residues_written:
                fp.write("ENDMDL\n")
            if write_end:
                fp.write('END\n')
        if close_file:
            fp.close()


if __name__ == "__main__":

    from SAP.Bio.PDB.PDBParser import PDBParser

    import sys

    p = PDBParser(PERMISSIVE=True)

    s = p.get_structure("test", sys.argv[1])

    io = PDBIO()
    io.set_structure(s)
    io.save("out1.pdb")

    with open("out2.pdb", "w") as fp:
        s1 = p.get_structure("test1", sys.argv[1])
        s2 = p.get_structure("test2", sys.argv[2])
        io = PDBIO(1)
        io.set_structure(s1)
        io.save(fp)
        io.set_structure(s2)
        io.save(fp, write_end=1)