Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.fbb.msu.ru/hg/allpy/rev/59320c160dae
Дата изменения: Unknown
Дата индексирования: Tue Oct 2 00:20:33 2012
Кодировка:
allpy: 59320c160dae

allpy

changeset 282:59320c160dae

Fixed ReST warnings from docstrings in allpy.base
author Daniil Alexeyevsky <me.dendik@gmail.com>
date Wed, 15 Dec 2010 21:30:25 +0300
parents 1616830de2be
children 0f17438fafb7 bee4d155f526
files allpy/base.py
diffstat 1 files changed, 30 insertions(+), 24 deletions(-) [+]
line diff
     1.1 --- a/allpy/base.py	Wed Dec 15 20:40:10 2010 +0300
     1.2 +++ b/allpy/base.py	Wed Dec 15 21:30:25 2010 +0300
     1.3 @@ -99,8 +99,11 @@
     1.4  
     1.5      - `type`: type of monomer (a MonomerType object)
     1.6  
     1.7 -    class attribute `monomer_type` is MonomerType or either of it's subclasses,
     1.8 -    it is used when creating new monomers. It MUST be redefined when subclassing Monomer.
     1.9 +    class attributes:
    1.10 +
    1.11 +    - `monomer_type`: either MonomerType or one of it's subclasses, it is used
    1.12 +      when creating new monomers. It SHOULD be redefined when subclassing
    1.13 +      Monomer.
    1.14      """
    1.15      monomer_type = MonomerType
    1.16  
    1.17 @@ -137,6 +140,7 @@
    1.18      Any of them may be empty (i.e. hold empty string)
    1.19  
    1.20      Class attributes:
    1.21 +
    1.22      *   monomer_type -- type of monomers in sequence, must be redefined when
    1.23          subclassing
    1.24      """
    1.25 @@ -170,13 +174,9 @@
    1.26          return cls(monomers, name, description)
    1.27  
    1.28  class Alignment(dict):
    1.29 -    """ Alignment
    1.30 +    """Alignment.
    1.31  
    1.32 -        {<Sequence object>:[<Monomer object>,None,<Monomer object>]}
    1.33 -
    1.34 -        keys are the Sequence objects, values are the lists, which
    1.35 -        contain monomers of those sequences or None for gaps in the
    1.36 -        corresponding sequence of alignment
    1.37 +    Behaves like a list of Columns.
    1.38      """
    1.39      # _sequences -- list of Sequence objects. Sequences don't contain gaps
    1.40      #  - see sequence.py module
    1.41 @@ -184,12 +184,14 @@
    1.42      def __init__(self, *args):
    1.43          """overloaded constructor
    1.44  
    1.45 -        Alignment() -> new empty Alignment
    1.46 -        Alignment(sequences, body) -> new Alignment with sequences and
    1.47 -            body initialized from arguments
    1.48 -        Alignment(fasta_file) -> new Alignment, read body and sequences
    1.49 -             from fasta file
    1.50 +        Alignment()
    1.51 +            new empty Alignment
    1.52  
    1.53 +        Alignment(sequences, body)
    1.54 +            new Alignment with sequences and body initialized from arguments
    1.55 +
    1.56 +        Alignment(fasta_file)
    1.57 +            new Alignment, read body and sequences from fasta file
    1.58          """
    1.59          if len(args)>1:#overloaded constructor
    1.60              self.sequences=args[0]
    1.61 @@ -353,11 +355,12 @@
    1.62          """ returns list of columns of alignment
    1.63  
    1.64          sequence or sequences:
    1.65 -            if sequence is given, then column is (original_monomer, monomer)
    1.66 -            if sequences is given, then column is (original_monomer, {sequence: monomer})
    1.67 -            if both of them are given, it is an error
    1.68 +            * if sequence is given, then column is (original_monomer, monomer)
    1.69 +            * if sequences is given, then column is (original_monomer, {sequence: monomer})
    1.70 +            * if both of them are given, it is an error
    1.71 +
    1.72          original (Sequence type):
    1.73 -            if given, this filters only columns represented by original sequence
    1.74 +            * if given, this filters only columns represented by original sequence
    1.75          """
    1.76          if sequence and sequences:
    1.77              raise Exception("Wrong usage. read help")
    1.78 @@ -393,6 +396,7 @@
    1.79      Don't change self.sequences -- it may be a link to other block.sequences
    1.80  
    1.81      How to create a new block:
    1.82 +
    1.83      >>> import alignment
    1.84      >>> import block
    1.85      >>> proj = alignment.Alignment(open("test.fasta"))
    1.86 @@ -431,17 +435,19 @@
    1.87      ac_count=config.ac_count):
    1.88          """ Returns length-sorted list of blocks, representing GCs
    1.89  
    1.90 -        max_delta -- threshold of distance spreading
    1.91 -        timeout -- Bron-Kerbosh timeout (then fast O(n ln n) algorithm)
    1.92 -        minsize -- min size of each core
    1.93 -        ac_new_atoms -- min part or new atoms in new alternative core
    1.94 -            current GC is compared with each of already selected GCs
    1.95 -            if difference is less then ac_new_atoms, current GC is skipped
    1.96 +        * max_delta -- threshold of distance spreading
    1.97 +        * timeout -- Bron-Kerbosh timeout (then fast O(n ln n) algorithm)
    1.98 +        * minsize -- min size of each core
    1.99 +        * ac_new_atoms -- min part or new atoms in new alternative core
   1.100 +            current GC is compared with each of already selected GCs if
   1.101 +            difference is less then ac_new_atoms, current GC is skipped
   1.102              difference = part of new atoms in current core
   1.103 -        ac_count -- max number of cores (including main core)
   1.104 +        * ac_count -- max number of cores (including main core)
   1.105              -1 means infinity
   1.106 +
   1.107          If more than one pdb chain for some sequence provided, consider all of them
   1.108          cost is calculated as 1 / (delta + 1)
   1.109 +
   1.110              delta in [0, +inf) => cost in (0, 1]
   1.111          """
   1.112          nodes = self.positions