annotate hmmer/hmmer.py @ 0:914f50b4c8c1 default tip

Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
author edward-kirton
date Tue, 07 Jun 2011 16:41:43 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
1 """
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
2 Hmmer classes
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
3 """
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
4
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
5 import data
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
6 import logging
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
7 import re
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
8 import string
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
9 from cgi import escape
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
10 from galaxy.datatypes.metadata import MetadataElement
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
11 from galaxy.datatypes import metadata
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
12 import galaxy.model
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
13 from galaxy import util
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
14 from sniff import *
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
15
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
16 log = logging.getLogger(__name__)
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
17
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
18 class Hmm( data.Text ):
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
19 """Class for hmmer database files"""
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
20
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
21 file_ext = 'hmm'
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
22
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
23 def init_meta( self, dataset, copy_from=None ):
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
24 data.Text.init_meta( self, dataset, copy_from=copy_from )
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
25
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
26 class HmmPressed( Hmm ):
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
27 """Class describing a hmmer database produced by hmmpress"""
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
28
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
29 file_ext = 'hmmPressed'
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
30 composite_type='basic'
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
31
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
32 MetadataElement( readonly=True, optional=True, visible=False, no_value=0 )
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
33
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
34 def __init__(self,**kwd):
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
35 data.Data.__init__(self, **kwd)
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
36 self.add_composite_file('hmm')
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
37 self.add_composite_file('hmm.h3m')
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
38 self.add_composite_file('hmm.h3i')
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
39 self.add_composite_file('hmm.h3f')
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
40 self.add_composite_file('hmm.h3p')
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
41 def set_peek( self, dataset, is_multi_byte=False ):
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
42 if not dataset.dataset.purged:
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
43 dataset.peek = "Folder of multiple files"
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
44 dataset.blurb = "Folder of multiple files"
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
45 else:
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
46 dataset.peek = 'file does not exist'
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
47 dataset.blurb = 'file purged from disk'
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
48 def display_peek( self, dataset ):
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
49 try:
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
50 return dataset.peek
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
51 except:
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
52 return "Folder of multiple files"
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
53 def get_mime(self):
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
54 """Returns the mime type of the datatype"""
914f50b4c8c1 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
55 return 'text/plain'