コード例 #1
0
    def test_makestructure_with_reference(self):
        tz2_parm7 = cpptraj_test_dir + '/tz2.parm7'
        ref_rst7 = cpptraj_test_dir + '/tz2.rst7'
        trajin_rst7 = cpptraj_test_dir + '/Test_MakeStructure/pp2.rst7.save'

        # cpptraj
        command = """
        parm {}
        reference {}
        trajin {}
        
        makestructure "ref:1-13:tz2.rst7"
        rmsd reference 
        createcrd mycrd
        """.format(tz2_parm7, ref_rst7, trajin_rst7)
        state = pt.load_cpptraj_state(command)
        state.run()
        cpp_traj = state.data['mycrd']

        # pytraj
        traj = pt.load(trajin_rst7, top=tz2_parm7)
        ref = pt.load(ref_rst7, top=tz2_parm7)
        pt.make_structure(traj, "ref:1-13:1-13", ref=ref)
        pt.rmsd(traj, ref=ref)
        aa_eq(traj.xyz, cpp_traj.xyz)
コード例 #2
0
def build_protein(seq, command=None):
    '''

    Parameters
    ----------
    seq : protein sequence
    command : None, str or list of str
        pytraj command for building secondary structure for a given residue range
        if None, build linear sequence

    Requires
    --------
    tleap, pytraj and ParmEd

    Examples
    --------
    >>> # Ala10
    >>> seq = "ALA ALA ALA ALA ALA ALA ALA ALA ALA ALA"
    >>> parm = build_protein(seq, ['alpha:1-10'])
    >>> # visualize in Jupyter notebook
    >>> parm.visualize()
    >>> # save to pdb file
    >>> parm.save("new.pdb")

    Returns
    -------
    parmed.Structure
    '''
    pdb_fn = 'seq.pdb'
    leap_command = """
    source leaprc.protein.ff14SB
    x = sequence{%s}
    savepdb x %s
    """ % (seq, pdb_fn)

    if command is None:
        command = ''

    command_str = ' '.join(command) if isinstance(command, list) else command

    amberhome = os.getenv('AMBERHOME', '')
    if os.path.exists(amberhome + '/dat/leap/cmd/leaprc.ff14SB'):
        leap_command = leap_command.replace('protein.ff14SB', 'ff14SB')

    with tempfolder():
        pdb_out = 'pdb_out.pdb'
        leap.run(leap_command)
        traj = pytraj.load(pdb_fn)
        pytraj.make_structure(traj, command_str)
        traj.save(pdb_out, overwrite=True)
        return parmed.load_file(pdb_out)
コード例 #3
0
    def test_makestructure(self):
        # FIXME: What does this test?
        # https://github.com/Amber-MD/cpptraj/issues/27
        # load only 1st frame
        traj = pt.iterload(fn('Tc5b.x'), fn('Tc5b.top'))

        # polyproline II dihedral to residues 1-13
        t0 = traj[:1].copy()
        pt.make_structure(t0, 'pp2:1-13')
        pt.write_traj('dummy_test0.pdb', t0, options='model', overwrite=True)

        t1 = traj[:1].copy()
        pt.make_structure(t1, "chi1:8:N:CA:CB:CG:35")
        pt.write_traj('dummy_test1.pdb', t1, options='model', overwrite=True)
コード例 #4
0
def build_protein(seq, command):
    '''

    Parameters
    ----------
    seq : protein sequence
    command : str or list of str
        pytraj command for building secondary structure for a given residue range

    Requires
    --------
    tleap, pytraj

    Examples
    --------
    >>> from jamber import build
    >>> # Ala10
    >>> seq = "ALA ALA ALA ALA ALA ALA ALA ALA ALA ALA"
    >>> traj = builder.build_protein(seq, ['alpha:1-10'])
    >>> # visualize in Jupyter notebook
    >>> traj.visualize()
    >>> # save to pdb file
    >>> traj.save("new.pdb")

    Returns
    -------
    pytraj.Trajectory
    '''
    pdb_fn = 'seq.pdb'
    leap_command = """
    source leaprc.protein.ff14SB
    x = sequence{%s}
    savepdb x %s
    """ % (seq, pdb_fn)

    command_str = ' '.join(command) if isinstance(command, list) else command

    amberhome = os.getenv('AMBERHOME')
    if os.path.exists(amberhome + '/dat/leap/cmd/leaprc.ff14SB'):
        leap_command = leap_command.replace('protein.ff14SB', 'ff14SB')

    with tempfolder():
        leap.run(leap_command)
        traj = pt.load(pdb_fn)
        pt.make_structure(traj, command_str)
        return traj
コード例 #5
0
    def test_makestructure(self):
        # https://github.com/Amber-MD/cpptraj/issues/27
        # load only 1st frame
        traj = pt.iterload("./data/Tc5b.x", "./data/Tc5b.top")

        #  pply polyproline II dihedral to residues 1-13
        t0 = traj[:1].copy()
        pt.make_structure(t0, 'pp2:1-13')
        pt.write_traj('./output/test0.pdb',
                      t0,
                      options='model',
                      overwrite=True)

        t1 = traj[:1].copy()
        pt.make_structure(t1, "chi1:8:N:CA:CB:CG:35")
        pt.write_traj('./output/test1.pdb',
                      t1,
                      options='model',
                      overwrite=True)