當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。