Mercurial > repos > bgruening > infernal
changeset 10:0bffd4183326 draft
Uploaded
author | bgruening |
---|---|
date | Sun, 08 Sep 2013 05:08:20 -0400 |
parents | 1aa4c036e41c |
children | 5c6344f67ad0 |
files | cmbuild.xml cmsearch.xml datatypes_conf.xml infernal.py readme.rst repository_dependencies.xml |
diffstat | 6 files changed, 13 insertions(+), 92 deletions(-) [+] |
line wrap: on
line diff
--- a/cmbuild.xml Sat Sep 07 16:14:02 2013 -0400 +++ b/cmbuild.xml Sun Sep 08 05:08:20 2013 -0400 @@ -85,7 +85,6 @@ <option value="--wnone">no sequence weighting (--wnone)</option> <option value="--wgiven">Sequence weight from given in input file (--wgiven)</option> <option value="--wblosum">BLOSUM filtering algorithm (--wblosum)</option> - <option value="--wid">BLOSUM filtering algorithm (--wblosum)</option> </param> <when value="--wpb"/> <when value="--wgsc"/>
--- a/cmsearch.xml Sat Sep 07 16:14:02 2013 -0400 +++ b/cmsearch.xml Sun Sep 08 05:08:20 2013 -0400 @@ -63,6 +63,7 @@ <inputs> <param name="seqdb" type="data" format="fasta" label="Sequence database"/> + <conditional name="cm_opts"> <param name="cm_opts_selector" type="select" label="Subject covariance models"> <option value="db" selected="True">Locally installed covariance models</option>
--- a/datatypes_conf.xml Sat Sep 07 16:14:02 2013 -0400 +++ b/datatypes_conf.xml Sun Sep 08 05:08:20 2013 -0400 @@ -6,10 +6,8 @@ <registration> <!--INFERNAL1.1 Datatypes --> <datatype extension="cm" type="galaxy.datatypes.infernal:Infernal_CM_1_1" display_in_upload="False" /> - <datatype extension="stockholm" type="galaxy.datatypes.infernal:Stockholm_1_0" display_in_upload="False" /> </registration> <sniffers> <sniffer type="galaxy.datatypes.infernal:Infernal_CM_1_1"/> - <sniffer type="galaxy.datatypes.infernal:Stockholm_1_0"/> </sniffers> </datatypes>
--- a/infernal.py Sat Sep 07 16:14:02 2013 -0400 +++ b/infernal.py Sun Sep 08 05:08:20 2013 -0400 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from galaxy.datatypes import data +from galaxy.datatypes.data import Text from galaxy.datatypes.sniff import get_headers, get_test_fname from galaxy.datatypes.data import get_file_peek import subprocess @@ -41,90 +41,7 @@ return 0 -class Stockholm_1_0( data.text ): - file_ext = "stockholm" - - MetadataElement( name="number_of_alignments", default=0, desc="Number of multiple alignments", readonly=True, visible=True, optional=True, no_value=0 ) - - def set_peek( self, dataset, is_multi_byte=False ): - if not dataset.dataset.purged: - dataset.peek = get_file_peek( dataset.file_name, is_multi_byte=is_multi_byte ) - if (dataset.metadata.number_of_models == 1): - dataset.blurb = "1 alignment" - else: - dataset.blurb = "%s alignments" % dataset.metadata.number_of_models - dataset.peek = data.get_file_peek( dataset.file_name, is_multi_byte=is_multi_byte ) - else: - dataset.peek = 'file does not exist' - dataset.blurb = 'file purged from disc' - - def sniff( self, filename ): - if count_special_lines('^#[[:space:]+]STOCKHOLM[[:space:]+]1.0', filename) > 0: - return True - else: - return False - - def set_meta( self, dataset, **kwd ): - """ - - Set the number of models in dataset. - """ - dataset.metadata.number_of_models = count_special_lines('^#[[:space:]+]STOCKHOLM[[:space:]+]1.0', dataset.file_name) - - def split( cls, input_datasets, subdir_generator_function, split_params): - """ - - Split the input files by model records. - """ - if split_params is None: - return None - - if len(input_datasets) > 1: - raise Exception("STOCKHOLM-file splitting does not support multiple files") - input_files = [ds.file_name for ds in input_datasets] - - chunk_size = None - if split_params['split_mode'] == 'number_of_parts': - raise Exception('Split mode "%s" is currently not implemented for STOCKHOLM-files.' % split_params['split_mode']) - elif split_params['split_mode'] == 'to_size': - chunk_size = int(split_params['split_size']) - else: - raise Exception('Unsupported split mode %s' % split_params['split_mode']) - - def _read_stockholm_records( filename ): - lines = [] - with open(filename) as handle: - for line in handle: - lines.append( line ) - if line.strip() == '//': - yield lines - lines = [] - - def _write_part_stockholm_file( accumulated_lines ): - part_dir = subdir_generator_function() - part_path = os.path.join( part_dir, os.path.basename( input_files[0] ) ) - part_file = open( part_path, 'w' ) - part_file.writelines( accumulated_lines ) - part_file.close() - - try: - - stockholm_records = _read_stockholm_records( input_files[0] ) - stockholm_lines_accumulated = [] - for counter, stockholm_record in enumerate( stockholm_records, start = 1): - stockholm_lines_accumulated.extend( stockholm_record ) - if counter % chunk_size == 0: - _write_part_stockholm_file( stockholm_lines_accumulated ) - stockholm_lines_accumulated = [] - if stockholm_lines_accumulated: - _write_part_stockholm_file( stockholm_lines_accumulated ) - except Exception, e: - log.error('Unable to split files: %s' % str(e)) - raise - split = classmethod(split) - - -class Infernal_CM_1_1( data.text ): +class Infernal_CM_1_1( Text ): file_ext = "cm" MetadataElement( name="number_of_models", default=0, desc="Number of covariance models", readonly=True, visible=True, optional=True, no_value=0 ) @@ -205,3 +122,7 @@ raise split = classmethod(split) +if __name__ == '__main__': + Infernal_CM_1_1() + Stockholm_1_0() +
--- a/readme.rst Sat Sep 07 16:14:02 2013 -0400 +++ b/readme.rst Sun Sep 08 05:08:20 2013 -0400 @@ -32,16 +32,14 @@ Miscellaneous ============= -Included in that repository is a CM datatype for INFERNAL 1.1. If you need that datatype in an additionl package, -I can source it out as separate package. Please contact me in that case. +Included in that repository is a CM datatype for INFERNAL 1.1 and TOCKHOLM . +If you need that datatype in an additionl package, I can source it out as separate package. Please contact me in that case. ======= History ======= -interproscan: - - v1.1.0: Initial public release
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/repository_dependencies.xml Sun Sep 08 05:08:20 2013 -0400 @@ -0,0 +1,4 @@ +<?xml version="1.0"?> +<repositories description="This requires the datatype definitions for Multiple Sequence Alignment (MSA) formats (e.g. STOCKHOLM, SELEX, ClustalW)."> + <repository changeset_revision="ba3eba35a79d" name="msa_datatypes" owner="iuc" toolshed="http://testtoolshed.g2.bx.psu.edu" /> +</repositories>