You are reading the documentation for version 2.4 of OpenStructure. You may also want to read the documentation for:
1.1
1.2
1.3
1.4
1.5
1.6
1.7
1.7.1
1.8
1.9
1.10
1.11
2.0
2.1
2.2
2.3
2.3.1
devel
|
Raises: |
|
---|
Some of the formats have a dedicated function that allows you to tweak many
parameters that affect the import. PDB files can be loaded with LoadPDB()
and mmCIF files with LoadMMCIF()
(this also gives you access to the
MMCifInfo
class). It offers tighter control over the exact loading
behaviour.
LoadPDB
(filename, restrict_chains='', no_hetatms=None, fault_tolerant=None, load_multi=False, quack_mode=None, join_spread_atom_records=None, calpha_only=None, profile='DEFAULT', remote=False, remote_repo='pdb', dialect=None, seqres=False, bond_feasibility_check=None, read_conect=False)¶Load PDB file from disk and return one or more entities. Several options allow to customize the exact behaviour of the PDB import. For more information on these options, see IO Profiles for entity importer.
Residues are flagged as ligand if they are mentioned in a HET record.
Parameters: |
|
---|---|
Return type: |
|
Raises: |
|
PDBStrToEntity
(pdb_string, profile=IOProfile(), process=False)¶Load entity from a string in PDB format. By default the entity is loaded with
an empty IO Profile and is not processed with the Processor
,
even if one is available in the IO Profile.
Parameters: |
|
---|---|
Return type: |
To get an entity equivalent to one loaded with LoadPDB()
, set the
profile and process arguments as follows:
with open('protein.pdb') as pdb_fd:
pdb_str = pdb.read()
ent = io.PDBStrToEntity(pdb_str, ost.io.profiles['DEFAULT'], True)
SDFStrToEntity
(sdf_string)¶Load entity from a string in SDF format.
Parameters: | pdb_string – A SDF file as a string. |
---|---|
Return type: | EntityHandle . |
ost.io.
OMF
¶Experimental data format capable of storing minimally required information
of a ost.mol.EntityHandle
in a heavily compressed manner
(OMF - OpenStructure Minimal Format). Shares lots of ideas with the mmtf or
binaryCIF formats but comes with no dependencies attached.
FromEntity
(ent)¶Generates ost.io.OMF
object starting from an
ost.mol.EntityHandle
. ent is is assigned as assymetric unit,
no biounits are defined (i.e. GetBU()
raises an error in any case`).
Parameters: | ent (ost.mol.EntityHandle ) – Structural data |
---|---|
Returns: | The created ost.io.OMF object |
FromFile
(filepath)¶Generates ost.io.OMF
object from a file stored with
ToFile()
.
Parameters: | filepath (str ) – The file |
---|---|
Returns: | The created ost.io.OMF object |
FromMMCIF
(ent, info)¶Generates ost.io.OMF
object starting from an
ost.mol.EntityHandle
with an associated MMCifInfo
(you get this stuff with ost.io.LoadMMCIF()
). ent is assigned
as assymetric unit and the biounits are fetched from info.
Parameters: |
|
---|---|
Returns: | The created |
FromBytes
(bytes_string)¶Generates ost.io.OMF
object from a bytes
object created
with ToBytes()
.
Parameters: | bytes_string (bytes ) – The super heavily compressed OMF structure |
---|
ToFile
(filepath)¶Stores object to file
Parameters: | filepath (str ) – The file |
---|
ToBytes
()¶Stores object to bytes
string
Returns: | The bytes string |
---|
GetAU
()¶Getter for assymetric unit
Returns: | The assymetric unit as ost.mol.EntityHandle |
---|
GetAUChain
(chain_name)¶Getter for single chain in the assymetric unit
Parameters: | chain_name (str ) – The name of the chain you want |
---|---|
Returns: | ost.mol.EntityHandle of the AU only containing the
specified chain |
GetBU
(bu_idx)¶Getter for Biounit
Parameters: | bu_idx (int ) – The index from the biounit as it has been read from info in
FromMMCIF() . |
---|---|
Returns: | The Biounit as ost.mol.EntityHandle |
Raises: | RuntimeError if bu_idx doesn’t exist |
LoadPDB()
already provides access to selected structural databases in
the internet when enabling the remote flag. Predefined
ost.io.remote.RemoteRepository
objects are available as
from ost.io import remote
repo_name = 'smtl'
repo = remote.REMOTE_REPOSITORIES.get(repo_name)
# url for entry with id 1ake.1
print(repo.URLForID('1ake.1'))
where repo_name can be one of [‘pdb’, ‘cif’, ‘pdb_redo’, ‘smtl’]. Instead of explicit access, you can directly fetch data using:
RemoteGet
(id, from_repo='pdb')¶Invokes RemoteRepository.Get()
on predefined repositories
(‘pdb’, ‘smtl’, ‘cif’, ‘pdb_redo’)
Parameters: | from_repo (str ) – One of the predefined repositories |
---|
RemoteLoad
(id, from_repo='pdb')¶Invokes RemoteRepository.Load()
on predefined repositories
(‘pdb’, ‘smtl’, ‘cif’, ‘pdb_redo’)
Parameters: | from_repo (str ) – One of the predefined repositories |
---|
RemoteRepository
(name, url_pattern, type, id_transform='upper')¶A remote repository represents a structural database accessible through the internet, e.g. the PDB or SWISS-MODEL template library.
Parameters: |
|
---|
Get
(id)¶Resolves URL with URLForID()
, dumps the content in a temporary file
and returns its path.
Parameters: | id (str ) – ID to resolve |
---|
Load
(id)¶Resolves URL with URLForID()
and directly loads/returns the according
ost.mol.EntityHandle
. Loading invokes the
ost.io.LoadPDB()
/ost.io.LoadMMCIF()
with default parameterization. If you need
custom settings, you might want to consider to call Get()
and do the
loading manually.
Parameters: | id (str ) – ID to resolve |
---|
URLForID
(id)¶Resolves URL given url_pattern and id_transform provided at object initialization. The url_pattern must contain substring ‘$ID’. Given id, the URL to the structure gets constructed by applying id_transform and inserting it at the location of ‘$ID’. e.g. ‘https://files.rcsb.org/view/$ID.pdb‘ given 1ake as id and ‘upper’ as id_transform resolves to: ‘https://files.rcsb.org/view/1AKE.pdb‘
Saving a complete entity or a view is a matter of calling
SaveEntity()
.
ent = io.LoadEntity('protein.pdb')
# save full entity
io.SaveEntity(ent, 'full.pdb')
# only save C-alpha atoms
io.SaveEntity(ent.Select('aname=CA and peptide=true'), 'calpha.pdb')
SavePDB()
provides a simple way to save several entities into one
file:
ent = io.LoadEntity('protein.pdb')
# Save complete entity
io.SavePDB(ent, 'full.pdb')
# Save chain A and chain B separately
io.SavePDB([ent.Select('cname=A'), ent.Select('cname=B')], 'split.pdb')
SaveEntity
(ent, filename, format='auto')¶Save entity to disk. If format is set to ‘auto’, the function guesses the filetype based on the file extension, otherwise the supplied format is checked against the available export plugins.
Parameters: |
|
---|---|
Raises: |
|
SavePDB
(models, filename, dialect=None, pqr=False, profile='DEFAULT')¶Save entity or list of entities to disk. If a list of entities is supplied the PDB file will be saved as a multi PDB file. Each of the entities is wrapped into a MODEL/ENDMDL pair.
If the atom number exceeds 99999, ‘*‘ is used.
Parameters: |
|
---|---|
Raises: | IOException if the restrictions of the PDB format are not satisfied (with the exception of atom numbers, see above):
|
EntityToPDBStr
(ent, profile=IOProfile())¶Return entity as a string in PDB format.
Parameters: |
|
---|---|
Raises: | IOException if the restrictions of the PDB format are not satisfied
(see |
Return type: | string. |
EntityToSDFStr
(ent)¶Return entity as a string in SDF format.
Parameters: | entity – The EntityHandle or EntityView |
---|---|
Return type: | string. |
LoadSequence
(filename, format='auto')¶Load sequence data from disk. If format is set to ‘auto’, the function guesses the filetype based on the extension of the file. Files ending in ‘.fasta’, ‘.aln’ will automatically be loaded.
Parameters: | |
---|---|
Return type: |
For files with non-standard extensions, the format can be set explicitly specifying the format parameter.
# recognizes FASTA file by file extension
myseq = io.LoadSequence('seq.fasta')
# for obtaining a SequenceList
seqlist = io.LoadSequenceList('seqs.fasta')
# or for multiple alignments (here from CLUSTAL)
aln = io.LoadAlignment('algnm.aln', format="clustal")
For a list of file formats supported by LoadSequence()
see
Supported Sequence File Formats.
Raises: |
|
---|
LoadSequenceList
(filename, format='auto')¶For a description of how to use LoadSequenceList()
please refer to
LoadSequence()
. For a list of file formats supported by
LoadSequenceList()
see Supported Sequence File Formats.
Parameters: | |
---|---|
Return type: |
LoadAlignment
(filename, format='auto')¶For a description of how to use LoadAlignment()
please refer to
LoadSequence()
. For a list of file formats supported by
LoadAlignment()
see Supported Sequence File Formats.
Parameters: | |
---|---|
Return type: |
LoadSequenceProfile
(filename, format='auto')¶Load sequence profile data from disk. If format is set to ‘auto’, the function guesses the filetype based on the extension of the file. Files ending in ‘.hhm’ (output of HHblits) and ‘.pssm’ (ASCII Table (PSSM) output of PSI-BLAST as generated with blastpgp and flag -Q) will automatically be loaded.
For files with non-standard extensions, the format can be set explicitly specifying the format parameter.
# recognizes hhm file by file extension
myprof = io.LoadSequenceProfile('myhmm.hhm')
# recognizes pssm file by file extension
myprof = io.LoadSequenceProfile('myprof.pssm')
# to override format
myprof = io.LoadSequenceProfile('myfile', format='hhm')
myprof = io.LoadSequenceProfile('myfile', format='pssm')
For a list of file formats supported by LoadSequenceProfile()
see
Supported Sequence Profile File Formats.
Parameters: | |
---|---|
Return type: | |
Raises: |
|
AlignmentFromString
(data, format)¶Load alignment from string.
The format argument is mandatory. For a list of supported formats, see Supported Sequence File Formats.
Parameters: | |
---|---|
Return type: |
SequenceFromString
(data, format)¶Load sequence from string.
The format argument is mandatory. For a list of supported formats, see Supported Sequence File Formats.
Parameters: | |
---|---|
Return type: |
SequenceListFromString
(data, format)¶Load a list of sequences from string.
The format argument is mandatory. For a list of supported formats, see Supported Sequence File Formats.
Parameters: | |
---|---|
Return type: |
SequenceProfileFromString
(data, format)¶Load sequence profile from string.
The format argument is mandatory.
Parameters: | |
---|---|
Return type: |
SaveSequence
(sequence, filename, format='auto')¶Saving sequence data is performed by calling SaveSequence()
.
For files with non-standard extensions, the format can be set explicitly
specifying the ‘format’ parameter.
# recognizes FASTA file by file extension
io.SaveSequence(myseq, 'seq.fasta')
# for saving a SequenceList
io.SaveSequenceList(seqlist, 'seqlist.fasta')
# or for multiple alignments (here in FASTA format)
io.SaveAlignment(aln, 'aln.fasta')
For a list of file formats supported by SaveSequence()
see
Supported Sequence File Formats.
Parameters: |
|
---|---|
Raises: |
|
SaveSequenceList
(seq_list, filename, format='auto')¶For a desription of how to use SaveSequenceList()
please refer to
SaveSequence()
. For a list of file formats supported by
SaveSequenceList()
see Supported Sequence File Formats.
Parameters: |
|
---|
SaveAlignment
(aln, filename, format='auto')¶For a desription of how to use SaveAlignment()
please refer to
SaveSequence()
.
For a list of file formats supported by SaveAlignment()
see
Supported Sequence File Formats.
Parameters: |
|
---|
AlignmentToString
(ali, format)¶Return alignment as a string.
The format argument is mandatory. For a list of supported formats see Supported Sequence File Formats.
Parameters: |
|
---|---|
Return type: |
SequenceToString
(seq, format)¶Return sequence as a string.
The format argument is mandatory. For a list of supported formats see Supported Sequence File Formats.
Parameters: |
|
---|---|
Return type: |
SequenceListToString
(seq_list, format)¶Return sequence list as a string.
The format argument is mandatory. For a list of supported formats see Supported Sequence File Formats.
Parameters: |
|
---|---|
Return type: |
LoadImage
(filename)¶Load density map from disk with the extension being guessed by the function.
Parameters: | filename (string) – The filename |
---|
LoadImage
(filename, format)Load density map from disk. If no format is given, the function guesses the filetype based on the extension of the file. If the extension is unknown or not present the filetype will be guessed based on the content of the file if possible.
Parameters: |
|
---|---|
Raises: |
|
# recognizes mrc file by file extension
ent = io.LoadImage('file.mrc')
# it is always possible to explicitly set the image format
# DAT file explicitly
ent = io.LoadImage('file', Dat())
For a list of file formats supported by LoadImage()
, see Supported Image File Formats.
SaveImage
(image, filename)¶Save density map to disk with the function guessing the filetype based on the file extension.
SaveImage
(image, filename, format)Save density map to disk. If no format is set, the function guesses the filetype based on the file extension.
Parameters: |
|
---|---|
Raises: |
|
For a list of file formats supported by SaveImage()
, see Supported Image File Formats.
# load density map
image = io.LoadImage('density_map.ccp4')
# save density map
io.SaveImage(image, 'new_map.map', CCP4())
In order to check the structure for some stereo-chemical and steric clashes
before computing the lDDT scores it is required to pass parameter file based on
Engh and Huber parameters, and on the atomic radii as defined in the Cambridge
Structural Database. OpenStructure ships with default file called
stereo_chemical_props.txt located in $OST_ROOT/share/openstructure
directory. A function ReadStereoChemicalPropsFile()
is used to
read this file.
ReadStereoChemicalPropsFile
(filename="", check=True)¶Read stereochemical parameters - if not provided a local version will be used.
Parameters: |
|
---|---|
Returns: | Object containing stereochemical parameters |
Return type: |
|
GetStereoChemicalPropsFile
()¶Get the default path to the stereochemical paramteres file.
Enter search terms or a module, class or function name.
dockq
- Evaluate protein-protein interfaces
Supported Structure File Formats
io
- Input and Output of Sequences, Structures and Maps