Changeset 149

Show
Ignore:
Timestamp:
08/05/10 18:28:38 (18 months ago)
Author:
mauro
Message:

plone4

Location:
plone4bio.base/trunk
Files:
2 added
1 removed
12 modified

Legend:

Unmodified
Added
Removed
  • plone4bio.base/trunk/docs/CHANGES.txt

    r141 r149  
    22plone4bio.base Changes 
    33====================== 
     4 
     5plone4bio.base 1.1.0 (unreleased) 
     6================================= 
     7 
     8Features 
     9-------- 
     10 
     11* works with Plone 4.x 
     12 
     13* use plone4bio.graphics instead BioPerl's stuff 
    414 
    515plone4bio.base 1.0.2 (2010-06-03) 
  • plone4bio.base/trunk/setup.py

    r128 r149  
    22import os 
    33 
    4 version = '1.0.2' 
     4version = '1.1.0' 
    55 
    66setup(name='plone4bio.base', 
     
    3333          'setuptools', 
    3434          # -*- Extra requirements: -*- 
     35          'plone.app.registry', 
     36          'collective.js.jqueryui', 
    3537          'numpy', 
    3638          'biopython', 
  • plone4bio.base/trunk/src/plone4bio/base/browser/configure.zcml

    r78 r149  
    121121        /> 
    122122 
     123    <browser:resourceDirectory 
     124        name="plone4bio.javascripts" 
     125        directory="javascripts" 
     126        /> 
     127 
    123128    <browser:resource 
    124129      name="plone4bio.css" 
  • plone4bio.base/trunk/src/plone4bio/base/browser/templates/annotations.pt

    r45 r149  
    1              <tal:annotations tal:define="annotations context/annotations; 
    2                                           keys python:annotations.keys(); 
    3                                           keystoignore python:[x for x in keys if x[-7:] == 'protein' ]; 
    4                                           keys python:list(set(keys).difference(['references','dbxref','dates','gi','id']+keystoignore)); 
    5                                           keysgroups python:[x.split('_')[0] for x in keys]; 
    6                                           keysgroups python:list(set(keysgroups)); 
    7                                           sorting python:keysgroups.sort()" 
    8                                 tal:repeat="keygroup keysgroups"> 
    9                                 <dl tal:attributes="id string:group-${keygroup}" class="collapsible inline collapsedOnLoad"> 
    10                                 <dt class="collapsibleHeader" tal:content="keygroup">keygroup</dt> 
    11                                 <dd class="collapsibleContent"> 
    12                                 <table class="listing" summary="Annotations" style="width:100%"> 
    13                                         <tr><th colspan="2" tal:content="keygroup"  style="text-align:left" style="width:100%"/></tr> 
    14                                         <tal:annotgroup  tal:define="subannots python:[key for key in keys if key.startswith(keygroup)]; 
    15                                                                      sorting python:subannots.sort();" 
    16                                                          tal:repeat="subannot subannots"> 
    17                                         <tr     style="width:100%" 
    18                                                 tal:define="oddrow repeat/subannot/odd; 
     1<div id="accordion-annotations"> 
     2    <tal:annotations tal:define="annotations context/annotations; 
     3                keys python:annotations.keys(); 
     4                            keystoignore python:[x for x in keys if x[-7:] == 'protein' ]; 
     5                            keys python:list(set(keys).difference(['references','dbxref','dates','gi','id']+keystoignore)); 
     6                            keysgroups python:[x.split('_')[0] for x in keys]; 
     7                            keysgroups python:list(set(keysgroups)); 
     8                            sorting python:keysgroups.sort()" 
     9                tal:repeat="keygroup keysgroups"> 
     10        <h3><a href="#" tal:content="keygroup">keygroup</a></h3> 
     11        <div> 
     12            <table class="listing" summary="Annotations" style="width:100%"> 
     13                            <tal:annotgroup tal:define="subannots python:[key for key in keys if key.startswith(keygroup)];  
     14                            sorting python:subannots.sort();" 
     15                                        tal:repeat="subannot subannots"> 
     16                                        <tr tal:define="oddrow repeat/subannot/odd; 
    1917                                                            annotdatas python:annotations[subannot];" 
    20                                                 tal:attributes="class python:(oddrow and 'even' or 'odd');"> 
    21                                                 <td tal:content="subannot" style="width:200px; max-width:200px"/> 
    22                                                 <td 
    23                                                     tal:condition="python:isinstance(annotdatas,list) and annotdatas"> 
    24                                                         <ul> 
     18                            tal:attributes="class python:(oddrow and 'even' or 'odd');"> 
     19                                                <td tal:content="subannot" /> 
     20                                                <td tal:condition="python:isinstance(annotdatas,list) and annotdatas"> 
     21                                                    <ul> 
    2522                                                            <tal:annotdata tal:define="annotlist python:[]; 
    2623                                                                                       annotlistspace python:[]; 
     
    2825                                                                                       insertspace python:[annotlistspace.append(', '.join(x.split(','))) for x in annotlist]" 
    2926                                                                           tal:repeat="annotdata annotlistspace"> 
    30                                                                 <li><span tal:content="annotdata" /></li> 
     27                                                                    <li tal:content="annotdata">annotation data</li> 
    3128                                                            </tal:annotdata> 
    32                                                         </ul> 
     29                                                    </ul> 
    3330                                                </td> 
    34                                                 <td  
    35                                                     tal:condition="python:isinstance(annotdatas,str) and annotdatas" > 
    36                                                         <ul> 
     31                                                <td tal:condition="python:isinstance(annotdatas,str) and annotdatas"> 
     32                            <ul> 
    3733                                                            <tal:annotdata  tal:define="annotlistspace python:[]; 
    3834                                                                                        annotdatas python:annotdatas.split('###'); 
    3935                                                                                        insertspace python:[annotlistspace.append(', '.join(x.split(','))) for x in annotdatas]" 
    4036                                                                            tal:repeat="annotdata annotlistspace"> 
    41                                                                 <li><span tal:content="annotdata" /></li> 
     37                                    <li tal:content="annotdata">annotation data</li> 
    4238                                                            </tal:annotdata> 
    43                                                         </ul> 
    44                                                 </td> 
     39                            </ul> 
     40                        </td> 
    4541                                        </tr> 
    46                                         </tal:annotgroup>                                        
    47                                 </table> 
    48                                 </dd> 
    49                                 </dl> 
    50  
    51              </tal:annotations> 
     42                                </tal:annotgroup>                                        
     43                        </table> 
     44                </div> 
     45    </tal:annotations> 
     46</div> 
  • plone4bio.base/trunk/src/plone4bio/base/browser/templates/features.pt

    r119 r149  
    11<div tal:define="featuredict context/features_dict"> 
    2              <tal:imagemap tal:content="structure context/@@imagemap" /> 
    3              <dl> 
    4              <dd>  
    5              <div align="center" > 
    6                  <img usemap="#graphicsmap" src="" tal:attributes="src string:${here/absolute_url}/features.png" /> 
    7              </div> 
    8              </dd> 
    9              </dl>  
    10              <tal:features tal:repeat="featuretype featuredict"> 
    11              <dl tal:attributes="id string:group-${featuretype}" class="collapsible inline collapsedOnLoad"> 
    12              <dt class="collapsibleHeader" tal:content="featuretype" >Feature</dt> 
    13              <dd class="collapsibleContent" > 
    14                   <div  tal:define="featureaccessiondict python:featuredict[featuretype];" 
    15                           class="listing" summary="Features" style="width:100%"> 
    16                           <tal:featuregroup tal:repeat="featureaccession featureaccessiondict"> 
    17                                 <table class="listing" summary="FeaturesAccession" style="width:100%" 
     2    <tal:imagemap tal:content="structure here/@@imagemap" /> 
     3    <div align="center" style="overflow: auto; "> 
     4        <img style="max-width: none;" usemap="#graphicsmap" src="" tal:attributes="src string:${here/absolute_url}/features.png" /> 
     5    </div> 
     6    <div id="accordion-features"> 
     7            <tal:features tal:repeat="featuretype featuredict"> 
     8            <h3><a href="#" tal:content="featuretype">group featuretype</a></h3> 
     9            <div tal:define="featureaccessiondict python:featuredict[featuretype];" 
     10                                class="listing" summary="Features" style="width:100%"> 
     11                            <tal:featuregroup tal:repeat="featureaccession featureaccessiondict"> 
     12                                    <table class="listing" summary="FeaturesAccession" style="width:100%" 
    1813                                                    tal:define="features python:featureaccessiondict[featureaccession]"> 
    19                                         <thead> 
    20                                             <tr><th colspan="3" style="text-align:left" style="width:100%"><b tal:content="featureaccession"/></th></tr> 
    21                                             <tr> 
     14                                            <thead> 
     15                            <tr><th class="nosort" colspan="3" tal:content="featureaccession">feature accession</th></tr> 
     16                                                <tr> 
    2217                                                <th class="nosort">type</th> 
    2318                                                <th class="nosort">location</th> 
    2419                                                <th class="nosort">qualifiers</th> 
    25                                             </tr> 
    26                                         </thead> 
    27                                         <tbody> 
    28                                             <tal:features tal:repeat="feature features"> 
    29                                                 <tr 
    30                                                         tal:define="oddrow repeat/feature/odd; 
    31                                                                     start python:'Start: ' + str(feature.location.start.position + 1); 
    32                                                                     end python:'End: ' + str(feature.location.end.position);" 
    33                                                         tal:attributes="class python:(oddrow and 'even' or 'odd')"> 
    34                                                         <td><b tal:content="feature/type" /></td> 
    35                                                         <td tal:content="python:start + ' : ' + end" /> 
    36                                                         <td> 
    37                                                                 <ul> 
    38                                                                 <tal:qualifiers tal:repeat="key feature/qualifiers/keys"> 
    39                                                                         <li tal:condition="python:isinstance(feature.qualifiers[key],list)"> 
    40                                                                                 <b tal:content="key" />: <span tal:content="python:feature.qualifiers[key][0]" /> 
    41                                                                         </li> 
    42                                                                         <li tal:condition="python:isinstance(feature.qualifiers[key],str)"> 
    43                                                                                 <b tal:content="key" />: <span tal:content="python:feature.qualifiers[key]" /> 
    44                                                                         </li> 
    45                                                                 </tal:qualifiers> 
    46                                                                 </ul> 
    47                                                         </td> 
    48                                                 </tr> 
    49                                                 </tal:features>  
     20                            </tr> 
     21                                            </thead> 
     22                                            <tbody> 
     23                                                <tal:features tal:repeat="feature features"> 
     24                                                    <tr tal:define="oddrow repeat/feature/odd; 
     25                                                                            start python:'Start: ' + str(feature.location.start.position + 1); 
     26                                            end python:'End: ' + str(feature.location.end.position);" 
     27                                            tal:attributes="class python:(oddrow and 'even' or 'odd')"> 
     28                                                                <td><strong tal:content="feature/type" /></td> 
     29                                        <td tal:content="python:start + ' : ' + end" /> 
     30                                    <td> 
     31                                            <ul> 
     32                                            <tal:qualifiers tal:repeat="key feature/qualifiers/keys"> 
     33                                                <li tal:condition="python:isinstance(feature.qualifiers[key],list)"> 
     34                                                                                            <strong tal:content="key" />: <span tal:content="python:feature.qualifiers[key][0]" /> 
     35                                                                                    </li> 
     36                                                                                    <li tal:condition="python:isinstance(feature.qualifiers[key],str)"> 
     37                                                    <strong tal:content="key" />: <span tal:content="python:feature.qualifiers[key]" /> 
     38                                                 </li> 
     39                                                </tal:qualifiers> 
     40                                                </ul> 
     41                                        </td> 
     42                                        </tr> 
     43                                                    </tal:features>  
    5044                                                </tbody> 
    51                                 </table> 
    52                           </tal:featuregroup> 
    53                     </div> 
    54               </dd> 
    55               </dl> 
    56               </tal:features> 
    57          
     45                                    </table> 
     46                            </tal:featuregroup> 
     47            </div> 
     48        </tal:features>  
     49    </div>     
    5850</div> 
  • plone4bio.base/trunk/src/plone4bio/base/browser/templates/seqrecord.pt

    r78 r149  
    1 <html xmlns="http://www.w3.org/1999/xhtml" 
    2       xmlns:metal="http://xml.zope.org/namespaces/metal" 
    3       xmlns:tal="http://xml.zope.org/namespaces/tal" 
    4       xmlns:i18n="http://xml.zope.org/namespaces/i18n" 
    5       metal:use-macro="context/@@standard_macros/page" 
     1<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" 
     2      lang="en" 
     3      metal:use-macro="here/main_template/macros/master" 
    64      i18n:domain="plone4bio"> 
    75<head> 
     
    97 
    108<body> 
    11         <div metal:fill-slot="body"> 
    12    
    13     <h1 class="documentFirstHeading" tal:content="context/title" /> 
     9  <div metal:fill-slot="main"> 
     10    <metal:main-macro define-macro="main"> 
    1411 
     12        <div tal:replace="structure provider:plone.abovecontenttitle" /> 
     13 
     14        <h1 tal:content="object_title|nothing" class="documentFirstHeading"> 
     15            Title or id 
     16        </h1> 
     17 
     18        <div tal:replace="structure provider:plone.belowcontenttitle" /> 
     19 
     20        <a href="" 
     21           class="link-parent" 
     22           tal:define="parent_url python:here.navigationParent(here)" 
     23           tal:condition="parent_url" 
     24           tal:attributes="href parent_url" 
     25           i18n:translate="go_to_parent_url"> 
     26        Up one level 
     27        </a> 
     28 
     29        <div tal:replace="structure provider:plone.abovecontentbody" /> 
    1530 
    1631    <table class="listing vertical" summary="Main" style="width:100%"> 
     
    4863    <dl class="enableFormTabbing"> 
    4964                <dt id="fieldsetlegend-annotations" tal:condition="context/annotations">Annotations</dt> 
    50         <dd id="fieldset-annotations" tal:condition="context/annotations" tal:content="structure context/@@annotations" />            
     65        <dd id="fieldset-annotations" tal:condition="context/annotations" tal:content="structure here/@@annotations" />       
    5166        <dt id="fieldsetlegend-features" tal:condition="context/features">Features</dt> 
    52         <dd id="fieldset-features" tal:condition="context/features" tal:content="structure context/@@features" />             
     67        <dd id="fieldset-features" tal:condition="context/features" tal:content="structure here/@@features" />        
    5368        <dt id="fieldsetlegend-dbxrefs" tal:condition="context/dbxrefs">Dbxrefs</dt> 
    54         <dd id="fieldset-dbxrefs" tal:condition="context/dbxrefs" tal:content="structure context/@@dbxrefs" /> 
     69        <dd id="fieldset-dbxrefs" tal:condition="context/dbxrefs" tal:content="structure here/@@dbxrefs" /> 
    5570                <dt id="fieldsetlegend-sequence">Sequences</dt> 
    5671        <dd id="fieldset-sequence"> 
     
    85100                 
    86101        </dd> 
    87         <dt id="fieldsetlegend-references" tal:condition="context/annotations/references|python:False">References</dt> 
    88         <dd id="fieldset-references"  tal:condition="context/annotations/references|python:False"> 
    89              <ul tal:define="annotations context/annotations;" 
    90                  tal:condition="python:annotations.has_key('references')"> 
    91                  <tal:reference  tal:define="references python:annotations['references'];" 
    92                                    tal:repeat="ref references"> 
    93                       <li tal:define="title python:ref.title; 
    94                                       refdict python:{}; 
    95                                       authors python:refdict.update({'Authors' : ref.authors}); 
    96                                       journal python:refdict.update({'Journal' : ref.journal}); 
    97                                       location python:refdict.update({'Location' : ref.location}); 
    98                                       medline python:refdict.update({'Medline' : ref.medline_id}); 
    99                                       pubmed python:refdict.update({'Pubmed' : ref.pubmed_id}); 
    100                                       comment python:refdict.update({'Comment' : ref.comment}); 
    101                                       crc python:refdict.update({'CRC' : ref.consrtm}); 
    102                                       fields python:['Authors','Journal','Comment','Medline','Pubmed','Location','CRC']; 
    103                                       fields python:[x for x in fields if refdict[x]];"> 
    104                              <table class="listing" summary="References" style="width:100%"> 
    105                                         <tr><th colspan="2" tal:content="python:'Title: ' + title"  style="text-align:left" style="width:100%"/></tr> 
     102            <dt id="fieldsetlegend-references" tal:condition="context/annotations/references|nothing">References</dt> 
     103        <dd id="fieldset-references"  tal:condition="context/annotations/references|nothing"> 
     104            <tal:annotations tal:define="annotations context/annotations;" 
     105                            tal:condition="python:annotations.has_key('references')"> 
     106                <tal:reference  tal:define="references python:annotations['references'];" 
     107                                        tal:repeat="ref references"> 
     108                    <div tal:define="title python:ref.title; 
     109                                              refdict python:{}; 
     110                                              authors python:refdict.update({'Authors' : ref.authors}); 
     111                                              journal python:refdict.update({'Journal' : ref.journal}); 
     112                                              location python:refdict.update({'Location' : ref.location}); 
     113                                              medline python:refdict.update({'Medline' : ref.medline_id}); 
     114                                              pubmed python:refdict.update({'Pubmed' : ref.pubmed_id}); 
     115                                              comment python:refdict.update({'Comment' : ref.comment}); 
     116                                              crc python:refdict.update({'CRC' : ref.consrtm}); 
     117                                              fields python:['Authors','Journal','Comment','Medline','Pubmed','Location','CRC']; 
     118                                              fields python:[x for x in fields if refdict[x]];"> 
     119                        <table class="listing" summary="References" style="width:100%"> 
     120                            <tr><th colspan="2" tal:content="python:'Title: ' + title"  style="text-align:left" style="width:100%"/></tr> 
    106121                                        <tal:refdields   tal:repeat="field fields"> 
    107122                                        <tr     tal:define="oddrow repeat/field/odd;" 
     
    134149                                </table> 
    135150 
    136                         </li> 
     151                        </div> 
    137152                 </tal:reference> 
    138              </ul> 
     153            </tal:annotations> 
    139154        </dd> 
    140155    </dl>     
     156    </metal:main-macro> 
     157 
    141158</div> 
    142159</body> 
  • plone4bio.base/trunk/src/plone4bio/base/configure.zcml

    r45 r149  
    88 
    99    <!-- Poke dependencies --> 
     10    <include package="plone.app.registry" /> 
     11    <include package="collective.js.jqueryui" /> 
    1012 
    1113    <!-- Include sub-packages --> 
  • plone4bio.base/trunk/src/plone4bio/base/content/configure.zcml

    r45 r149  
    1616        name="plone4bio.base.SeqRecord" 
    1717        /> 
     18 
     19    <!-- 
     20    <adapter factory=".seqrecord.SeqRecordSearchableText" /> 
     21    --> 
    1822 
    1923    <class class=".seqrecord.SeqRecord"> 
  • plone4bio.base/trunk/src/plone4bio/base/content/seqrecord.py

    r45 r149  
    66 
    77from zope.interface import implements 
     8from zope.component import adapts 
    89from zope.component.factory import Factory 
    910from zope.schema.fieldproperty import FieldProperty 
     11# from zope.index.text.interfaces import ISearchableText 
    1012 
    1113from plone.locking.interfaces import ITTWLockable 
     
    4345    def __init__(self, seq=None): 
    4446        super(SeqRecordProxy, self).__init__(seq) 
    45          
     47 
     48""" 
     49class SeqRecordSearchableText(object): 
     50    adapts(ISeqRecord) 
     51    implements(ISearchableText) 
     52 
     53    def __init__(self, seqrecord): 
     54        self.seqrecord = seqrecord 
     55 
     56    def getSearchableText(self): 
     57        return u' '.join( 
     58            unicode(v) for v in self.seqrecord.dbxrefs) 
     59""" 
     60 
    4661# TODO 
    4762class SeqRecord(Item): 
     
    6176 
    6277    def __init__(self, *args, **kwargs): 
     78        import pdb; pdb.set_trace() 
    6379        seqrecord = None 
    6480        if kwargs.has_key('seqrecord'): 
    6581            seqrecord = kwargs['seqrecord'] 
    6682            del(kwargs['seqrecord']) 
     83        if kwargs.has_key('parent'): 
     84            parent = kwargs['parent'] 
     85            del(kwargs['parent']) 
     86        kwargs['title'] = unicode(kwargs.get('title', '')) 
    6787        super(SeqRecord, self).__init__(*args, **kwargs) 
    6888        if seqrecord: 
     
    7393    def Accession(self): 
    7494        return self.id 
    75      
     95 
    7696    def Name(self): 
    7797        return self.title 
     
    82102        else: 
    83103            return None 
    84          
     104 
    85105    @property 
    86106    def seqrecord(self): 
     
    288308            return {} 
    289309    """ 
    290      
     310 
    291311seqRecordFactory = Factory(SeqRecord, title=_(u"Create a new SeqRecord")) 
  • plone4bio.base/trunk/src/plone4bio/base/png/seqrecord.py

    r119 r149  
    1111from plone4bio.base.png.interfaces import IImagemapPresentation 
    1212 
    13 from StringIO import StringIO 
     13from Bio import SeqIO 
     14from cStringIO import StringIO 
     15import logging 
    1416 
    15 # BioPerl 
    16 import subprocess 
    17 import os 
    18 from Bio import SeqIO 
     17logger = logging.getLogger('plone4bio.base') 
     18 
     19try: 
     20    from plone4bio.graphics.seqrecord import SeqRecordDrawer 
     21    has_plone4bio_graphics = True 
     22except ImportError: 
     23    logger.warning("missing plone4bio.graphics") 
     24    # BioPerl 
     25    import subprocess 
     26    import os 
     27    has_plone4bio_graphics = False 
     28 
     29 
     30@adapter(ISeqRecord, IRequest) 
     31@implementer(IImagemapPresentation) 
     32def seqrecordImagemap(context, request): 
     33    # FIXME: XXX 
     34    context.Description() 
     35    seqrecord = context.seqrecord 
     36    if has_plone4bio_graphics: 
     37        imagemap = """<map name="graphicsmap" id="graphicsmap">\n""" 
     38        for box in SeqRecordDrawer(seqrecord, fig_width=1500).boxes(): 
     39            box['start'] = box['feature'].start 
     40            box['end'] = box['feature'].end 
     41            box['tag'] = box['feature'].name 
     42            # my $tag = eval {$feature->method} || $feature->primary_tag; 
     43            # $left += $pad_left; 
     44            # $right += $pad_left; 
     45            # next unless $tag; 
     46            imagemap = imagemap + \ 
     47                """<area class="tips" shape="rect" """  \ 
     48                """coords="%(left)i,%(top)i,%(right)i,%(bottom)i" href="#" """  \ 
     49                """rel="#%(tag)sX%(start)sX$%(end)s" title="%(tag)s %(start)s:%(end)s" alt="" />""" \ 
     50                % box 
     51        imagemap = imagemap + "</map>\n" 
     52        return imagemap 
     53    else: 
     54        # BIOPERL 
     55        perlpath = os.sep.join((os.path.dirname(__file__), "perl")) 
     56        cmd = ["perl", "-I"+ perlpath, os.sep.join((perlpath, "graphics-imagemap-cmd.pl")), "-"] 
     57        graphics = subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE) 
     58        genbank=StringIO() 
     59        seqrecord.name = seqrecord.name[:16] 
     60        for f in seqrecord.features: 
     61            f.type = f.type.replace(" ", "_") 
     62        SeqIO.write([seqrecord, ], genbank, "genbank") 
     63        (stdoutdata, stderrdata) = graphics.communicate(genbank.getvalue()) 
     64        return stdoutdata 
     65 
     66@adapter(ISeqRecord, IRequest) 
     67@implementer(IPNGPresentation) 
     68def seqrecordPNG(context, request): 
     69    # FIXME: XXX 
     70    context.Description() 
     71    seqrecord = context.seqrecord 
     72    if has_plone4bio_graphics: 
     73        imgdata=StringIO() 
     74        SeqRecordDrawer(seqrecord, fig_width=1500).save(imgdata, format='PNG') 
     75        return imgdata.getvalue() 
     76    else: 
     77        # BioPerl 
     78        # prediction.getDataCharts() = 
     79        # [{'chart':(line,bar,...),'data':[(x,y),(x,y),...}, ...] 
     80        perlpath = os.sep.join((os.path.dirname(__file__), "perl")) 
     81        cmd = ["perl", "-I"+ perlpath, os.sep.join((perlpath, "graphics-cmd.pl")), "-"] 
     82        graphics = subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE) 
     83        genbank=StringIO() 
     84        seqrecord.name = seqrecord.name[:16] 
     85        for f in seqrecord.features: 
     86            f.type = f.type.replace(" ", "_") 
     87            SeqIO.write([seqrecord, ], genbank, "genbank") 
     88            (stdoutdata, stderrdata) = graphics.communicate(genbank.getvalue()) 
     89        return stdoutdata 
    1990 
    2091class PNGFeaturesView(BrowserPage): 
     
    2798class ImagemapFeaturesView(BrowserView): 
    2899    def __call__(self): 
    29         return getMultiAdapter((self.context, self.request), IImagemapPresentation) 
     100        return seqrecordImagemap(self.context, self.request) 
     101        # return getMultiAdapter((self.context, self.request), IImagemapPresentation) 
    30102 
    31 # TODO: refactoring with genometools (?) 
    32 @adapter(ISeqRecord, IRequest) 
    33 @implementer(IImagemapPresentation) 
    34 def seqrecordImagemap(context, request): 
    35     perlpath = os.sep.join((os.path.dirname(__file__), "perl")) 
    36     cmd = ["perl", "-I"+ perlpath, os.sep.join((perlpath, "graphics-imagemap-cmd.pl")), "-"] 
    37     graphics = subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE) 
    38     # FIXME: XXX 
    39     context.Description() 
    40     genbank=StringIO() 
    41     seqrecord = context.seqrecord 
    42     seqrecord.name = seqrecord.name[:16] 
    43     for f in seqrecord.features: 
    44         f.type = f.type.replace(" ", "_") 
    45     SeqIO.write([seqrecord, ], genbank, "genbank") 
    46     (stdoutdata, stderrdata) = graphics.communicate(genbank.getvalue()) 
    47     return stdoutdata 
    48  
    49 # TODO: refactoring with genometools (?) 
    50 @adapter(ISeqRecord, IRequest) 
    51 @implementer(IPNGPresentation) 
    52 def seqrecordPNG(context, request): 
    53     # prediction.getDataCharts() = [{'chart':(line,bar,...),'data':[(x,y),(x,y),...}, ...] 
    54  
    55     # BioPerl 
    56     perlpath = os.sep.join((os.path.dirname(__file__), "perl")) 
    57     cmd = ["perl", "-I"+ perlpath, os.sep.join((perlpath, "graphics-cmd.pl")), "-"] 
    58     graphics = subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE) 
    59     # FIXME: XXX 
    60     context.Description() 
    61     genbank=StringIO() 
    62     seqrecord = context.seqrecord 
    63     seqrecord.name = seqrecord.name[:16] 
    64     for f in seqrecord.features: 
    65         f.type = f.type.replace(" ", "_") 
    66     SeqIO.write([seqrecord, ], genbank, "genbank") 
    67     (stdoutdata, stderrdata) = graphics.communicate(genbank.getvalue()) 
    68     return stdoutdata 
  • plone4bio.base/trunk/src/plone4bio/base/profiles/default/jsregistry.xml

    r45 r149  
    1010    enabled="1" expression="" id="++resource++plone4bio-imagemap.js" 
    1111    insert-after="jquery.js" /> 
     12 <javascript cacheable="True" compression="safe" cookable="True" 
     13    enabled="1" expression="" id="++resource++plone4bio.javascripts/plone4bio.js" 
     14    insert-after="jquery.js" /> 
    1215</object> 
    1316 
  • plone4bio.base/trunk/src/plone4bio/base/profiles/default/metadata.xml

    r45 r149  
    22<metadata> 
    33  <version>1.0.1</version> 
     4  <dependencies> 
     5    <dependency>profile-plone.app.registry:default</dependency> 
     6  </dependencies> 
    47</metadata> 
    58