Home | Trees | Indices | Help |
|
---|
|
Manage profiles (arrays or lists of values) for trajectory frames or atoms/residues in PDBModel. ProfileCollection resembles a 2-dimensional array where the first axis (let's say row) is accessed by a string key and each row has an additional info dictionary assigned to it. The take() and concat() methods operate on the columns, i.e. they are applied to all profiles at the same time.
By default, profiles of numbers are stored and returned as Numeric.array and all others are stored and returned as ordinary list. This behaviour can be modified with the option asarray of ProfileCollection.set(). Using both lists and arrays is a compromise between the efficiency of Numeric arrays and the problem that arrays of objects cannot be unpickled (Numeric bug) and that arrays of strings would end up as 2-D arrays of char. The 'isarray' entry of a profile's info dictionary tells whether the profile is stored as array or as list.
ProfileCollection p can be accessed like a dictionary of lists:len( p ) -> number of profiles (== len( p.profiles ) ) p['prof1'] -> list with values of profile 'prof1' del p['prof1'] -> remove a profile p['prof1'] = [..] -> add a profile without additional infos for k in p -> iterate over profile keys 'prof1' in p -> 1, if collection contains key 'prof1'But it is more than that - each key also has a dictionary of info values assigned to it (see getInfo(), setInfo(), p.infos). These can be accessed like:
p['prof1','date'] -> date of creation of profile named 'prof1' p.getInfo('prof1') -> returns all info records p['prof1','comment'] = 'first prof' -> add/change single info value
|
|||
| __init__(self, version=None, profiles=None, infos=None) | ||
str
|
version(self) Class version. |
||
any
|
__getitem__(self,
k) Get profile item: |
||
any
|
__setitem__(self,
k,
v) Set profile item: |
||
|
__delitem__(self,
k) Delete profile item: |
||
int
|
__len__(self) Length of profile |
||
1|0
|
__contains__(self,
k) Check if profile contains key: |
||
list
|
__iter__(self) Iterate over profile: |
||
| keys(self) | ||
| has_key(self, k) | ||
| values(self) | ||
list
|
items(self) Get list of tuples of profile names and profiles: |
||
list OR array
|
__array_or_list(self,
prof,
asarray) Convert to array or list depending on asarray option |
||
list OR array
|
__expand(self,
prof,
mask,
default) Expand profile to have a value also for masked positions. |
||
|
set(self,
name,
prof,
mask=None,
default=None,
asarray=1,
comment=None,
**moreInfo) Add/override a profile. |
||
|
setInfo(self,
name,
**args) Add/Override infos about a given profile: |
||
|
setMany(self,
profileDict,
infos={}) setMany( dict, [infoDict] ) Add/Override many profiles |
||
|
get(self,
name,
default=None) get( profKey, [default] ) -> list of values OR get( (profKey, infoKey), [default] ) -> single value of info dict |
||
dict
|
getInfo(self,
name) Use: |
||
[1|0]
|
profile2mask(self,
profName,
cutoff_min=None,
cutoff_max=None) Convert profile into a mask based on the max and min cutoff values. |
||
profile
|
take(self,
indices) Take on profile using provided indices: |
||
1|0
|
remove(self,
*key) Remove profile OR info values of profile: |
||
profileCollection
|
concat(self,
*profiles) Concatenate all profiles in this with corresponding profiles in the given ProfileCollection(s). |
||
|
update(self,
other,
stickyChanged=1) Merge other ProfileCollection into this one, replacing existing profiles and info values. |
||
|
updateMissing(self,
source,
copyMissing=1,
allowEmpty=0) Merge other ProfileCollection into this one but do not replace / update existing profiles and info records. |
||
ProfileCollection
|
clone(self) Clone (deepcopy) profile: |
||
|
clear(self) Delete all: |
||
int
|
profLength(self) Length of profile: |
||
biggles.FramedPlot
|
plot(self,
*name,
**arg) Plot one or more profiles using Biggles: |
||
| __shortString(self, s, maxLen) | ||
str
|
__repr__(self) Returns string representation within interactive python interpreter. |
|
|
Class version.
|
Get profile item: p['prof1'] <==> p.get( 'prof1' ) p['prof1','info1] <==> p.get( 'prof1','info1' )
|
Set profile item: p['prof1'] = range(10) <==> p.set( 'prof1', range(10) ) p['prof1','info1]='comment' <==> p.setInfo('prof1',info1='comment')
|
Delete profile item: del p['prof1'] <==> p.remove( 'prof1' ) del p['prof1','info1'] <==> p.remove( 'prof1', 'info1' ) |
Length of profile
|
Check if profile contains key: k in self <==> p.has_key( k )
|
Iterate over profile: for k in self <==> for k in p.keys()
|
|
|
|
Get list of tuples of profile names and profiles: p.items() -> [ (key1, [any]), (key2, [any]), ..) ]
|
Convert to array or list depending on asarray option
|
Expand profile to have a value also for masked positions.
|
Add/override a profile. None is allowed as special purpose value - in which case all other parameters are ignored. Otherwise, the two info records 'version', 'changed' and 'isarray' are always modified but can be overridden by key=value pairs to this function.
|
Add/Override infos about a given profile: e.g. setInfo('relASA', comment='new', params={'bin':'whatif'})
|
setMany( dict, [infoDict] ) Add/Override many profiles
|
get( profKey, [default] ) -> list of values OR get( (profKey, infoKey), [default] ) -> single value of info dict
|
Use: getInfo( name ) -> dict with infos about profile::Guaranteed infos: 'version'->str, 'comment'->str, 'changed'->1|0
|
Convert profile into a mask based on the max and min cutoff values.
|
Take on profile using provided indices: take( indices ) -> ProfileCollection with extract of all profiles
|
Remove profile OR info values of profile: remove( profKey ) -> 1|0, 1 if complete entry has been removed remove( profKey, infoKey ) -> 1|0, 1 if single info value was removed
|
Concatenate all profiles in this with corresponding profiles in the given ProfileCollection(s). Profiles that are not found in all ProfileCollections are skipped: p0.concat( p1 [, p2, ..]) -> single ProfileCollection with the same number of profiles as p0 but with the length of p0+p1+p2..
|
Merge other ProfileCollection into this one, replacing existing profiles and info values. This is the obvious translation of dict.update(). The changed flag of each profile is set to 1 if:
|
Merge other ProfileCollection into this one but do not replace / update existing profiles and info records. There is one exception: Empty profiles (None or []) are replaced but their info records stay untouched. If copyMissing=0, profiles that are existing in source but not in this collection, are NOT copied (i.e. only empty profiles are replaced).
|
Clone (deepcopy) profile: clone() -> ProfileCollection (or sub-class, actually a deepcopy)
|
Delete all: clear() -> None; delete all profiles and infos. |
Length of profile: profLength() -> int; length of first non-None profile or 0
|
Plot one or more profiles using Biggles: plot( name1, [name2, ..],[arg1=x, arg2=y]) -> biggles.FramedPlot
|
|
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0alpha3 on Fri Dec 22 20:11:46 2006 | http://epydoc.sourceforge.net |