Exemplo n.º 1
0
 def write(self, file, model_format='PDB', no_ter=False):
     """Write coordinates to a file"""
     if isinstance(file, str):
         file = modfile.File(file, 'w')
     return _modeller.mod_model_write(self.modpt, self.env.libs.modpt, (),
                                      file.file_pointer, model_format,
                                      no_ter, True)
Exemplo n.º 2
0
 def write(self, file):
     """Write current coordinates to a PDB file"""
     if isinstance(file, str):
         file = modfile.File(file, 'w')
     return _modeller.mod_alnstructure_write(self.cdpt, self.seqpt,
                                             file.file_pointer,
                                             self.aln.env.libs.modpt)
Exemplo n.º 3
0
 def write(self, file, model_format='PDB', no_ter=False):
     """Write selection coordinates to a file"""
     (inds, mdl) = self.__require_indices()
     if isinstance(file, str):
         file = modfile.File(file, 'w')
     return _modeller.mod_model_write(mdl.modpt, mdl.env.libs.modpt, inds,
                                      file.file_pointer, model_format,
                                      no_ter, False)
Exemplo n.º 4
0
 def read_alignment(self):
     if not self.vars['add_sequence']:
         _modeller.mod_alignment_clear(self.get_aln())
     self.__default_file('file', '.A', ('', '.ali'))
     fh = modfile.File(self.vars['file'], 'r')
     AutoCommands.read_alignment(self,
                                 allow_alternates=False,
                                 fh=fh.file_pointer)
     fh.close()
Exemplo n.º 5
0
 def read_profile(self):
     fmt = self.vars['profile_format']
     prf = self.get_prf()
     libs = self.get_libs()
     fname = self.vars['file']
     if fmt.upper() == 'BINARY':
         _modeller.mod_profile_read_binary(prf, libs, fname)
     else:
         fh = modfile.File(fname, 'r')
         _modeller.mod_profile_read_text(prf, libs, fh.file_pointer)
         fh.close()
Exemplo n.º 6
0
 def write(self, file, alignment_format='PIR',
           alignment_features='INDICES CONSERVATION', align_block=0,
           align_alignment=False):
     """Write the alignment to a file"""
     if isinstance(file, str):
         file = modfile.File(file, 'w')
     return _modeller.mod_alignment_write(self.modpt, self.env.libs.modpt,
                                          file.file_pointer,
                                          alignment_format,
                                          alignment_features, align_block,
                                          align_alignment)
Exemplo n.º 7
0
 def read_model(self):
     self.__default_file('file', 'B')
     (file, model_segment) = self.__seg_from_aln('model_segment')
     io = self.get_io()
     file = _modeller.mod_pdb_filename_get(file, io.atom_files_directory)
     fh = modfile.File(file, 'r')
     AutoCommands.read_model(self,
                             fh=fh.file_pointer,
                             model_segment=model_segment,
                             keep_disulfides=False)
     fh.close()
     self.__pickall()
Exemplo n.º 8
0
 def write(self,
           file,
           atom_file,
           align_code,
           comment='',
           format='PIR',
           chop_nonstd_termini=True):
     """Write this chain out to an alignment file"""
     f = _modeller.mod_chain_write
     if isinstance(file, str):
         file = modfile.File(file, 'w')
     return f(self.seq.seqpt, self.seq.cdpt, self._num, file.file_pointer,
              atom_file, align_code, comment, format, chop_nonstd_termini,
              self.seq.env.libs.modpt)
Exemplo n.º 9
0
 def read_one(self, file, remove_gaps=False, alignment_format='PIR',
              io=None, allow_alternates=False):
     """Read sequences from the file, one by one. Return False when no more
        can be read."""
     if io is None:
         io = self.env.io
     self.clear()
     func = _modeller.mod_alignment_read_one2
     if isinstance(file, str):
         # Cache one file handle per alignment:
         if self.__read_one_pair is None or self.__read_one_pair[0] != file:
             log.warning("read_one",
                         "Filename arguments to read_one() are " + \
                         "deprecated.\nPlease use a handle " + \
                         "(modfile.File object) instead.")
             self.__read_one_pair = (file, modfile.File(file, 'r'))
         file = self.__read_one_pair[1]
     return func(self.modpt, file.file_pointer, io.modpt,
                 self.env.libs.modpt, remove_gaps, alignment_format,
                 allow_alternates) == 0
Exemplo n.º 10
0
 def write_model(self):
     self.__default_file('file', '.B')
     fh = modfile.File(self.__add_outdir('file'), 'w')
     AutoCommands.write_model(self, fh=fh.file_pointer, extra_data='')
     fh.close()
Exemplo n.º 11
0
 def write_restraints(self):
     self.__default_file('file', '.C')
     fh = modfile.File(self.__add_outdir('file'), 'w')
     AutoCommands.write_restraints(self, fh=fh.file_pointer)
Exemplo n.º 12
0
 def read_density(self):
     fh = modfile.File(self.vars['file'], 'rb')
     AutoCommands.read_density(self, fh=fh.file_pointer, read_origin=False)
     fh.close()
Exemplo n.º 13
0
 def read_atom_classes(self):
     fh = modfile.File(self.vars['atom_classes_file'], 'r')
     AutoCommands.read_atom_classes(self, fh=fh.file_pointer)
     fh.close()
Exemplo n.º 14
0
 def read_restraints(self):
     if not self.vars['add_restraints']:
         _modeller.mod_restraints_clear(self.get_mdl())
     self.__default_file('file', '.C', ('', '.rsr'))
     fh = modfile.File(self.vars['file'], 'r')
     AutoCommands.read_restraints(self, fh=fh.file_pointer)
Exemplo n.º 15
0
 def read_restyp_lib(self):
     fh = modfile.File(self.vars['restyp_lib_file'], 'r')
     AutoCommands.read_restyp_lib(self, fh=fh.file_pointer)
Exemplo n.º 16
0
 def write_topology_model(self):
     self.__default_file('file', '.toplib')
     fh = modfile.File(self.__add_outdir('file'), 'w')
     AutoCommands.write_topology_model(self, fh=fh.file_pointer)
     fh.close()
Exemplo n.º 17
0
 def read_topology(self):
     if not self.vars['add_topology']:
         _modeller.mod_topology_clear(self.get_tpl(), self.get_libs())
     self.__default_file('file', '.T', ('', '.lib'))
     fh = modfile.File(self.vars['file'], 'r')
     AutoCommands.read_topology(self, fh=fh.file_pointer)
Exemplo n.º 18
0
 def write_alignment(self):
     self.__default_file('file', '.A')
     fh = modfile.File(self.__add_outdir('file'), 'w')
     AutoCommands.write_alignment(self, fh=fh.file_pointer)
     fh.close()