IMP logo
IMP Reference Guide  develop.cc86c9801d,2022/11/22
The Integrative Modeling Platform
IMP.pmi1.tools.Segments Class Reference

This class stores integers in ordered compact lists eg: [[1,2,3],[6,7,8]] the methods help splitting and merging the internal lists Example: s=Segments([1,2,3]) is [[1,2,3]] s.add(4) is [[1,2,3,4]] (add right) s.add(3) is [[1,2,3,4]] (item already existing) s.add(7) is [[1,2,3,4],[7]] (new list) s.add([8,9]) is [[1,2,3,4],[7,8,9]] (add item right) s.add([5,6]) is [[1,2,3,4,5,6,7,8,9]] (merge) s.remove(3) is [[1,2],[4,5,6,7,8,9]] (split) etc. More...

Inherits object.

Detailed Description

This class stores integers in ordered compact lists eg: [[1,2,3],[6,7,8]] the methods help splitting and merging the internal lists Example: s=Segments([1,2,3]) is [[1,2,3]] s.add(4) is [[1,2,3,4]] (add right) s.add(3) is [[1,2,3,4]] (item already existing) s.add(7) is [[1,2,3,4],[7]] (new list) s.add([8,9]) is [[1,2,3,4],[7,8,9]] (add item right) s.add([5,6]) is [[1,2,3,4,5,6,7,8,9]] (merge) s.remove(3) is [[1,2],[4,5,6,7,8,9]] (split) etc.

Note
This class is only available in Python.

Definition at line 1207 of file /tools.py.

Public Member Functions

def __init__
 index can be a integer or a list of integers More...
 
def add
 index can be a integer or a list of integers More...
 
def get_flatten
 Returns a flatten list. More...
 
def remove
 index can be a integer More...
 

Constructor & Destructor Documentation

def IMP.pmi1.tools.Segments.__init__ (   self,
  index 
)

index can be a integer or a list of integers

Definition at line 1224 of file /tools.py.

Member Function Documentation

def IMP.pmi1.tools.Segments.add (   self,
  index 
)

index can be a integer or a list of integers

Definition at line 1233 of file /tools.py.

def IMP.pmi1.tools.Segments.get_flatten (   self)

Returns a flatten list.

Definition at line 1283 of file /tools.py.

def IMP.pmi1.tools.Segments.remove (   self,
  index 
)

index can be a integer

Definition at line 1265 of file /tools.py.


The documentation for this class was generated from the following file: