• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python mdtraj.load_pdb函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mdtraj.load_pdb函数的典型用法代码示例。如果您正苦于以下问题:Python load_pdb函数的具体用法?Python load_pdb怎么用?Python load_pdb使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: test_pdb_from_url

def test_pdb_from_url():
    # load pdb from URL
    t1 = load_pdb('http://www.rcsb.org/pdb/files/4K6Q.pdb.gz')
    t2 = load_pdb('http://www.rcsb.org/pdb/files/4K6Q.pdb')
    eq(t1.n_frames, 1)
    eq(t2.n_frames, 1)
    eq(t1.n_atoms, 2208)
    eq(t2.n_atoms, 2208)
开发者ID:ChayaSt,项目名称:mdtraj,代码行数:8,代码来源:test_pdb.py


示例2: loader

def loader(file):

    try:
        md.load_pdb(file)
    except:
        return None
            
    print(file)
    
    return None
开发者ID:choderalab,项目名称:PDBAnalyzer,代码行数:10,代码来源:mdtraj_load_only.py


示例3: _construct_traj

    def _construct_traj(self):
        logger.debug('Loading Trajectory object for model {0} ({1}/{2})'.format(self.df.templateid.iloc[0], 0, len(self.df.model_filepath)))
        traj = mdtraj.load_pdb(self.df.model_filepath[0])
        remove_disulfide_bonds_from_topology(traj.topology)
        self.traj = traj

        for m, model_filepath in enumerate(self.df.model_filepath[1:]):
            logger.debug('Loading Trajectory object for model {0} ({1}/{2})'.format(self.df.templateid.iloc[m+1], m+1, len(self.df.model_filepath)))
            traj = mdtraj.load_pdb(model_filepath)
            remove_disulfide_bonds_from_topology(traj.topology)
            self.traj += traj
开发者ID:choderalab,项目名称:ensembler,代码行数:11,代码来源:mktraj.py


示例4: test_1vii_url_and_gz

def test_1vii_url_and_gz():
    t1 = load_pdb('http://www.rcsb.org/pdb/files/1vii.pdb.gz')
    t2 = load_pdb('http://www.rcsb.org/pdb/files/1vii.pdb')
    t3 = load_pdb(get_fn('1vii.pdb.gz'))
    t4 = load_pdb(get_fn('1vii.pdb'))
    eq(t1.n_frames, 1)
    eq(t1.n_frames, t2.n_frames)
    eq(t1.n_frames, t3.n_frames)
    eq(t1.n_frames, t4.n_frames)
    
    eq(t1.n_atoms, t2.n_atoms)
    eq(t1.n_atoms, t3.n_atoms)
    eq(t1.n_atoms, t4.n_atoms)
开发者ID:ChayaSt,项目名称:mdtraj,代码行数:13,代码来源:test_pdb.py


示例5: test_segment_id

def test_segment_id(get_fn):
    pdb = load_pdb(get_fn('ala_ala_ala.pdb'))
    pdb.save_pdb(temp)
    pdb2 = load_pdb(temp)

    correct_segment_id = 'AAL'
    # check that all segment ids are set correctly
    for ridx,r in enumerate(pdb.top.residues):
        assert r.segment_id == correct_segment_id, "residue %i (0-indexed) does not have segment_id set correctly from ala_ala_ala.pdb"%(ridx)

    # check that all segment ids are set correctly after a new pdb file is written
    for ridx,(r1,r2) in enumerate(zip(pdb.top.residues,pdb2.top.residues)):
        assert r1.segment_id == r2.segment_id, "segment_id of residue %i (0-indexed) in ala_ala_ala.pdb does not agree with value in after being written out to a new pdb file"%(ridx)
开发者ID:dwhswenson,项目名称:mdtraj,代码行数:13,代码来源:test_pdb.py


示例6: _get_models

    def _get_models(self):
        self.model = {}
        root, dirnames, filenames = next(os.walk(self.models_target_dir))
        for dirname in dirnames:
            if 'implicit' in self.model and 'explicit' in self.model:
                break
            if 'implicit' not in self.model:
                implicit_model_filename = os.path.join(self.models_target_dir, dirname, 'implicit-refined.pdb.gz')
                if os.path.exists(implicit_model_filename):
                    self.model['implicit'] = mdtraj.load_pdb(implicit_model_filename)

            if 'explicit' not in self.model:
                explicit_model_filename = os.path.join(self.models_target_dir, dirname, 'explicit-refined.pdb.gz')
                if os.path.exists(explicit_model_filename):
                    self.model['explicit'] = mdtraj.load_pdb(explicit_model_filename)
开发者ID:MehtapIsik,项目名称:ensembler,代码行数:15,代码来源:renumber_residues.py


示例7: test_3

def test_3(tmpdir):
    # 1COY gives a small error, due to a broken chain.
    pdbids = ['1GAI', '6gsv', '2AAC']
    for pdbid in pdbids:
        t = md.load_pdb('http://www.rcsb.org/pdb/files/%s.pdb' % pdbid)
        t = t.atom_slice(t.top.select_atom_indices('minimal'))
        assert_(call_dssp(tmpdir, t), md.compute_dssp(t, simplified=False)[0])
开发者ID:dr-nate,项目名称:mdtraj,代码行数:7,代码来源:test_dssp.py


示例8: metal_searcher

def metal_searcher(file):
    
    metal_searcher_results = {}
    metal_searcher_results['one_atom_residue_names'] = []
    metal_searcher_results['ok_file_count'] = 0
    metal_searcher_results['error_file_count'] = 0
    
    print(file)
    
    try:
        traj = md.load_pdb(file)
        metal_searcher_results['ok_file_count'] = 1
    except:
        metal_searcher_results['error_file_count'] = 1
        return metal_searcher_results
        
    topo = traj.topology
    
    one_atom_residue_atoms = [atom for atom in topo.atoms if atom.name == atom.residue.name]
    
    if one_atom_residue_atoms:
        for atom in one_atom_residue_atoms:
            metal_searcher_results['one_atom_residue_names'].append(str(atom.name))
            
    print(metal_searcher_results)        
    return metal_searcher_results
开发者ID:choderalab,项目名称:PDBAnalyzer,代码行数:26,代码来源:metal_searcher.py


示例9: loader

def loader(file):

    print(file)
    try:
        traj = md.load_pdb(file)
    except:    
        return file
开发者ID:choderalab,项目名称:PDBAnalyzer,代码行数:7,代码来源:mdtraj_list_noload.py


示例10: metal_searcher

def metal_searcher(file):
    
    metal_searcher_results = {}
    
    metal_searcher_results['ok_file_count'] = 0
    metal_searcher_results['error_file_count'] = 0
    metal_searcher_results['metals_in_file'] = {}
    metal_searcher_results['any_metal_in_file'] = 0
    
    for i in metals_list:
        metal_searcher_results['metals_in_file'][i] = 0
    
    print(file)
    
    try:
        traj = md.load_pdb(file)
        metal_searcher_results['ok_file_count'] = 1
    except:
        metal_searcher_results['error_file_count'] = 1
        return metal_searcher_results
        
    topo = traj.topology
    
    one_atom_residue_atoms = [atom.name for atom in topo.atoms if atom.name == atom.residue.name and atom.name in metals_list]
    
    if one_atom_residue_atoms:
        metal_searcher_results['any_metal_in_file'] = 1
        for atom_name in one_atom_residue_atoms:
            metal_searcher_results['metals_in_file'][atom_name] += 1
            
    print(metal_searcher_results)        
    return metal_searcher_results
开发者ID:choderalab,项目名称:PDBAnalyzer,代码行数:32,代码来源:metal_searcher_files.py


示例11: get

    def get(self, pdbid):
        pdbid = pdbid.lower()

        if len(pdbid) != 4:
            raise Exception("pdb id must be four characters long")

        filename = os.path.join(self.temp_dir, '%s.pdb.gz' % pdbid)
        with open(filename, 'wb') as filehandler:
            self.conn.retrbinary('RETR pub/pdb/data/structures/divided/pdb/%s/pdb%s.ent.gz' % (pdbid[1:3], pdbid),
                filehandler.write)

        if self.just_files:
            return filename

        else:
            # then we actually want to load it as a pdb file object and return an mdtraj trajectory
            with gzip.open(filename) as filehandler:
                text = filehandler.read()

            with open(filename[:-3], 'w') as filehandler:
                filehandler.write(text)

            pdb = mdtraj.load_pdb(filename[:-3])

            return pdb
开发者ID:schwancr,项目名称:pdbfetcher,代码行数:25,代码来源:fetcher.py


示例12: test_refine_explicit_md_short

def test_refine_explicit_md_short():
    with integrationtest_context(set_up_project_stage='solvated'):
        targetid = 'EGFR_HUMAN_D0'
        templateid = 'KC1D_HUMAN_D0_4KB8_D'
        refine_explicit_md(
            process_only_these_targets=[targetid],
            process_only_these_templates=[templateid],
            sim_length=2.0*unit.femtosecond,
            nsteps_per_iteration=1,
            verbose=True
        )
        explicit_metadata_filepath = os.path.join(
            default_project_dirnames.models, targetid, 'refine_explicit_md-meta0.yaml'
        )
        explicit_model_filepath = os.path.join(
            default_project_dirnames.models, targetid, templateid, 'explicit-refined.pdb.gz'
        )
        explicit_energies_filepath = os.path.join(
            default_project_dirnames.models, targetid, templateid, 'explicit-energies.txt'
        )
        explicit_log_filepath = os.path.join(
            default_project_dirnames.models, targetid, templateid, 'explicit-log.yaml'
        )

        assert all(map(
            os.path.exists,
            [explicit_model_filepath, explicit_energies_filepath, explicit_log_filepath]
        ))
        with open(explicit_log_filepath) as explicit_log_file:
            explicit_log = yaml.load(explicit_log_file)
        assert explicit_log.get('finished') is True
        assert explicit_log.get('successful') is True
        explicit_model_traj = mdtraj.load_pdb(explicit_model_filepath)
开发者ID:ostrokach,项目名称:ensembler,代码行数:33,代码来源:test_refinement.py


示例13: test_1

def test_1():
    for fn in ['1bpi.pdb', '1vii.pdb', '4K6Q.pdb', '1am7_protein.pdb']:
        t = md.load_pdb(get_fn(fn))
        t = t.atom_slice(t.top.select_atom_indices('minimal'))
        f = lambda : assert_(call_dssp(t), md.compute_dssp(t, simplified=False)[0])
        f.description = 'test_1: %s' % fn
        yield f
开发者ID:hainm,项目名称:mdtraj,代码行数:7,代码来源:test_dssp.py


示例14: test_4

def test_4():
    t = md.load_pdb(get_fn('1am7_protein.pdb'))
    a = md.compute_dssp(t, simplified=True)
    b = md.compute_dssp(t, simplified=False)
    assert len(a) == len(b)
    assert len(a[0]) == len(b[0])
    assert list(np.unique(a[0])) == ['C', 'E', 'H']
开发者ID:hainm,项目名称:mdtraj,代码行数:7,代码来源:test_dssp.py


示例15: __init__

    def __init__(self, PDB_filename, free_energy, expdata_filename=None, use_log_normal_distances=False,
                       dloggamma=np.log(1.01), gamma_min=0.2, gamma_max=10.0):
        """Initialize the class.
        INPUTS
	conf		A molecular structure as an msmbuilder Conformation() object.
                        NOTE: For cases where the structure is an ensemble (say, from clustering)
                        and the modeled NOE distances and coupling constants are averaged, 
                        the structure itself can just be a placeholder with the right atom names
                        and numbering
              
        free_energy     The (reduced) free energy f = beta*F of this conformation
        """

        self.PDB_filename = PDB_filename
        self.expdata_filename = expdata_filename
        self.conf = mdtraj.load_pdb(PDB_filename)
        # Convert the coordinates from nm to Angstrom units 
        self.conf.xyz = self.conf.xyz*10.0 

        # The (reduced) free energy f = beta*F of this structure, as predicted by modeling
        self.free_energy = free_energy

        # Flag to use log-normal distance errors log(d/d0)
        self.use_log_normal_distances = use_log_normal_distances

        # Store info about gamma^(-1/6) scaling  parameter array
        self.dloggamma = dloggamma
        self.gamma_min = gamma_min
        self.gamma_max = gamma_max
        self.allowed_gamma = np.exp(np.arange(np.log(self.gamma_min), np.log(self.gamma_max), self.dloggamma))

        # Store distance restraint info
        self.distance_restraints = []
        self.distance_equivalency_groups = {}
        self.ambiguous_groups = []  # list of pairs of group indices, e.g.:   [ [[1,2,3],[4,5,6]],   [[7],[8]], ...]
        self.ndistances = 0

        # Store dihedral restraint info
        self.dihedral_restraints = [] 
        self.dihedral_equivalency_groups = {}
        self.dihedral_ambiguity_groups = {}
        self.ndihedrals = 0

        # Create a KarplusRelation object
        self.karplus = KarplusRelation()

        # variables to store pre-computed SSE and effective degrees of freedom (d.o.f.)
        self.sse_distances = np.array([0.0 for gamma in self.allowed_gamma])
        self.Ndof_distances = None
        self.sse_dihedrals = None
        self.Ndof_dihedrals = None
        self.betas = None   # if reference is used, an array of N_j betas for each distance
        self.neglog_reference_priors = None
        self.sum_neglog_reference_priors = 0.0

        # If an experimental data file is given, load in the information
        self.expdata_filename = expdata_filename
        if expdata_filename != None:
        	self.load_expdata(expdata_filename)
开发者ID:vvoelz,项目名称:nmr-biceps,代码行数:59,代码来源:Structure.py


示例16: test_topology

def test_topology(get_fn):
    top = md.load_pdb(get_fn('native.pdb')).topology

    with HDF5TrajectoryFile(temp, 'w') as f:
        f.topology = top

    with HDF5TrajectoryFile(temp) as f:
        assert f.topology == top
开发者ID:dr-nate,项目名称:mdtraj,代码行数:8,代码来源:test_hdf5.py


示例17: test_load_trajectory

def test_load_trajectory(get_fn):
    # Compare a TNG file to the PDB file it was created from.

    pdbtraj = md.load_pdb(get_fn('frame0.pdb'))
    tngtraj = md.load_tng(get_fn('frame0.tng'), top=pdbtraj.topology)
    eq(pdbtraj.n_frames, tngtraj.n_frames)
    eq(pdbtraj.unitcell_vectors, tngtraj.unitcell_vectors)
    eq(pdbtraj.xyz, tngtraj.xyz)
开发者ID:dwhswenson,项目名称:mdtraj,代码行数:8,代码来源:test_tng.py


示例18: _store_highest_seqid_model

 def _store_highest_seqid_model(self):
     models_sorted = self.df.sort('seqid').templateid
     for modelid in models_sorted:
         model_filepath = os.path.join(self.models_target_dir, modelid, self.model_filename)
         if os.path.exists(model_filepath):
             self.ref_modelid = modelid
             self.ref_model_filepath = model_filepath
             break
     self.ref_model_traj = mdtraj.load_pdb(self.ref_model_filepath)
开发者ID:kyleabeauchamp,项目名称:ensembler,代码行数:9,代码来源:inspect.py


示例19: _align_structures

 def _align_structures(self):
     for irow in range(self.nrows):
         row_first_col = irow * self.ncols
         self._ref_traj = mdtraj.load_pdb(self.structure_filepaths[row_first_col])
         self._heavy_atoms = self._ref_traj.topology.select('not name H')
         for icol in range(self.ncols):
             alignment_index = row_first_col + icol
             structure_filepath = self.structure_filepaths[alignment_index]
             self._align_structure(structure_filepath, alignment_index)
开发者ID:choderalab,项目名称:ensembler,代码行数:9,代码来源:rendering.py


示例20: test_3nch_conect

def test_3nch_conect():
    # This has conect entries that use all available digits, good failure case.
    t1 = load_pdb(get_fn('3nch.pdb.gz'))
    top, bonds = t1.top.to_dataframe()
    bonds = dict(((a, b), 1) for (a, b) in bonds)
    eq(bonds[19782, 19783], 1)  # Check that last SO4 molecule has right bonds
    eq(bonds[19782, 19784], 1)  # Check that last SO4 molecule has right bonds
    eq(bonds[19782, 19785], 1)  # Check that last SO4 molecule has right bonds
    eq(bonds[19782, 19786], 1)  # Check that last SO4 molecule has right bonds
开发者ID:ChayaSt,项目名称:mdtraj,代码行数:9,代码来源:test_pdb.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python mdtraj.rmsd函数代码示例发布时间:2022-05-27
下一篇:
Python mdtraj.load_frame函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap