Changeset 171 for plone4bio.base/trunk
- Timestamp:
- 10/03/10 16:58:48 (20 months ago)
- Location:
- plone4bio.base/trunk
- Files:
-
- 18 added
- 1 removed
- 38 modified
-
bootstrap.py (modified) (1 prop)
-
docs/CHANGES.txt (modified) (2 diffs)
-
setup.py (modified) (1 diff, 1 prop)
-
src/plone4bio/__init__.py (modified) (1 prop)
-
src/plone4bio/base/Extensions/Install.py (modified) (1 prop)
-
src/plone4bio/base/__init__.py (modified) (2 diffs, 1 prop)
-
src/plone4bio/base/atct.py (modified) (1 diff, 1 prop)
-
src/plone4bio/base/browser/__init__.py (modified) (1 prop)
-
src/plone4bio/base/browser/configure.zcml (modified) (5 diffs)
-
src/plone4bio/base/browser/container.py (modified) (4 diffs, 1 prop)
-
src/plone4bio/base/browser/css/plone4bio.css (modified) (1 diff)
-
src/plone4bio/base/browser/fasta.py (added)
-
src/plone4bio/base/browser/genbank.py (added)
-
src/plone4bio/base/browser/images/plone4bio_icon.png (added)
-
src/plone4bio/base/browser/interfaces.py (modified) (2 diffs, 1 prop)
-
src/plone4bio/base/browser/predictor.py (modified) (1 diff, 1 prop)
-
src/plone4bio/base/browser/seqrecord.py (modified) (7 diffs, 1 prop)
-
src/plone4bio/base/browser/templates/seqrecord.pt (modified) (2 diffs)
-
src/plone4bio/base/browser/viewlets (added)
-
src/plone4bio/base/browser/viewlets/__init__.py (added)
-
src/plone4bio/base/browser/viewlets/configure.zcml (added)
-
src/plone4bio/base/browser/viewlets/interfaces.py (added)
-
src/plone4bio/base/browser/viewlets/seqrecord.py (added)
-
src/plone4bio/base/browser/viewlets/templates (added)
-
src/plone4bio/base/browser/viewlets/templates/sequence.pt (added)
-
src/plone4bio/base/config.py (added)
-
src/plone4bio/base/configure.zcml (modified) (2 diffs)
-
src/plone4bio/base/content/__init__.py (modified) (1 prop)
-
src/plone4bio/base/content/configure.zcml (modified) (2 diffs)
-
src/plone4bio/base/content/seqrecord.py (modified) (8 diffs, 1 prop)
-
src/plone4bio/base/controlpanel (added)
-
src/plone4bio/base/controlpanel/__init__.py (added)
-
src/plone4bio/base/controlpanel/configure.zcml (added)
-
src/plone4bio/base/controlpanel/dbxrefpattern.pt (added)
-
src/plone4bio/base/fields.py (deleted)
-
src/plone4bio/base/interfaces.py (modified) (1 diff, 1 prop)
-
src/plone4bio/base/png/__init__.py (modified) (1 prop)
-
src/plone4bio/base/png/cluetip/cluetip/jquery.cluetip.css (modified) (1 diff)
-
src/plone4bio/base/png/configure.zcml (modified) (2 diffs)
-
src/plone4bio/base/png/interfaces.py (modified) (1 prop)
-
src/plone4bio/base/png/seqrecord.py (modified) (5 diffs, 1 prop)
-
src/plone4bio/base/predictor.py (modified) (6 diffs, 1 prop)
-
src/plone4bio/base/profiles/default/componentregistry.xml (modified) (1 diff)
-
src/plone4bio/base/profiles/default/controlpanel.xml (added)
-
src/plone4bio/base/profiles/default/metadata.xml (modified) (1 diff)
-
src/plone4bio/base/profiles/default/toolset.xml (modified) (1 diff)
-
src/plone4bio/base/profiles/default/types/SeqRecord.xml (modified) (3 diffs)
-
src/plone4bio/base/profiles/default/viewlets.xml (added)
-
src/plone4bio/base/tests/__init__.py (modified) (1 prop)
-
src/plone4bio/base/tests/base.py (modified) (1 prop)
-
src/plone4bio/base/tests/test_integration.py (modified) (1 prop)
-
src/plone4bio/base/tool/__init__.py (modified) (1 diff, 1 prop)
-
src/plone4bio/base/tool/configure.zcml (modified) (2 diffs)
-
src/plone4bio/base/tool/dbxref.py (added)
-
src/plone4bio/base/tool/exportimport.py (modified) (2 diffs, 1 prop)
-
src/plone4bio/base/tool/predictor.py (modified) (1 prop)
-
test-plone-4.0.x.cfg (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
plone4bio.base/trunk/bootstrap.py
- Property svn:keywords set to Date Revision Author Id
-
plone4bio.base/trunk/docs/CHANGES.txt
r149 r171 3 3 ====================== 4 4 5 plone4bio.base 1.1.0 (unreleased)5 plone4bio.base 1.1.0rc1 (2010-10-03) 6 6 ================================= 7 7 … … 11 11 * works with Plone 4.x 12 12 13 * use plone4bio.graphics instead BioPerl's stuff 13 * experimental support for biograpy (http://github.com/apierleoni/BioGraPy) 14 15 * plone4bio.SeqRecordViewletManager added 16 17 * manage dbxref patterns via controlpanel and genericsetup 18 19 * experimental support for genbank upload 14 20 15 21 plone4bio.base 1.0.2 (2010-06-03) -
plone4bio.base/trunk/setup.py
- Property svn:keywords set to Date Revision Author Id
r161 r171 2 2 import os 3 3 4 version = '1.1.0 '4 version = '1.1.0rc1' 5 5 6 6 setup(name='plone4bio.base', -
plone4bio.base/trunk/src/plone4bio/__init__.py
- Property svn:keywords set to Date Revision Author Id
-
plone4bio.base/trunk/src/plone4bio/base/Extensions/Install.py
- Property svn:keywords set to Date Revision Author Id
-
plone4bio.base/trunk/src/plone4bio/base/__init__.py
- Property svn:keywords set to Date Revision Author Id
r78 r171 1 import logging 2 logger = logging.getLogger("plone4bio.base") 3 logger.debug('Start initialization of product.') 4 5 from Products.CMFCore import utils as cmfutils 6 7 from Products.CMFCore import DirectoryView 8 from Products.Archetypes.atapi import process_types 9 from Products.Archetypes import listTypes 10 11 from config import PROJECTNAME 12 from config import DEFAULT_ADD_CONTENT_PERMISSION 13 from config import ADD_CONTENT_PERMISSIONS 14 from config import product_globals 15 1 16 from zope.i18nmessageid import MessageFactory 2 17 Plone4BioMessageFactory = MessageFactory('plone4bio') 18 3 19 4 20 class Plone4BioException(Exception): … … 7 23 def initialize(context): 8 24 """Intializer called when used as a Zope 2 product.""" 25 # imports packages and types for registration 26 import interfaces 27 import content 28 29 # Initialize portal content 30 all_content_types, all_constructors, all_ftis = process_types( 31 listTypes(PROJECTNAME), 32 PROJECTNAME) 33 34 cmfutils.ContentInit( 35 PROJECTNAME + ' Content', 36 content_types=all_content_types, 37 permission=DEFAULT_ADD_CONTENT_PERMISSION, 38 extra_constructors=all_constructors, 39 fti=all_ftis, 40 ).initialize(context) 41 42 # Give it some extra permissions to control them on a per class limit 43 for i in range(0, len(all_content_types)): 44 klassname = all_content_types[i].__name__ 45 if not klassname in ADD_CONTENT_PERMISSIONS: 46 continue 47 48 context.registerClass(meta_type=all_ftis[i]['meta_type'], 49 constructors=(all_constructors[i],), 50 permission=ADD_CONTENT_PERMISSIONS[klassname]) -
plone4bio.base/trunk/src/plone4bio/base/atct.py
- Property svn:keywords set to Date Revision Author Id
r152 r171 1 # -*- coding: utf-8 -*- 2 # 3 # File: atct.py 4 # 5 # Copyright (c) 2010 by Mauro Amico (Biodec Srl) 6 # 7 # GNU General Public License (GPL) 8 # 9 # This program is free software; you can redistribute it and/or 10 # modify it under the terms of the GNU General Public License 11 # as published by the Free Software Foundation; either version 2 12 # of the License, or (at your option) any later version. 13 # 14 # This program is distributed in the hope that it will be useful, 15 # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 # GNU General Public License for more details. 18 # 19 # You should have received a copy of the GNU General Public License 20 # along with this program; if not, write to the Free Software 21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 22 # 02110-1301, USA. 23 # 24 # @version $Revision$: 25 # @author $Author$: 26 # @date $Date$: 27 28 __author__ = '''Mauro Amico <mauro@biodec.com>''' 29 __docformat__ = 'plaintext' 30 1 31 from zope.interface import implements 2 from zope.component import adapts 3 from zope.filerepresentation.interfaces import IFileFactory 4 from plone4bio.base.interfaces import ISeqRecordContainer 32 from Bio import SeqIO 33 from plone4bio.base.interfaces import ISeqRecordUploader 5 34 6 # TODO 35 7 36 class UploadingFileFactory(object): 8 implements(IFileFactory) 9 adapts(ISeqRecordContainer) 37 implements(ISeqRecordUploader) 10 38 11 DEFAULT_TYPE = ' GFF File'39 DEFAULT_TYPE = 'genbank' 12 40 13 41 def __init__(self, context): 14 42 self.context = context 15 43 16 def __call__(self, name, content_type, data): 17 # import pdb; pdb.set_trace() 18 pass 19 20 def loadData(self, *args, **kwargs): 21 # import pdb; pdb.set_trace() 22 pass 23 44 def loadData(self, data, data_type=DEFAULT_TYPE): 45 if data_type.lower() == 'genbank': 46 for seqr in SeqIO.parse(data, "genbank"): 47 newid = self.context.invokeFactory('SeqRecord', seqr.id, title=seqr.name) 48 obj = getattr(self.context, newid) 49 obj.sequence = seqr.seq.tostring() 50 obj.alphabet = str(seqr.seq.alphabet.__class__) 51 obj.features = seqr.features 52 obj.annotations = seqr.annotations 53 else: 54 raise -
plone4bio.base/trunk/src/plone4bio/base/browser/__init__.py
- Property svn:keywords set to Date Revision Author Id
-
plone4bio.base/trunk/src/plone4bio/base/browser/configure.zcml
r149 r171 2 2 xmlns:browser="http://namespaces.zope.org/browser"> 3 3 4 <!-- 5 <include package="plone4bio" file="permissions.zcml" /> 6 --> 7 8 <!-- new --> 9 4 <include package=".viewlets" /> 5 10 6 <browser:page 11 7 for="..interfaces.ISeqRecord" … … 39 35 <browser:page 40 36 for="..interfaces.ISeqRecord" 41 name="edit"42 class=".seqrecord.SeqRecordEditForm"43 permission="cmf.ModifyPortalContent"44 />45 46 <browser:page47 for="..interfaces.ISeqRecord"48 37 name="predictors" 49 38 class=".seqrecord.SeqRecordPredictors" … … 61 50 /> 62 51 63 <!-- TODO:adapter -->64 52 <browser:page 65 53 for="..interfaces.ISeqRecord" 66 name="gbk"67 class=". seqrecord.SeqRecord2Genbank"54 name="gbk" 55 class=".genbank.SeqRecord2Genbank" 68 56 permission="zope2.View" 69 57 /> 70 58 71 <!-- TODO:adapter -->72 59 <browser:page 73 60 for="..interfaces.ISeqRecord" 74 61 name="fasta" 75 class=". seqrecord.SeqRecord2Fasta"62 class=".fasta.SeqRecord2Fasta" 76 63 permission="zope2.View" 77 64 /> … … 83 70 class=".container.LoadForm" 84 71 permission="cmf.ModifyPortalContent" 85 />86 87 <browser:page88 for="zope.app.container.interfaces.IAdding"89 name="plone4bio.base.SeqRecord"90 class=".seqrecord.SeqRecordAddForm"91 permission="cmf.AddPortalContent"92 72 /> 93 73 … … 138 118 /> 139 119 120 <browser:resource 121 name="plone4bio_icon.png" 122 file="images/plone4bio_icon.png" 123 permission="zope2.View" 124 /> 125 140 126 </configure> -
plone4bio.base/trunk/src/plone4bio/base/browser/container.py
- Property svn:keywords set to Date Revision Author Id
r45 r171 1 # -*- coding: utf-8 -*- 2 # 3 # File: container.py 4 # 5 # Copyright (c) 2010 by Mauro Amico (Biodec Srl) 6 # 7 # GNU General Public License (GPL) 8 # 9 # This program is free software; you can redistribute it and/or 10 # modify it under the terms of the GNU General Public License 11 # as published by the Free Software Foundation; either version 2 12 # of the License, or (at your option) any later version. 13 # 14 # This program is distributed in the hope that it will be useful, 15 # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 # GNU General Public License for more details. 18 # 19 # You should have received a copy of the GNU General Public License 20 # along with this program; if not, write to the Free Software 21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 22 # 02110-1301, USA. 23 # 24 # @version $Revision$: 25 # @author $Author$: 26 # @date $Date$: 27 28 __author__ = '''Mauro Amico <mauro@biodec.com>''' 29 __docformat__ = 'plaintext' 30 1 31 2 32 from datetime import datetime … … 7 37 from plone4bio.base import Plone4BioMessageFactory as _ 8 38 from plone4bio.base.interfaces import ISeqRecordContainer 39 from plone4bio.base.interfaces import ISeqRecordUploader 9 40 10 # TODO XXX41 # TODO: 11 42 def guess_dbtype(filename): 12 43 return "GenBank" … … 31 62 32 63 def upload_data(self, data, dbtype): 33 # formatter = self.request.locale.dates.getFormatter( 34 # 'dateTime', 'medium') 35 error = ISeqRecordContainer(self.context).loadData(data, dbtype) 64 error = ISeqRecordUploader(self.context).loadData(data, dbtype) 36 65 if error: 37 66 return error … … 63 92 url = Acquisition.aq_parent(context).absolute_url() 64 93 return url + '/@@load' 65 -
plone4bio.base/trunk/src/plone4bio/base/browser/css/plone4bio.css
r45 r171 1 1 /* <dtml-with base_properties> */ 2 2 3 /* plone4bio-controlpanel */ 4 .fieldstyle-name { float: left; } 5 .fieldstyle-pattern { float: left; } 6 .fieldstyle-pattern input { width: 400px; } 7 8 /* */ 3 9 span.T { color: #f7d565; } 4 10 span.I { color: #61b5ce; } -
plone4bio.base/trunk/src/plone4bio/base/browser/interfaces.py
- Property svn:keywords set to Date Revision Author Id
r45 r171 1 __author__ = """Mauro Amico <amico@biodec.com>""" 1 # -*- coding: utf-8 -*- 2 # 3 # File: interfaces.py 4 # 5 # Copyright (c) 2010 by Mauro Amico (Biodec Srl) 6 # 7 # GNU General Public License (GPL) 8 # 9 # This program is free software; you can redistribute it and/or 10 # modify it under the terms of the GNU General Public License 11 # as published by the Free Software Foundation; either version 2 12 # of the License, or (at your option) any later version. 13 # 14 # This program is distributed in the hope that it will be useful, 15 # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 # GNU General Public License for more details. 18 # 19 # You should have received a copy of the GNU General Public License 20 # along with this program; if not, write to the Free Software 21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 22 # 02110-1301, USA. 23 # 24 # @version $Revision$: 25 # @author $Author$: 26 # @date $Date$: 27 28 __author__ = """Mauro Amico <mauro@biodec.com>""" 2 29 __docformat__ = 'plaintext' 3 30 … … 5 32 from zope.viewlet.interfaces import IViewletManager 6 33 7 8 class IBDMSiteForm(IViewletManager):9 """ Marker interface for a Sequence """10 11 34 class ISequenceView(Interface): 12 """ Marker interface for a Sequence """ 35 """ Marker interface for a Sequence """ 36 -
plone4bio.base/trunk/src/plone4bio/base/browser/predictor.py
- Property svn:keywords set to Date Revision Author Id
r128 r171 14 14 15 15 from plone4bio.base import Plone4BioMessageFactory as _ 16 from plone4bio.base.browser.seqrecord import SeqRecordAddForm17 16 from plone4bio.base.content.seqrecord import SeqRecord 18 17 from plone4bio.base.interfaces import ISeqRecord -
plone4bio.base/trunk/src/plone4bio/base/browser/seqrecord.py
- Property svn:keywords set to Date Revision Author Id
r117 r171 1 #2 1 from zope.formlib import form 3 2 from zope.component import createObject 4 3 5 4 from plone.app.form import base 5 from plone.memoize.view import memoize 6 6 from Products.CMFCore.utils import getToolByName 7 7 from Products.Five import BrowserView … … 12 12 from plone4bio.base import Plone4BioMessageFactory as _ 13 13 14 from Bio import SeqIO15 from StringIO import StringIO16 17 18 14 """ 19 15 class SeqRecordWidget(ObjectWidget): … … 21 17 seq_widget = CustomWidgetFactory(ObjectWidget, SeqProxy) 22 18 """ 23 24 class SeqRecordAddForm(base.AddForm):25 """Add form """26 form_fields = form.Fields(ISeqRecord)27 # form_fields['seqrecord'].custom_widget = CustomWidgetFactory(SeqRecordWidget, SeqRecordProxy)28 label = _(u"Add SeqRecord")29 form_name = _(u"Add SeqRecord")30 def create(self, data):31 seqrecord = createObject(u"plone4bio.base.SeqRecord", title=data['title'])32 form.applyChanges(seqrecord, self.form_fields, data)33 return seqrecord34 35 class SeqRecordEditForm(base.EditForm):36 form_fields = form.Fields(ISeqRecord)37 # form_fields['sequence'].field.readonly = True38 # form_fields['seqrecord'].custom_widget = CustomWidgetFactory(SeqRecordWidget, SeqRecordProxy)39 label = _(u"Edit SeqRecord")40 form_name = _(u"Edit SeqRecord")41 42 #TODO: adapter ???43 class SeqRecord2Genbank(BrowserView):44 """ """45 def __call__(self):46 io = StringIO()47 # FIXME:48 self.context.Description()49 seqrecord = self.context.seqrecord50 # the maximum length of locus name, for genbak format, is 1651 seqrecord.name = seqrecord.name[:16]52 # features53 for f in seqrecord.features:54 f.type = f.type.replace(" ", "_")55 SeqIO.write([seqrecord, ], io, "genbank")56 return io.getvalue()57 58 #TODO: adapter ???59 class SeqRecord2Fasta(BrowserView):60 """ """61 def __call__(self):62 io = StringIO()63 # FIXME:64 self.context.Description()65 SeqIO.write([self.context.seqrecord, ], io, "fasta")66 return io.getvalue()67 19 68 20 #TODO: use viewlet … … 79 31 class SeqRecordDbxrefsView(BrowserView): 80 32 """ """ 33 34 @property 35 @memoize 36 def urldict(self): 37 dbxrefpatterns_tool = getToolByName(self.context, 'plone4bio_dbxrefpatterns') 38 if dbxrefpatterns_tool: 39 dbxref_patterns = dbxrefpatterns_tool.dbxref_patterns 40 return dict([(p.name, p.pattern) for p in dbxref_patterns]) 41 else: 42 # TODO: logger.warning ... 43 return {} 44 """ 45 def __init__(self, *args, **kw): 46 super(SeqRecordDbxrefsView, self).__init__(*args, **kw) 47 self.dbxrefpatterns_tool = getToolByName(self.context, 'plone4bio_dbxrefpatterns') 48 self.urldict = dict([(p.name, p.pattern) 49 for p in self.dbxrefpatterns_tool.dbxrefs_patterns]) 50 """ 51 81 52 __call__ = ViewPageTemplateFile('templates/dbxrefs.pt') 53 82 54 def getdbxref_url(self, dbxrefdb, key): 83 if urldict.has_key(dbxrefdb):55 if self.urldict.has_key(dbxrefdb): 84 56 if dbxrefdb == 'Internal': 85 57 dbid, accessionv = key.split(':') … … 95 67 cid = key.split('.')[-1] 96 68 org = key.split('.')[0] 97 return urldict[dbxrefdb] % (org, cid)69 return self.urldict[dbxrefdb] % (org, cid) 98 70 if dbxrefdb == 'Ensemble': 99 71 dbxrefdb = key[:4] … … 107 79 key = key.split('.')[0] 108 80 ## Othewise 109 return urldict[dbxrefdb] % key81 return self.urldict[dbxrefdb] % key 110 82 111 83 class SeqRecordView(BrowserView): 112 84 """ """ 113 def Sequence(self, n=10, sep= ' '):114 sequence = self.context.Sequence()115 if n:116 rvalue = ''117 while(len(sequence)>n):118 rvalue = rvalue + sep + sequence[:n]119 sequence = sequence[n:]120 rvalue = rvalue + sep + sequence121 return rvalue.strip()122 else:123 return sequence124 85 125 86 class SeqRecordPredictors(BrowserView): … … 142 103 self.tool(self.request.form['predictor'], self.context, store=True) 143 104 144 145 #TODO: move on registry ?146 urldict = {147 'GO': 'http://amigo.geneontology.org/cgi-bin/amigo/term-details.cgi?term=%s',148 'EMBL':'http://www.ebi.ac.uk/cgi-bin/sva/sva.pl/?search=Go!&query=%s',149 'Ensembl' : 'http://www.ensembl.org/Homo_sapiens/Gene/Summary?g=%s',150 'ENSG' : 'http://www.ensembl.org/Homo_sapiens/Gene/Summary?g=%s',151 'ENST' : 'http://www.ensembl.org/Homo_sapiens/Transcript/Summary?t=%s',152 'ENSP' : 'http://www.ensembl.org/Homo_sapiens/Transcript/ProteinSummary?p=%s',153 'GermOnline' : 'http://www.ensembl.org/Homo_sapiens/Gene/Summary?g=%s',154 'OTTHUMG' : 'http://vega.sanger.ac.uk/Homo_sapiens/geneview?gene=%s',155 'OTTT' : 'http://vega.sanger.ac.uk/Homo_sapiens/transview?transcript=%s',156 'OTTP' : 'http://vega.sanger.ac.uk/Homo_sapiens/protview?peptide=%s',157 'shares_CDS_with_OTTT' : 'http://vega.sanger.ac.uk/Homo_sapiens/transview?transcript=%s',158 'EMBL' : 'http://www.ebi.ac.uk/cgi-bin/sva/sva.pl/?search=Go!&query=%s',159 'PUBMED' : 'http://www.ncbi.nlm.nih.gov/sites/entrez/%s',160 'EntrezGene' : 'http://www.ncbi.nlm.nih.gov/sites/entrez?db=gene&term=%s',161 'GeneID' : 'http://www.ncbi.nlm.nih.gov/sites/entrez?db=gene&term=%s',162 'IPI' : 'http://srs.ebi.ac.uk/srsbin/cgi-bin/wgetz?-newId+[IPI-AllText:%s*]+-view+SwissEntry',163 'InterPro' : 'http://www.ebi.ac.uk/interpro/ISearch?query=%s',164 'PIR' : 'http://pir.georgetown.edu/cgi-bin/textsearch.pl?submit.x=0&submit.y=0&field0=ALL&search=1&query0=%s',165 'PIRSF' : 'http://pir.georgetown.edu/cgi-bin/ipcSF?id=%s',166 'PROSITE' : 'http://www.expasy.ch/prosite/%s',167 'Pfam' : 'http://pfam.sanger.ac.uk//family/%s',168 'SMART' : 'http://smart.embl-heidelberg.de/smart/do_annotation.pl?BLAST=DUMMY&DOMAIN=%s',169 'Uniprot/SPTREMBL' : 'http://www.uniprot.org/uniprot/%s',170 'Uniprot/SWISSPROT' : 'http://www.uniprot.org/uniprot/%s',171 'Uniprot/Varsplic' : 'http://www.uniprot.org/uniprot/%s',172 'HGNC_NAME' : 'http://www.genenames.org/data/hgnc_data.php?match=%s',173 'HGNC_ID' : 'http://www.genenames.org/data/hgnc_data.php?hgnc_id=%s',174 'HGNC' : 'http://www.genenames.org/data/hgnc_data.php?hgnc_id=%s',175 'RefSeq' : 'http://www.ncbi.nlm.nih.gov/protein/%s',176 'RefSeq_dna' : 'http://www.ncbi.nlm.nih.gov/nuccore/%s',177 'RefSeq_peptide' : 'http://www.ncbi.nlm.nih.gov/protein/%s',178 'CCDS' : 'http://www.ncbi.nlm.nih.gov/projects/CCDS/CcdsBrowse.cgi?REQUEST=ALLFIELDS&DATA=%s',179 'UniGene' : 'http://www.ncbi.nlm.nih.gov/UniGene/clust.cgi?ORG=%s&CID=%s',180 'UniSTS' : 'http://www.ncbi.nlm.nih.gov/genome/sts/sts.cgi?uid=%s',181 'PANTHER' : 'http://www.pantherdb.org/panther/family.do?clsAccession=%s',182 'protein_id' : 'http://www.ncbi.nlm.nih.gov/protein/%s',183 'HPRD' : 'http://www.hprd.org/resultsQuery?multiplefound=&prot_name=&external=Ref_seq&accession_id=&gene_symbol=&chromo_locus=&function=&ptm_type=&localization=&domain=&motif=&expression=&prot_start=&prot_end=&limit=0&mole_start=&mole_end=&disease=&query_submit=Search&hprd=%s',184 'PeptideAtlas' : 'https://db.systemsbiology.net/sbeams/cgi/PeptideAtlas/Search?action=GO&build_type_name=Any&all_fields=on&search_key=%s',185 'PDB' : 'http://www.rcsb.org/pdb/explore/explore.do?structureId=%s',186 'CDD' : 'http://www.ncbi.nlm.nih.gov/sites/entrez/query.fcgi?db=cdd&term=%s',187 'PRINTS' : 'http://www.bioinf.manchester.ac.uk/cgi-bin/dbbrowser/sprint/searchprintss.cgi?display_opts=Prints&category=None&queryform=false&prints_accn=%s',188 'PharmGKB' : 'http://www.pharmgkb.org/do/serve?objId=%s',189 'KEGG' : 'http://www.genome.jp/dbget-bin/www_bget?%s',190 'MIM' : 'http://www.ncbi.nlm.nih.gov/entrez/dispomim.cgi?id=%s',191 'MIM_GENE' : 'http://www.ncbi.nlm.nih.gov/entrez/dispomim.cgi?id=%s',192 'MIM_MORBID' : 'http://www.ncbi.nlm.nih.gov/entrez/dispomim.cgi?id=%s',193 'PDBsum' : 'http://www.ebi.ac.uk/thornton-srv/databases/cgi-bin/pdbsum/GetPage.pl?template=main.html&EBI=TRUE&pdbcode=%s',194 'UCSC' : 'http://genome.ucsc.edu/cgi-bin/hgGene?hgg_prot=Q9HAU5&hgg_chrom=chr10&hgg_start=12002026&hgg_end=12124814&hgg_type=knownGene&db=hg18&hgg_gene=%s',195 'MEROPS' : 'http://merops.sanger.ac.uk/cgi-bin/make_frame_file?id=%s',196 'GI' : 'http://www.ncbi.nlm.nih.gov/protein/%s',197 'Internal' : '',198 } -
plone4bio.base/trunk/src/plone4bio/base/browser/templates/seqrecord.pt
r149 r171 62 62 63 63 <dl class="enableFormTabbing"> 64 <div tal:replace="structure provider:plone4bio.SeqRecordViewletManager" /> 64 65 <dt id="fieldsetlegend-annotations" tal:condition="context/annotations">Annotations</dt> 65 66 <dd id="fieldset-annotations" tal:condition="context/annotations" tal:content="structure here/@@annotations" /> … … 68 69 <dt id="fieldsetlegend-dbxrefs" tal:condition="context/dbxrefs">Dbxrefs</dt> 69 70 <dd id="fieldset-dbxrefs" tal:condition="context/dbxrefs" tal:content="structure here/@@dbxrefs" /> 70 <dt id="fieldsetlegend-sequence">Sequences</dt>71 <dd id="fieldset-sequence">72 <table class="listing" summary="Sequence"73 tal:define="seqstatistics context/SeqStatistics;74 statistickeys python:seqstatistics.keys();">75 <tr>76 <th colspan="2">Statistics</th>77 <th>Main Sequence</th>78 </tr>79 <tr class="odd">80 <td>Length</td>81 <td tal:content="context/sequence/__len__" />82 <td rowspan="2"><code class="code" tal:content="view/Sequence" /></td>83 </tr>84 <tr tal:attributes="class python:'even';" tal:condition="python:seqstatistics.has_key('Composition')">85 <td colspan="2" tal:define="complabels python:seqstatistics['Composition'].keys();86 labelsort python:complabels.sort();">87 <dl tal:attributes="id string:group-${complabels}" class="collapsible inline collapsedOnLoad">88 <dt class="collapsibleHeader" tal:content="string:Composition">Composition</dt>89 <dd class="collapsibleContent">90 <ul tal:repeat="complabel complabels">91 <li><span tal:content="python:seqstatistics['Composition'][complabel]" /></li>92 </ul>93 </dd>94 </dl>95 </td>96 </tr>97 </table>98 99 100 101 </dd>102 71 <dt id="fieldsetlegend-references" tal:condition="context/annotations/references|nothing">References</dt> 103 72 <dd id="fieldset-references" tal:condition="context/annotations/references|nothing"> -
plone4bio.base/trunk/src/plone4bio/base/configure.zcml
r161 r171 15 15 <include package=".png" /> 16 16 <include package=".tool" /> 17 <include package=".controlpanel" /> 17 18 18 19 <class class="Products.ATContentTypes.content.folder.ATFolder"> … … 28 29 </class> 29 30 30 <adapter factory=".atct.UploadingFileFactory" /> 31 <adapter 32 for="Products.ATContentTypes.interface.IATFolder" 33 provides=".interfaces.ISeqRecordUploader" 34 factory=".atct.UploadingFileFactory" 35 /> 36 37 <adapter 38 for="Products.ATContentTypes.interfaces.folder.IATBTreeFolder" 39 provides=".interfaces.ISeqRecordUploader" 40 factory=".atct.UploadingFileFactory" 41 /> 31 42 32 43 <!-- Register GenericSetup profile used for installation --> -
plone4bio.base/trunk/src/plone4bio/base/content/__init__.py
- Property svn:keywords set to Date Revision Author Id
-
plone4bio.base/trunk/src/plone4bio/base/content/configure.zcml
r149 r171 12 12 /> 13 13 14 <utility15 component=".seqrecord.seqRecordFactory"16 name="plone4bio.base.SeqRecord"17 />18 19 <!--20 <adapter factory=".seqrecord.SeqRecordSearchableText" />21 -->22 23 14 <class class=".seqrecord.SeqRecord"> 24 15 <require … … 32 23 </class> 33 24 34 <!--35 <five:implements36 class=".seqrecord.SeqRecord"37 interface="plone.app.content.interfaces.INameFromTitle"38 />39 -->40 41 25 </configure> -
plone4bio.base/trunk/src/plone4bio/base/content/seqrecord.py
- Property svn:keywords set to Date Revision Author Id
r152 r171 1 __author__ = '''Mauro Amico <m@biodec.com>''' 1 # -*- coding: utf-8 -*- 2 # 3 # File: seqrecord.py 4 # 5 # Copyright (c) 2010 by Mauro Amico (Biodec Srl) 6 # 7 # GNU General Public License (GPL) 8 # 9 # This program is free software; you can redistribute it and/or 10 # modify it under the terms of the GNU General Public License 11 # as published by the Free Software Foundation; either version 2 12 # of the License, or (at your option) any later version. 13 # 14 # This program is distributed in the hope that it will be useful, 15 # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 # GNU General Public License for more details. 18 # 19 # You should have received a copy of the GNU General Public License 20 # along with this program; if not, write to the Free Software 21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 22 # 02110-1301, USA. 23 # 24 # @version $Revision$: 25 # @author $Author$: 26 # @date $Date$: 27 28 __author__ = '''Mauro Amico <mauro@biodec.com>''' 2 29 __docformat__ = 'plaintext' 3 30 … … 16 43 # from plone.memoize.instance import memoize 17 44 45 from AccessControl import ClassSecurityInfo 46 18 47 # from Products.CMFCore.WorkflowCore import WorkflowException 19 48 # from Products.CMFCore.utils import getToolByName 20 49 # from OFS.OrderSupport import OrderSupport 21 50 51 from Products.ATContentTypes.content.base import ATCTContent 52 from Products.ATContentTypes.content.schemata import ATContentTypeSchema 53 54 from Products.Archetypes import atapi 55 22 56 # biopython 23 57 from Bio.Seq import Seq as BioSeq … … 26 60 # plone4bio 27 61 from plone4bio.base import Plone4BioMessageFactory as _ 28 from plone4bio.base.interfaces import ISeqRecord , ISeqRecordProxy, ISeqProxy62 from plone4bio.base.interfaces import ISeqRecord #, ISeqRecordProxy, ISeqProxy 29 63 30 64 import logging 31 65 logger = logging.getLogger('plone4bio') 32 66 33 #TODO: 34 class SeqProxy(BioSeq): 35 implements(ISeqProxy) 36 def _set_data(self, data): 37 self._data = data 38 data = property(fget=lambda self: unicode(self._data), fset=_set_data) 39 def __init__(self, data=u''): 40 super(SeqProxy, self).__init__(data) 41 42 #TODO: 43 class SeqRecordProxy(BioSeqRecord): 44 implements(ISeqRecordProxy) 45 def __init__(self, seq=None): 46 super(SeqRecordProxy, self).__init__(seq) 47 48 """ 49 class 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 61 # TODO 62 class SeqRecord(Item): 63 #TODO: move to zcml ??? 64 implements(ISeqRecord, ITTWLockable) #, INameFromTitle) 67 68 SeqRecordSchema = ATContentTypeSchema.copy() + atapi.Schema(( 69 atapi.TextField("sequence", 70 required = True, 71 default_content_type = 'text/plain', 72 allowable_content_types = ('text/plain',), 73 widget = atapi.TextAreaWidget( 74 label = "sequence", 75 label_msgid = "sequence_label", 76 description = "Sequence", 77 description_msgid = "sequence_help", 78 i18n_domain = "plone4bio") 79 ), 80 atapi.StringField("alphabet", 81 required = True, 82 enforceVocabulary = True, 83 vocabulary = ["Bio.Alphabet.ProteinAlphabet", 84 "Bio.Alphabet.IUPAC.ExtendedIUPACProtein", 85 "Bio.Alphabet.IUPAC.IUPACProtein", 86 ], 87 widget = atapi.SelectionWidget( 88 label = "alphabet", 89 label_msgid = "alphabet_label", 90 description = "Alphabet", 91 description_msgid = "alphabet_help", 92 i18n_domain = "plone4bio") 93 ), 94 )) 95 96 class SeqRecord(ATCTContent): 65 97 portal_type='SeqRecord' 66 98 67 # seqrecord = FieldProperty(ISeqRecord['seqrecord']) 68 # title = SeqRecordProperty('name', u'') 69 title = FieldProperty(ISeqRecord['title']) 70 sequence = FieldProperty(ISeqRecord['sequence']) 71 alphabet = FieldProperty(ISeqRecord['alphabet']) 72 dbxrefs = FieldProperty(ISeqRecord['dbxrefs']) 73 # annotations = FieldProperty(ISeqRecord['annotations']) 74 annotations = {} 99 implements(ISeqRecord) 100 101 security = ClassSecurityInfo() 102 schema = SeqRecordSchema 103 _at_rename_after_creation = True 104 105 annotations = {} # TODO 75 106 features = [] # TODO 76 77 def __init__(self, *args, **kwargs): 78 seqrecord = None 79 if kwargs.has_key('seqrecord'): 80 seqrecord = kwargs['seqrecord'] 81 del(kwargs['seqrecord']) 82 if kwargs.has_key('parent'): 83 parent = kwargs['parent'] 84 del(kwargs['parent']) 85 kwargs['title'] = unicode(kwargs.get('title', '')) 86 super(SeqRecord, self).__init__(*args, **kwargs) 87 if seqrecord: 88 self.sequence = unicode(seqrecord.seq.data) 89 self.alphabet = "%s.%s" % (seqrecord.seq.alphabet.__class__.__module__, seqrecord.seq.alphabet.__class__.__name__) 90 self.features = copy.deepcopy(seqrecord.features) 107 dbxrefs = [] # TODO 91 108 92 109 def Accession(self): … … 102 119 return None 103 120 104 @property105 def seqrecord(self):121 # override this function on different implementation (e.g. biosql) 122 def getSeqRecord(self): 106 123 """ 107 124 id … … 123 140 seqr.features = self.features 124 141 return seqr 142 143 @property 144 def seqrecord(self): 145 self.getSeqRecord() 125 146 126 147 def alphabetClass(self): 127 alphabet = self. alphabet148 alphabet = self.getAlphabet() 128 149 __traceback_info__ = alphabet 129 150 parts = alphabet.split( '.' ) … … 150 171 return obj 151 172 152 # override this function on different implementation (e.g. biosql)153 def _getSeqRecord(self):154 """ """155 return self.seqrecord156 157 """158 @property159 def title(self):160 ## TODO: defire un criterio per generare un Title:161 ## soluzione probabile e' utlizzare i campi accession162 ## e name del seqrecord in cui poter mettere HGNC e/o163 ## codice IPI164 seqrecord = self.__getSeqRecord__()165 if seqrecord:166 return seqrecord.name167 else:168 return u''169 """170 171 """172 #TODO: ???173 def Title(self):174 return self.title175 """176 177 173 def Sequence(self): 178 return self. sequence174 return self.getSequence() 179 175 180 176 """ … … 284 280 'ncbi_cds_calculated_protein', 285 281 'ensembl_calculated_protein', 286 'uniprot_sequence']282 'uniprot_sequence'] 287 283 annotation_sequences = {} 288 284 for t in proteintags: … … 307 303 """ 308 304 309 seqRecordFactory = Factory(SeqRecord, title=_(u"Create a new SeqRecord")) 305 # seqRecordFactory = Factory(SeqRecord, title=_(u"Create a new SeqRecord")) 306 307 atapi.registerType(SeqRecord, 'plone4bio.base') -
plone4bio.base/trunk/src/plone4bio/base/interfaces.py
- Property svn:keywords set to Date Revision Author Id
r113 r171 1 # -*- coding: utf-8 -*- 2 # 3 # File: interfaces.py 4 # 5 # Copyright (c) 2010 by Mauro Amico (Biodec Srl) 6 # 7 # GNU General Public License (GPL) 8 # 9 # This program is free software; you can redistribute it and/or 10 # modify it under the terms of the GNU General Public License 11 # as published by the Free Software Foundation; either version 2 12 # of the License, or (at your option) any later version. 13 # 14 # This program is distributed in the hope that it will be useful, 15 # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 # GNU General Public License for more details. 18 # 19 # You should have received a copy of the GNU General Public License 20 # along with this program; if not, write to the Free Software 21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 22 # 02110-1301, USA. 23 # 24 # @version $Revision$: 25 # @author $Author$: 26 # @date $Date$: 27 1 28 from zope.interface import Interface 2 from zope import schema29 from zope.schema import TextLine 3 30 4 from plone4bio.base import Plone4BioMessageFactory as _5 from plone4bio.base import fields6 7 class ISeqProxy(Interface):8 #TODO: readonly attribute doesn't work !!!! (????)9 data = schema.Text(title=_(u"Sequence"),10 description=_(u"The sequence"),11 required=True,12 readonly=True)13 14 class ISeqRecordProxy(Interface):15 name = schema.TextLine(title=_(u"Name"),16 description=_(u"Name of the sequence"),17 required=True)18 id = schema.TextLine(title=_(u"identifier"), required=True)19 accession = schema.TextLine(title=_(u"accession"), required=True)20 #TODO: readonly attribute doesn't work !!!! (????)21 seq = schema.Object(title=_(u"Sequence"),22 description=_(u"Sequence"),23 schema = ISeqProxy,24 readonly=True)25 31 26 32 class ISeqRecord(Interface): 27 """ Biopython's SeqRecord ... Plone4Bio 28 seqrecord = schema.Object(title=_(u"SeqRecord"), 29 description=_(u"SeqRecord"), 30 schema = ISeqRecordProxy) 31 """ 32 # TODO: custom fields/widgets/validators 33 title = schema.TextLine(title=_(u"name"), required=True, default=u'') 34 description = schema.Text(title=_(u"Description")) 35 # accession = schema.TextLine(title=_(u"accession"), required=True, default=u'') 36 sequence = fields.Sequence(title=_(u"Sequence"), 37 description=_(u"The sequence"), 38 required=True, 39 default=u'') 33 """ """ 40 34 41 # TODO: vocabulary42 alphabet = fields.ChoiceWORM(title=_(u"Alphabet"), values = ["Bio.Alphabet.ProteinAlphabet",43 "Bio.Alphabet.IUPAC.ExtendedIUPACProtein",44 "Bio.Alphabet.IUPAC.IUPACProtein",45 ])46 35 47 dbxrefs = schema.List(title=_(u"Dbxrefs"), value_type=schema.TextLine(title=_(u"dbxref")), required=False) 48 #TODO: annotation value will be also a list ... 49 #TODO: there is no default widget for Dict 50 #annotations = schema.Dict(title=_(u"Annotations"), 51 # key_type=schema.TextLine(title=_(u"key")), 52 # value_type=schema.TextLine(title=_(u"value"))) 36 class ISeqRecordUploader(Interface): 37 """ """ 38 def loadData(self, data, data_type): 39 """ """ 40 53 41 54 42 class ISeqRecordContainer(Interface): 55 43 """ """ 56 44 45 57 46 class IPredictor(Interface): 58 47 """ """ 59 48 49 50 #TODO: remove 51 class IPlone4BioConfiguration(Interface): 52 """ """ 53 54 60 55 class IPredictorTool(Interface): 61 56 """ """ 57 58 59 class IDbxrefPatternsTool(Interface): 60 """ """ 61 62 class IDbxrefPattern(Interface): 63 """ """ 64 name = TextLine(title=u"name") 65 pattern = TextLine(title=u"pattern") 66 67 -
plone4bio.base/trunk/src/plone4bio/base/png/__init__.py
- Property svn:keywords set to Date Revision Author Id
-
plone4bio.base/trunk/src/plone4bio/base/png/cluetip/cluetip/jquery.cluetip.css
r45 r171 14 14 height: 11px; 15 15 position: absolute; 16 background-image: url( wait.gif);16 background-image: url(++resource++jquery.cluetip.images/wait.gif); 17 17 } 18 18 .cluetip-arrows { -
plone4bio.base/trunk/src/plone4bio/base/png/configure.zcml
r45 r171 3 3 xmlns:browser="http://namespaces.zope.org/browser" 4 4 i18n_domain="plone4bio"> 5 5 6 6 <adapter factory=".seqrecord.seqrecordPNG" /> 7 7 <adapter factory=".seqrecord.seqrecordImagemap" /> … … 39 39 file="cluetip/hoverIntent/jquery.hoverIntent.minified.js" 40 40 /> 41 <browser:resourceDirectory 42 name="jquery.cluetip.images" 43 directory="cluetip/cluetip/images" 44 /> 41 45 <!-- cluetip --> 42 46 -
plone4bio.base/trunk/src/plone4bio/base/png/interfaces.py
- Property svn:keywords set to Date Revision Author Id
-
plone4bio.base/trunk/src/plone4bio/base/png/seqrecord.py
- Property svn:keywords set to Date Revision Author Id
r159 r171 18 18 19 19 try: 20 from plone4bio.graphics.seqrecord import SeqRecordDrawer21 has_plone4bio_graphics= True20 from biograpy.seqrecord import SeqRecordDrawer 21 HAS_BIOGRAPY = True 22 22 except ImportError: 23 logger.warning(" missing plone4bio.graphics")23 logger.warning("Missing biograpy. Use BioPerl") 24 24 # BioPerl 25 25 import subprocess 26 26 import os 27 has_plone4bio_graphics = False 28 27 HAS_BIOGRAPY = False 29 28 30 29 @adapter(ISeqRecord, IRequest) … … 32 31 def seqrecordImagemap(context, request): 33 32 # FIXME: XXX 34 context.Description()35 seqrecord = context. seqrecord36 if has_plone4bio_graphics:33 # context.Description() 34 seqrecord = context.getSeqRecord() 35 if HAS_BIOGRAPY: 37 36 imagemap = """<map name="graphicsmap" id="graphicsmap">\n""" 38 37 for box in SeqRecordDrawer(seqrecord, fig_width=1500).boxes(): … … 61 60 f.type = f.type.replace(" ", "_") 62 61 SeqIO.write([seqrecord, ], genbank, "genbank") 63 (stdoutdata, stderrdata) = graphics.communicate(genbank.getvalue()) 64 return stdoutdata 62 try: 63 (stdoutdata, stderrdata) = graphics.communicate(genbank.getvalue()) 64 return stdoutdata 65 except: 66 logger.exception('error with bioperl') 67 return None 65 68 66 69 @adapter(ISeqRecord, IRequest) … … 68 71 def seqrecordPNG(context, request): 69 72 # FIXME: XXX 70 context.Description()71 seqrecord = context. seqrecord72 if has_plone4bio_graphics:73 # context.Description() 74 seqrecord = context.getSeqRecord() 75 if HAS_BIOGRAPY: 73 76 imgdata=StringIO() 74 77 SeqRecordDrawer(seqrecord, fig_width=1500).save(imgdata, format='PNG') … … 80 83 perlpath = os.sep.join((os.path.dirname(__file__), "perl")) 81 84 cmd = ["perl", "-I"+ perlpath, os.sep.join((perlpath, "graphics-cmd.pl")), "-"] 82 graphics = subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE)83 85 genbank=StringIO() 84 86 seqrecord.name = seqrecord.name[:16] 85 87 for f in seqrecord.features: 86 88 f.type = f.type.replace(" ", "_") 87 SeqIO.write([seqrecord, ], genbank, "genbank") 88 (stdoutdata, stderrdata) = graphics.communicate(genbank.getvalue()) 89 return stdoutdata 89 SeqIO.write([seqrecord, ], genbank, "genbank") 90 graphics = subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE) 91 try: 92 (stdoutdata, stderrdata) = graphics.communicate(genbank.getvalue()) 93 return stdoutdata 94 except: 95 logger.exception('error with bioperl') 96 return None 90 97 91 98 class PNGFeaturesView(BrowserPage): -
plone4bio.base/trunk/src/plone4bio/base/predictor.py
- Property svn:keywords set to Date Revision Author Id
r54 r171 14 14 from plone4bio.base.interfaces import ISeqRecord 15 15 16 16 17 def make_config_persistent(kwargs): 17 18 """ iterates on the given dictionnary and replace list by persistent list, … … 26 27 kwargs[key] = p_value 27 28 29 28 30 def make_config_nonpersistent(kwargs): 29 31 """ iterates on the given dictionary and replace ListClass by python List, … … 37 39 p_value = list(value) 38 40 kwargs[key] = p_value 41 39 42 40 43 class Predictor(SimpleItem): … … 104 107 klass = self.predictorclass() 105 108 __traceback_info__ = klass 106 parts = klass.split( '.')109 parts = klass.split('.') 107 110 if not parts: 108 111 raise ValueError, "incomplete klass name: %s" % klass … … 110 113 while parts_copy: 111 114 try: 112 module = __import__( '.'.join( parts_copy ))115 module = __import__('.'.join(parts_copy)) 113 116 break 114 117 except ImportError: 115 118 # Reraise if the import error was caused inside the imported file 116 if sys.exc_info()[2].tb_next is not None: raise 117 del parts_copy[ -1 ] 119 if sys.exc_info()[2].tb_next is not None: 120 raise 121 del parts_copy[-1] 118 122 if not parts_copy: 119 123 return None 120 parts = parts[ 1: ]# Funky semantics of __import__'s return value124 parts = parts[1:] # Funky semantics of __import__'s return value 121 125 obj = module 122 126 for part in parts: 123 127 try: 124 obj = getattr( obj, part)128 obj = getattr(obj, part) 125 129 except AttributeError: 126 130 return None 127 131 self._v_predictor = obj() 128 132 129 def run(self, obj, context=None, store=False, argv=([], {})):133 def run(self, obj, context=None, store=False, argv=([], {})): 130 134 """ """ 131 135 assert type(argv[0]) == list … … 134 138 self._load_predictor() 135 139 if ISeqRecord.providedBy(obj): 136 newseqr = self._v_predictor.run(obj. seqrecord, *argv[0], **argv[1])140 newseqr = self._v_predictor.run(obj.getSeqRecord(), *argv[0], **argv[1]) 137 141 if store: 138 142 #TODO: need locking? -
plone4bio.base/trunk/src/plone4bio/base/profiles/default/componentregistry.xml
r45 r171 1 1 <?xml version="1.0"?> 2 2 <componentregistry> 3 <adapters/> 4 <utilities> 5 <utility 6 interface="plone4bio.base.interfaces.IPredictorTool" 7 object="plone4bio_predictors"/> 8 </utilities> 3 <adapters/> 4 <utilities> 5 <utility 6 interface="plone4bio.base.interfaces.IPredictorTool" 7 object="plone4bio_predictors" /> 8 <utility 9 interface="plone4bio.base.interfaces.IDbxrefPatternsTool" 10 object="plone4bio_dbxrefpatterns" /> 11 </utilities> 9 12 </componentregistry> 10 13 -
plone4bio.base/trunk/src/plone4bio/base/profiles/default/metadata.xml
r161 r171 1 1 <?xml version="1.0"?> 2 2 <metadata> 3 <version>1. 0.1</version>3 <version>1.1.0rc1</version> 4 4 </metadata> 5 5 -
plone4bio.base/trunk/src/plone4bio/base/profiles/default/toolset.xml
r45 r171 3 3 <required tool_id="plone4bio_predictors" 4 4 class="plone4bio.base.tool.PredictorTool"/> 5 <required tool_id="plone4bio_dbxrefpatterns" 6 class="plone4bio.base.tool.DbxrefPatternsTool"/> 5 7 </tool-setup> 6 8 -
plone4bio.base/trunk/src/plone4bio/base/profiles/default/types/SeqRecord.xml
r45 r171 8 8 <property name="content_icon">++resource++plone4bio.images/sequence_icon.png</property> 9 9 <property name="content_meta_type">SeqRecord</property> 10 <property name="product"> </property>11 <property name="factory"> plone4bio.base.SeqRecord</property>10 <property name="product">plone4bio.base</property> 11 <property name="factory">addSeqRecord</property> 12 12 <property name="immediate_view">@@view</property> 13 13 <property name="global_allow">True</property> … … 17 17 <alias from="(Default)" to="@@view"/> 18 18 <alias from="view" to="@@view"/> 19 <alias from="edit" to="atct_edit"/> 19 20 <action title="View" action_id="view" category="object" condition_expr="" 20 21 url_expr="string:${object_url}" visible="True"> … … 24 25 url_expr="string:${object_url}/edit" visible="True"> 25 26 <permission value="Modify portal content"/> 26 </action> 27 </action> 27 28 <action title="Predictors" action_id="predictors" category="object" condition_expr="" 28 29 url_expr="string:${object_url}/predictors" visible="True"> -
plone4bio.base/trunk/src/plone4bio/base/tests/__init__.py
- Property svn:keywords set to Date Revision Author Id
-
plone4bio.base/trunk/src/plone4bio/base/tests/base.py
- Property svn:keywords set to Date Revision Author Id
-
plone4bio.base/trunk/src/plone4bio/base/tests/test_integration.py
- Property svn:keywords set to Date Revision Author Id
-
plone4bio.base/trunk/src/plone4bio/base/tool/__init__.py
- Property svn:keywords set to Date Revision Author Id
r128 r171 1 1 from predictor import PredictorTool 2 2 PredictorTool # make pyflakes happy 3 4 from dbxref import DbxrefPatternsTool 5 DbxrefPatternsTool # make pyflakes happy -
plone4bio.base/trunk/src/plone4bio/base/tool/configure.zcml
r45 r171 11 11 /> 12 12 13 <adapter 14 factory=".exportimport.DbxrefPatternsToolXMLAdapter" 15 provides="Products.GenericSetup.interfaces.IBody" 16 for="..interfaces.IDbxrefPatternsTool 17 Products.GenericSetup.interfaces.ISetupEnviron" 18 /> 19 13 20 <gs:importStep 14 21 name="plone4bio-settings-import" 15 22 title="Plone4Bio Import" 16 23 description="" 17 handler=".exportimport.import Predictors"24 handler=".exportimport.importSettings" 18 25 /> 19 26 … … 22 29 title="Plone4Bio Export" 23 30 description="" 24 handler=".exportimport.export Predictors"31 handler=".exportimport.exportSettings" 25 32 /> 26 33 -
plone4bio.base/trunk/src/plone4bio/base/tool/exportimport.py
- Property svn:keywords set to Date Revision Author Id
r45 r171 8 8 9 9 from plone4bio.base.interfaces import IPredictorTool 10 from plone4bio.base.interfaces import IDbxrefPatternsTool 11 from plone4bio.base.tool.dbxref import DbxrefPattern 12 13 14 class DbxrefPatternsToolXMLAdapter(XMLAdapterBase): 15 __used_for__ = IDbxrefPatternsTool 16 _LOGGER_ID = 'plone4bio_dbxrefpatterns' 17 18 def _exportNode(self): 19 """Export the object as a DOM node""" 20 root = self._doc.createElement('plone4bio') 21 child = self._doc.createElement('dbxrefpatterns') 22 for p in getattr(self.context, 'dbxrefs_patterns', []): 23 node = self._doc.createElement('pattern') 24 node.setAttribute('name', p.name) 25 node.appendChild(self._doc.createTextNode(p.pattern)) 26 child.appendChild(node) 27 root.appendChild(child) 28 self._logger.info('Plone4Bio dbxref patterns tool exported.') 29 return root 30 31 def _importNode(self, node): 32 """Import the object from the DOM node""" 33 if self.environ.shouldPurge(): 34 self.context.dbxref_patterns = [] 35 self._logger.info('Plone4Bio dbxref patterns tool purged.') 36 # BBB: manage as dict 37 dbxref_patterns = {} 38 for child in node.childNodes: 39 if child.nodeName == 'dbxrefpatterns': 40 for pnode in child.childNodes: 41 if pnode.nodeName == 'pattern': 42 dbxref_patterns[pnode.getAttribute('name')] = '\n'.join([n.toxml() for n in pnode.childNodes]) 43 dbxref_patterns.update(dict([(p.name, p.pattern) 44 for p in self.context.dbxref_patterns])) 45 self.context.dbxref_patterns = [DbxrefPattern(name, pattern) for (name, pattern) in dbxref_patterns.items()] 46 self._logger.info('Plone4Bio dbxref patterns tool imported.') 10 47 11 48 class PredictorToolXMLAdapter(XMLAdapterBase): … … 68 105 return child 69 106 70 def import Predictors(context):107 def importSettings(context): 71 108 """Import tool settings from an XML file. 72 109 """ 73 110 site = context.getSite() 74 111 tool = getToolByName(site, 'plone4bio_predictors', None) 75 if tool is None:76 logger = context.getLogger('plone4bio_predictors')77 logger.info('Nothing to import.')78 return79 importObjects(tool, '', context)112 if tool: 113 importObjects(tool, '', context) 114 tool = getToolByName(site, 'plone4bio_dbxrefpatterns', None) 115 if tool: 116 importObjects(tool, '', context) 80 117 81 def export Predictors(context):118 def exportSettings(context): 82 119 """Export tool settings as an XML file. 83 120 """ 84 121 site = context.getSite() 85 122 tool = getToolByName(site, 'plone4bio_predictors', None) 86 if tool is None:87 logger = context.getLogger('plone4bio_predictors')88 logger.info('Nothing to export.')89 return90 exportObjects(tool, '', context)123 if tool: 124 exportObjects(tool, '', context) 125 tool = getToolByName(site, 'plone4bio_dbxrefpatterns', None) 126 if tool: 127 exportObjects(tool, '', context) 91 128 92 129 -
plone4bio.base/trunk/src/plone4bio/base/tool/predictor.py
- Property svn:keywords set to Date Revision Author Id
-
plone4bio.base/trunk/test-plone-4.0.x.cfg
r145 r171 4 4 package-name = plone4bio.base 5 5 versions = versions 6 7 [versions]8 z3c.form = 2.2.0
