Package csb :: Package bio :: Package io :: Module clans :: Class Clans

[frames] | no frames]

# Class Clans

source code

    object --+
             |
            Clans

Class for holding and manipulating data from one CLANS file. Initialization is always done as empty clustermap with default parameters.

Instance Methods

__getitem__(self, index) | source code

__init__(self) x.__init__(...) initializes x; see help(type(x)) for signature | source code

__len__(self) | source code

__repr__(self) str(x) | source code

__setitem__(self, index, data) | source code

__str__(self) str(x) | source code

add_entry(self, entry) Adds an new entry. | source code

add_group(self, group, members=None) Adds a new group. | source code

append_groups_from(self, other) Append the ClansSeqgroup-s of `other` that contain at least one entry that corresponds to an entry in this instance. | source code

ClansEntry

get_entry(self, name, pedantic=True) Checks if an entry with name `name` exists and returns it. | source code

initialize(self) Initializes the coordinates of all entries with random numbers in [-1, 1]. | source code

remove_entry(self, entry) Removes an entry. | source code

remove_entry_by_name(self, entry_name) Removes an entry fetched by its name. | source code

remove_group(self, group) Removes a group. | source code

restrict(self, keep_names) Removes all entries whose name is not in keep_names | source code

restrict_to_max_pvalue(self, cutoff) removes all ClansEntrys that have no connections above the `cutoff` | source code

set_default_rotmtx(self) Resets the rotation matrix (rotmtx) to no rotation. | source code

sort(self, key=None) Sorts the ClansEntrys by their name or by a custom comparison function. | source code

write(self, filename) writes the Clans instance to a file in CLANS format | source code

Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__sizeof__`, `__subclasshook__`

Properties
list | entries list of clustermap ClansEntrys.
str or None | filename file from which the data was parsed
ClansParams | params ClansParams that contains the parameters set for this Clans instance.
numpy.array | rotmtx 3x3 rotation matrix that indicates the rotation state of the clustermap
list | seqgroups list of ClansSeqgroups defined in the clustermap.
Inherited from `object`: `__class__`

Method Details

### __init__(self)
(Constructor)

source code

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
  (inherited documentation)

### __repr__(self)
(Representation operator)

source code

str(x)

Overrides: object.__repr__
  (inherited documentation)

### __str__(self)
(Informal representation operator)

source code

str(x)

Overrides: object.__str__
  (inherited documentation)

### add_entry(self, entry)

source code

Adds an new entry.

Parameters:
  - `entry` (ClansEntry instance) - the new entry
Raises:
  - `ValueError` - if `entry` is no ClansEntry instance

### add_group(self, group, members=None)

source code

Adds a new group.

Parameters:
  - `group` (ClansSeqgroup instance) - the new group
  - `members` (list) - ClansEntry instances to be in the new group
Raises:
  - `ValueError` - if group is no ClansSeqgroup instance

### append_groups_from(self, other)

source code

Append the ClansSeqgroup-s of `other` that contain at least one entry that corresponds to an entry in this instance. Entries are compared by their name only! Groups without any matching members in this instance are not created in the local instance.

Parameters:
  - `other` (Clans instance) - the source of the new group definitions

### get_entry(self, name, pedantic=True)

source code

Checks if an entry with name `name` exists and returns it.

Parameters:
  - `name` (str) - name of the sought entry
  - `pedantic` (bool) - If True, a ValueError is raised if multiple entries with name name are found. If False, returns the first one.
Returns: ClansEntry
  entry with name `name`
Raises:
  - `ValueError` - if no entry with name `name` is found
  - `DuplicateEntryNameError` - if multiple entries with name `name` are found and `pedantic == True`

### remove_entry(self, entry)

source code

Removes an entry.

Parameters:
  - `entry` (ClansEntry instance) - the entry that shall be removed

### remove_entry_by_name(self, entry_name)

source code

Removes an entry fetched by its name.

Parameters:
  - `entry_name` (string) - name of the entry that shall be removed

### remove_group(self, group)

source code

Removes a group.

Parameters:
  - `group` (ClansSeqgroup instance) - the new group

### restrict(self, keep_names)

source code

Removes all entries whose name is not in keep_names

Parameters:
  - `keep_names` (iterable) - names of entries that shall be kept

### restrict_to_max_pvalue(self, cutoff)

source code

removes all ClansEntrys that have no connections above the `cutoff`

Parameters:
  - `cutoff` (float) - the cutoff

### sort(self, key=None)

source code

Sorts the ClansEntrys by their name or by a custom comparison function.

Parameters:
  - `key` (function) - a custom key function

### write(self, filename)

source code

writes the Clans instance to a file in CLANS format

Parameters:
  - `filename` (str) - the target file's name

Property Details

### entries

list of clustermap ClansEntrys.

Get Method:
  unreachable.entries(self) - list of clustermap ClansEntrys.
Type:
  list

### filename

file from which the data was parsed

Get Method:
  unreachable.filename(self) - file from which the data was parsed
Type:
  str or None

### params

ClansParams that contains the parameters set for this Clans instance.

Get Method:
  unreachable.params(self) - ClansParams that contains the parameters set for this Clans instance.
Type:
  ClansParams

### rotmtx

3x3 rotation matrix that indicates the rotation state of the clustermap

raises ValueError if rotation matrix shape is not 3x3

Get Method:
  unreachable.rotmtx(self) - 3x3 rotation matrix that indicates the rotation state of the clustermap
Set Method:
  unreachable.rotmtx(self, value)
Type:
  numpy.array

### seqgroups

list of ClansSeqgroups defined in the clustermap.

Get Method:
  unreachable.seqgroups(self) - list of ClansSeqgroups defined in the clustermap.
Type:
  list