当前位置: 首页>>代码示例>>Python>>正文


Python Universe.select_atoms方法代码示例

本文整理汇总了Python中MDAnalysis.Universe.select_atoms方法的典型用法代码示例。如果您正苦于以下问题:Python Universe.select_atoms方法的具体用法?Python Universe.select_atoms怎么用?Python Universe.select_atoms使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MDAnalysis.Universe的用法示例。


在下文中一共展示了Universe.select_atoms方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_write_selection

# 需要导入模块: from MDAnalysis import Universe [as 别名]
# 或者: from MDAnalysis.Universe import select_atoms [as 别名]
 def test_write_selection(self):
     ref = Universe(mol2_molecule)
     gr0 = ref.select_atoms("name C*")
     gr0.write(self.outfile)
     u = Universe(self.outfile)
     gr1 = u.select_atoms("name C*")
     assert_equal(len(gr0), len(gr1))
开发者ID:jdetle,项目名称:mdanalysis,代码行数:9,代码来源:test_mol2.py

示例2: test_atomgroups

# 需要导入模块: from MDAnalysis import Universe [as 别名]
# 或者: from MDAnalysis.Universe import select_atoms [as 别名]
 def test_atomgroups(self):
     u = Universe(self.filename)
     segidB0 = len(u.select_atoms("segid B and (not altloc B)"))
     segidB1 = len(u.select_atoms("segid B and (not altloc A)"))
     assert_equal(segidB0, segidB1)
     altlocB0 = len(u.select_atoms("segid B and (altloc A)"))
     altlocB1 = len(u.select_atoms("segid B and (altloc B)"))
     assert_equal(altlocB0, altlocB1)
     sum = len(u.select_atoms("segid B"))
     assert_equal(sum, segidB0 + altlocB0)
开发者ID:alejob,项目名称:mdanalysis,代码行数:12,代码来源:test_altloc.py

示例3: test_bonds

# 需要导入模块: from MDAnalysis import Universe [as 别名]
# 或者: from MDAnalysis.Universe import select_atoms [as 别名]
 def test_bonds(self):
     u = Universe(self.filename, guess_bonds=True)
     # need to force topology to load before querying individual atom bonds
     u.build_topology()
     bonds0 = u.select_atoms("segid B and (altloc A)")[0].bonds
     bonds1 = u.select_atoms("segid B and (altloc B)")[0].bonds
     assert_equal(len(bonds0), len(bonds1))
开发者ID:BartBruininks,项目名称:mdanalysis,代码行数:9,代码来源:test_altloc.py

示例4: test_write_read

# 需要导入模块: from MDAnalysis import Universe [as 别名]
# 或者: from MDAnalysis.Universe import select_atoms [as 别名]
 def test_write_read(self):
     u = Universe(self.filename)
     u.select_atoms("all").write(self.outfile)
     u2 = Universe(self.outfile)
     assert_equal(len(u.atoms), len(u2.atoms))
开发者ID:alejob,项目名称:mdanalysis,代码行数:7,代码来源:test_altloc.py

示例5: print

# 需要导入模块: from MDAnalysis import Universe [as 别名]
# 或者: from MDAnalysis.Universe import select_atoms [as 别名]
.. SeeAlso:: :mod:`MDAnalysis.analysis.psa`

"""

from MDAnalysis import Universe
from MDAnalysis.analysis.align import rotation_matrix
from MDAnalysis.analysis.psa import PSAnalysis

if __name__ == '__main__':

    print("Generating AdK CORE C-alpha reference coordinates and structure...")
    # Read in closed/open AdK structures; work with C-alphas only
    u_closed = Universe('structs/adk1AKE.pdb')
    u_open = Universe('structs/adk4AKE.pdb')
    ca_closed = u_closed.select_atoms('name CA')
    ca_open = u_open.select_atoms('name CA')

    # Move centers-of-mass of C-alphas of each structure's CORE domain to origin
    adkCORE_resids = "(resid 1:29 or resid 60:121 or resid 160:214)"
    u_closed.atoms.translate(-ca_closed.select_atoms(adkCORE_resids).center_of_mass())
    u_open.atoms.translate(-ca_open.select_atoms(adkCORE_resids).center_of_mass())

    # Get C-alpha CORE coordinates for each structure
    closed_ca_core_coords = ca_closed.select_atoms(adkCORE_resids).positions
    open_ca_core_coords = ca_open.select_atoms(adkCORE_resids).positions

    # Compute rotation matrix, R, that minimizes rmsd between the C-alpha COREs
    R, rmsd_value = rotation_matrix(open_ca_core_coords, closed_ca_core_coords)

    # Rotate open structure to align its C-alpha CORE to closed structure's
开发者ID:Becksteinlab,项目名称:PSAnalysisTutorial,代码行数:32,代码来源:psa_full.py

示例6: Universe

# 需要导入模块: from MDAnalysis import Universe [as 别名]
# 或者: from MDAnalysis.Universe import select_atoms [as 别名]
import MDAnalysis
from MDAnalysis import Universe
from MDAnalysis.analysis.contacts import calculate_contacts
import numpy as np
import pandas as pd

ref = Universe("conf_protein.gro.bz2")
u = Universe("conf_protein.gro.bz2", "traj_protein_0.xtc")

x = len(ref.select_atoms("protein"))
selA = "not name H* and resid 72-95 and bynum {}:{}".format(1, x//2)
selB = "not name H* and resid 72-95 and bynum {}:{}".format(x//2, x)


data = calculate_contacts(ref, u, selA, selB)
df = pd.DataFrame(data, columns=["Time (ps)", "Q"])
print(df)
开发者ID:MDAnalysis,项目名称:MDAnalysisCookbook,代码行数:19,代码来源:example.py

示例7: Universe

# 需要导入模块: from MDAnalysis import Universe [as 别名]
# 或者: from MDAnalysis.Universe import select_atoms [as 别名]
from MDAnalysis import Universe, collection, Timeseries
from MDAnalysis.tests.datafiles import PSF, DCD

try:
    import matplotlib

    matplotlib.use('agg')  # no interactive plotting, only save figures
    from pylab import errorbar, legend, xlabel, ylabel, savefig, clf, gca, draw

    have_matplotlib = True
except ImportError:
    have_matplotlib = False

universe = Universe(PSF, DCD)
protein = universe.select_atoms("protein")

numresidues = protein.numberOfResidues()

collection.clear()
for res in range(2, numresidues - 1):
    print "Processing residue {0:d}".format(res)
    # selection of the atoms involved for the phi for resid '%d' %res
    ## select_atoms("atom 4AKE %d C"%(res-1), "atom 4AKE %d N"%res, "atom %d 4AKE CA"%res, "atom 4AKE %d C" % res)
    phi_sel = universe.residues[res].phi_selection()

    #  selection of the atoms involved for the psi for resid '%d' %res
    psi_sel = universe.residues[res].psi_selection()

    # collect the timeseries of a dihedral
    collection.addTimeseries(Timeseries.Dihedral(phi_sel))
开发者ID:MDAnalysis,项目名称:MDAnalysisCookbook,代码行数:32,代码来源:backbone_dihedral.py

示例8: Universe

# 需要导入模块: from MDAnalysis import Universe [as 别名]
# 或者: from MDAnalysis.Universe import select_atoms [as 别名]
At this time, I wanted to confirm if the com of s100b was canceled.

Caution: this program is specialized for s100b-CTD system.

Usage: python conform_com_cancel.py [ PDB file name ]   
"""



file_name = sys.argv[1]
print "Input file name : ", file_name

u = Universe(file_name)
f_out = open(file_name+"_comTraj.dat", "w")
print "No of snapshots: ", len(u.trajectory)

for i, ts in enumerate(u.trajectory):

    #Select the all atoms constitute s100b
    selected_atoms = u.select_atoms("resid 1-94")

    print "atom ids: ", selected_atoms.ids

    com = selected_atoms.center_of_mass()
    cog = selected_atoms.center_of_geometry()

    f_out.write(str(com[0]) + " " + str(com[1]) + " " + str(com[2]) + " \n")



开发者ID:physicshinzui,项目名称:Converter_TrjToPDB,代码行数:29,代码来源:conform_com_cancel.py

示例9: Universe

# 需要导入模块: from MDAnalysis import Universe [as 别名]
# 或者: from MDAnalysis.Universe import select_atoms [as 别名]
    args = parser.parse_args()

    if not args.static:
        header_string = "; Umbrella potential for a spherical shell cavity\n"\
        "; Name    Type          Group  Kappa   Nstar    mu    width  cutoff  outfile    nstout\n"\
        "hydshell dyn_union_sph_sh   OW  0.0     0   XXX    0.01   0.02   phiout.dat   50  \\\n"
    else:
        header_string = "; Umbrella potential for a spherical shell cavity\n"\
        "; Name    Type          Group  Kappa   Nstar    mu    width  cutoff  outfile    nstout\n"\
        "hydshell union_sph_sh   OW  0.0     0   XXX    0.01   0.02   phiout.dat   50  \\\n"        

    if args.traj is None:
        u = Universe(args.gro)

        if args.sspec is not None:
            prot_heavies = u.select_atoms(args.sspec)
        else:
            # Select peptide heavies - exclude water's and ions
            prot_heavies = u.select_atoms("not (name H* or type H or resname SOL) and not (name NA or name CL) and not (resname WAL) and not (resname DUM)")

        fout = open(args.outfile, 'w')
        fout.write(header_string)

        if args.static:
            for atm in prot_heavies:
                fout.write("{:<10.1f} {:<10.1f} {:<10.3f} {:<10.3f} {:<10.3f}\\\n".format(-0.5, args.rad/10.0, atm.pos[0]/10.0, atm.pos[1]/10.0, atm.pos[2]/10.0))
        else:
            for atm in prot_heavies:
                fout.write("{:<10.1f} {:<10.1f} {:d} \\\n".format(-0.5, args.rad/10.0, atm.index+1))

        fout.close()
开发者ID:nrego,项目名称:mdscripts,代码行数:33,代码来源:gen_umbr.py


注:本文中的MDAnalysis.Universe.select_atoms方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。