IMP logo
IMP Reference Guide  2.17.0
The Integrative Modeling Platform
IMP.pmi.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 680 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.pmi.tools.Segments.__init__ (   self,
  index 
)

index can be a integer or a list of integers

Definition at line 697 of file tools.py.

Member Function Documentation

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

index can be a integer or a list of integers

Definition at line 708 of file tools.py.

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

Returns a flatten list.

Definition at line 761 of file tools.py.

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

index can be a integer

Definition at line 743 of file tools.py.


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