Show
Ignore:
Timestamp:
07/04/11 01:41:54 (11 months ago)
Author:
mauro
Message:

plone 4.1

Location:
plone4bio.base/trunk/src/plone4bio/base
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • plone4bio.base/trunk/src/plone4bio/base/configure.zcml

    r175 r205  
    99    <!-- Poke dependencies --> 
    1010    <include package="collective.js.jqueryui" /> 
     11    <include package="Products.CMFCore" file="permissions.zcml" /> 
    1112 
    1213    <!-- Include sub-packages --> 
  • plone4bio.base/trunk/src/plone4bio/base/content/seqrecord.py

    r181 r205  
    9292            i18n_domain = "plone4bio") 
    9393    ), 
     94    # TODO: custom widget 
     95    atapi.StringField("dbxrefs", 
     96        required = False, 
     97        widget = atapi.LinesWidget( 
     98            label = "dbxrefs", 
     99            label_msgid = "dbxrefs_label", 
     100            description = "Database cross references", 
     101            description_msgid = "dbxrefs_help", 
     102            i18n_domain = "plone4bio") 
     103    ), 
    94104    )) 
    95105 
     
    105115    annotations = {} # TODO 
    106116    features = [] # TODO 
    107     dbxrefs = [] # TODO 
     117 
     118    # TODO: remove from here !!!! 
     119    def Sequences(self): 
     120        ''' 
     121        It tries to manage the storage of multiple sequences inside 
     122        the seqrecord. It is able to manage 2 types of multiple sequence: 
     123         - based on annotation-key: if in annotation key there is a key 
     124           named multiple-sequences, and the key is a list of string, one for 
     125           each sequence, where each string is of the type "label:start:end". 
     126             - "label" that is the label of the sequence used also for  
     127               the structure section (where the label is the chain) 
     128             - "start" and "end" that are respectively the start and end  
     129               position of each sequence inside the global sequence. 
     130         - based on separator (a separator inside the sequence is used to 
     131           separate the different sequences). It will use one of these 
     132           three separators: "#", ",", ";" 
     133        It returns a list of tuple, where each tuple is a 'label' and 
     134        a seq object (Bio.Seq.Seq instance). 
     135        ''' 
     136        ##start to split on multiple-sequence annotation key 
     137        seq = self.seqrecord.seq 
     138        seq_list = [] 
     139        if self.annotations.has_key('multiple-sequences'): 
     140               for label_start_end in self.annotations['multiple-sequences']: 
     141                        label,start,end = label_start_end.split(':') 
     142                        subseq = BioSeq(seq.data[int(start):int(end)], alphabet = seq.alphabet) 
     143                        seq_list.append((label, subseq)) 
     144        else: 
     145                listsep = ['#',',',';'] 
     146                separator = '' 
     147                for sep in listsep: 
     148                        if seq.data.rfind(sep):  separator = sep 
     149                if separator: 
     150                        seqs = seq.data.split(separator) 
     151                        for seqdata in seqs: 
     152                                ## if separator is multiple... exclude '' objects 
     153                                if seqdata: 
     154                                      subseq = BioSeq(seqdata, alphabet = seq.alphabet) 
     155                                      seq_list.append(('',subseq)) 
     156        ## if it didn't do any kind o split... return the whole seq 
     157        if not seq_list: seq_list.append(('',seq)) 
     158        return seq_list 
    108159     
    109160    def __init__(self, *args, **kw):