Repository 'infernal'
hg clone https://toolshed.g2.bx.psu.edu/repos/bgruening/infernal

Changeset 0:652f9d550531 (2014-04-22)
Next changeset 1:55bb96edfc07 (2014-04-24)
Commit message:
Uploaded
added:
cmbuild.xml
cmsearch.xml
cmstat.xml
datatypes_conf.xml
infernal.py
readme.rst
repository_dependencies.xml
tool-data/infernal.loc.sample
tool_dependencies.xml
b
diff -r 000000000000 -r 652f9d550531 cmbuild.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cmbuild.xml Tue Apr 22 13:56:22 2014 -0400
b
b'@@ -0,0 +1,271 @@\n+<tool id="infernal_cmbuild" name="Build covariance models" version="1.1.0.1">\n+    <description>from sequence alignments (cmbuild)</description>\n+    <parallelism method="multi" split_inputs="alignment_infile" split_mode="to_size" split_size="10" shared_inputs="" merge_outputs="cmfile_outfile"></parallelism>\n+    <requirements>\n+        <requirement type="package">infernal</requirement>\n+        <requirement type="package" version="1.1">infernal</requirement>\n+        <requirement type="package" version="8.21">gnu_coreutils</requirement>\n+    </requirements>\n+    <command>\n+        cmbuild \n+            #if $is_summery_output:\n+                -o $summary_outfile\n+            #end if\n+            \n+            ## to many outputs, is that one really needed?\n+            ##-O $annotated_source_alignment_outfile\n+\n+            $model_construction_opts.model_construction_opts_selector\n+            #if $model_construction_opts.model_construction_opts_selector == \'--fast\':\n+                --symfrac $model_construction_opts.symfrac\n+            #end if\n+\n+            $noss\n+\n+            $relative_weights_opts.relative_weights_opts_selector\n+            #if $relative_weights_opts.relative_weights_opts_selector == \'--wblosum\':\n+                --wid $relative_weights_opts.wid\n+            #end if\n+\n+            $effective_opts.effective_opts_selector\n+            #if str($effective_opts.effective_opts_selector) == \'--eent\':\n+                --ere $effective_opts.ere\n+                --eminseq $effective_opts.eminseq\n+                --ehmmre $effective_opts.ehmmre\n+                --eset $effective_opts.eset\n+            #end if\n+\n+            #if str($refining_opts.refining_opts_selector) == \'--refine\':\n+                #if $refining_opts.refine_output:\n+                    --refine $refined_multiple_alignment_output\n+                #else:\n+                    --refine /dev/null\n+                #end if\n+\n+                $l\n+                $refining_opts.gibbs_opts.gibbs_opts_selector\n+\n+                #if str($refining_opts.gibbs_opts.gibbs_opts_selector) == \'--gibbs\':\n+                    $refining_opts.gibbs_opts.random_seed\n+                #end if\n+\n+                $notrunc\n+                $cyk\n+            #end if\n+\n+            $cmfile_outfile\n+            $alignment_infile\n+            \n+    </command>\n+        <inputs>\n+            <!-- Stockholm or SELEX \n+            SELEX is defined in EMBOSS datatypes\n+            -->\n+            <param name="alignment_infile" type="data" format="stockholm,selex" label="Sequence database"/>\n+\n+            <conditional name="model_construction_opts">\n+                <param name="model_construction_opts_selector" type="select" label="These options control how consensus columns are defined in an alignment" help="">\n+                    <option value="--fast" selected="true">automatic (--fast)</option>\n+                    <option value="--hand">user defined (--hand)</option>\n+                </param>\n+                <when value="--fast">\n+                    <param name="symfrac" type="float" value="0.5" size="5" \n+                        label="Define the residue fraction threshold necessary to define a consensus (--symfrac)" help=""/>\n+                </when>\n+                <when value="--hand"/>\n+            </conditional>\n+\n+            <param name="noss" truevalue="--noss" falsevalue="" checked="False" type="boolean" \n+                label="Ignore the secondary structure annotation, if any, in your multiple alignment file (--noss)" help=""/>\n+\n+            <conditional name="relative_weights_opts">\n+                <param name="relative_weights_opts_selector" type="select" label="Options controlling relative weights" help="">\n+                    <option value="--wpb" selected="true">Henikoff (--wgb)</option>\n+                    <option value="--wgsc">Gerstein/Sonnhammer/Chothia (--wgsc)</option>\n+                    <option value="--wnone">no sequence'..b'h that option, consult the source code.\n+  * --enone Turn off the entropy weighting strategy. The effective sequence number is just the number of sequences in the alignment.\n+  * --ere Set the target mean match state relative entropy. By default the target relative entropy per match position is 0.59 bits for models with at least 1 basepair and 0.38 for models with zero basepairs.\n+  * --eminseq Define the minimum allowed effective sequence number.\n+  * --ehmmre Set the target HMM mean match state relative entropy. Entropy for basepairing match states is calculated using marginalized basepair emission probabilities.\n+  * --eset Set the effective sequence number for entropy weighting.\n+\n+\n+\n+Options for refining the input alignment\n+----------------------------------------\n+\n+  * --refine Attempt to refine the alignment before building the CM using expectation-maximization (EM). A CM is first built from the initial alignment as usual. Then, the sequences in the alignment are realigned optimally (with the HMM banded CYK algorithm, optimal means optimal given the bands) to the CM, and a new CM is built from the resulting alignment. The sequences are then realigned to the new CM, and a new CM is built from that alignment. This is continued until convergence, specifically when the alignments for two successive iterations are not significantly different (the summed bit scores of all the sequences in the alignment changes less than 1% between two successive iterations).\n+  * -l Turn on the local alignment algorithm, which allows the alignment to span two or more subsequences if necessary (e.g. if the structures of the query model and target sequence are only partially shared), allowing certain large insertions and deletions in the structure to be penalized differently than normal indels. The default is to globally align the query model to the target sequences.\n+  * --gibbs Modifies the behavior of --refine so Gibbs sampling is used instead of EM. The difference is that during the alignment stage the alignment is not necessarily optimal, instead an alignment (parsetree) for each sequences is sampled from the posterior distribution of alignments as determined by the Inside algorithm. Due to this sampling step --gibbs is non- deterministic, so different runs with the same alignment may yield different results. This is not true when --refine is used without the --gibbs option, in which case the final alignment and CM will always be the same. When --gibbs is enabled, the --seed "number" option can be used to seed the random number generator predictably, making the results reproducible. The goal of the --gibbs option is to help expert RNA alignment curators refine structural alignments by allowing them to observe alternative high scoring alignments.\n+  * --seed Seed the random number generator with an integer >= 0. This option can only be used in combination with --gibbs. If the given number is nonzero, stochastic sampling of alignments will be reproducible; the same command will give the same results. If the given number is 0, the random number generator is seeded arbitrarily, and stochastic samplings may vary from run to run of the same command. The default seed is 0.\n+  * --cyk With --refine, align with the CYK algorithm. By default the optimal accuracy algorithm is used. There is more information on this in the cmalign manual page.\n+  * --notrunc With --refine, turn off the truncated alignment algorithm. There is more information on this in the cmalign manual page.\n+\n+\n+For further questions please refere to the Infernal Userguide_.\n+\n+.. _Userguide: http://selab.janelia.org/software/infernal/Userguide.pdf\n+\n+\n+How do I cite Infernal?\n+-----------------------\n+\n+The recommended citation for using Infernal 1.1 is E. P. Nawrocki and S. R. Eddy, Infernal 1.1: 100-fold faster RNA homology searches , Bioinformatics 29:2933-2935 (2013). \n+\n+**Galaxy Wrapper Author**::\n+\n+    *  Bjoern Gruening, University of Freiburg\n+\n+    </help>\n+</tool>\n'
b
diff -r 000000000000 -r 652f9d550531 cmsearch.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cmsearch.xml Tue Apr 22 13:56:22 2014 -0400
b
b'@@ -0,0 +1,254 @@\n+<tool id="infernal_cmsearch" name="Search covariance model(s)" version="1.1.0.2">\n+    <description>against a sequence database (cmsearch)</description>\n+    <parallelism method="multi" split_inputs="seqdb" split_mode="to_size" split_size="100" shared_inputs="" merge_outputs="outfile,multiple_alignment_output"></parallelism>\n+    <requirements>\n+        <requirement type="package">infernal</requirement>\n+        <requirement type="package" version="1.1">infernal</requirement>\n+        <requirement type="package" version="8.21">gnu_coreutils</requirement>\n+    </requirements>\n+    <command>\n+        ## a temp file is needed, because the standard tabular output from infernal is not usefull in Galaxy\n+        ## it will be converted to a tab delimited file and piped to Galaxy\n+        temp_tabular_output=\\$(mktemp);\n+\n+        cmsearch \n+            ## Infernal Options\n+            --cpu "\\${GALAXY_SLOTS:-12}"\n+            -o /dev/null\n+            --tformat $seqdb.ext ##target format: fasta, embl, genbank, ddbj, stockholm, pfam, a2m, afa, clustal, and phylip \n+            $bottomonly\n+            $toponly\n+            $cyk\n+            $notrunc\n+            $max\n+            $nohmm\n+            $mid\n+            ##$bitscore_thresholds\n+            --tblout \\$temp_tabular_output\n+            $g\n+            #if $A:\n+                $A $multiple_alignment_output\n+            #end if\n+\n+            #if str($inclusion_thresholds_opts.inclusion_thresholds_selector) == "--incE":\n+                --incE $inclusion_thresholds_opts.incE\n+            #elif str($inclusion_thresholds_opts.inclusion_thresholds_selector) == "--incT":\n+                --incT $inclusion_thresholds_opts.incT\n+            #end if\n+\n+            #if str($reporting_thresholds_opts.reporting_thresholds_selector) == "-E":\n+                -E $reporting_thresholds_opts.E\n+            #elif str($reporting_thresholds_opts.reporting_thresholds_selector) == "-T":\n+                -T $reporting_thresholds_opts.T\n+            #end if\n+\n+            ## CM file from the history or stored as database on disc\n+\n+            #if str($cm_opts.cm_opts_selector) == "db":\n+                $cm_opts.database.fields.path\n+            #else:\n+                $cm_opts.cmfile\n+            #end if\n+\n+            ## sequence file\n+            $seqdb\n+            2>&#38;1\n+            ;\n+\n+            ## 1. replace all lines starting # (comment lines)\n+            ## 2. replace the first 18 spaces with tabs, 18th field is a free text field (can contain spaces)\n+            sed -e \'s/#.*$//\' -e \'/^$/d\' -e \'s/ /\\t/g\' -e \'s/\\t/ /18g\' \\$temp_tabular_output > $outfile\n+\n+    </command>\n+        <inputs>\n+\n+            <param name="seqdb" type="data" format="fasta" label="Sequence database"/>\n+\n+            <conditional name="cm_opts">\n+                <param name="cm_opts_selector" type="select" label="Subject covariance models">\n+                  <option value="db" selected="True">Locally installed covariance models</option>\n+                  <option value="histdb">Covariance model from your history</option>\n+                </param>\n+                <when value="db">\n+                    <param name="database" type="select" label="Covariance models">\n+                        <options from_file="infernal.loc">\n+                          <column name="value" index="0"/>\n+                          <column name="name" index="1"/>\n+                          <column name="path" index="2"/>\n+                        </options>\n+                    </param>\n+                </when>\n+                <when value="histdb">\n+                    <param name="cmfile" type="data" format="cm" label="Covariance models file from the history."/>\n+                </when>\n+            </conditional>\n+\n+            <param name="g" truevalue="-g" falsevalue="" checked="False" type="boolean" \n+                label="Turn on the glocal alignment algorithm" help="... global with respect to the query'..b'e of N consensus positions.\n+(7) mdl to (model coord): The end of the alignment of this hit with respect to the profile (CM or HMM), numbered 1..N for a profile of N consensus positions.\n+(8) seq from (ali coord): The start of the alignment of this hit with respect to the sequence, numbered 1..L for a sequence of L residues.\n+(9) seq to (ali coord): The end of the alignment of this hit with respect to the sequence, numbered 1..L for a sequence of L residues.\n+(10) strand: The strand on which the hit occurs on the sequence. \xe2\x80\x99+\xe2\x80\x99 if the hit is on the top (Watson) strand, \xe2\x80\x99-\xe2\x80\x99 if the hit is on the bottom (Crick) strand. If on the top strand, the \xe2\x80\x9cseq from\xe2\x80\x9d value will be less than or equal to the \xe2\x80\x9cseq to\xe2\x80\x9d value, else it will be greater than or equal to it. \n+(11) trunc: Indicates if this is predicted to be a truncated CM hit or not. This will be \xe2\x80\x9cno\xe2\x80\x9d if it is a CM hit that is not predicted to be truncated by the end of the sequence, \xe2\x80\x9c5\xe2\x80\x99 \xe2\x80\x9d or \xe2\x80\x9c3\xe2\x80\x99 \xe2\x80\x9d if the hit is predicted to have one or more 5\xe2\x80\x99 or 3\xe2\x80\x99 residues missing due to a artificial truncation of the sequence, or \xe2\x80\x9c5\xe2\x80\x99&amp;3\xe2\x80\x9d\xe2\x80\x99 if the hit is predicted to have one or more 5\xe2\x80\x99 residues missing and one or more 3\xe2\x80\x99 residues missing. If the hit is an HMM hit, this will always be \xe2\x80\x99-\xe2\x80\x99.\n+(12) pass: Indicates what \xe2\x80\x9cpass\xe2\x80\x9d of the pipeline the hit was detected on. This is probably only useful for testing and debugging. Non-truncated hits are found on the first pass, truncated hits are found on successive passes.\n+(13) gc: Fraction of G and C nucleotides in the hit.\n+(14) bias: The biased-composition correction: the bit score difference contributed by the null3 model for CM hits, or the null2 model for HMM hits. High bias scores may be a red flag for a false positive. It is difficult to correct for all possible ways in which a nonrandom but nonhomologous biological sequences can appear to be similar, such as short-period tandem repeats, so there are cases where the bias correction is not strong enough (creating false positives).\n+(15) score: The score (in bits) for this target/query comparison. It includes the biased-composition cor-rection (the \xe2\x80\x9cnull3\xe2\x80\x9d model for CM hits, or the \xe2\x80\x9cnull2\xe2\x80\x9d model for HMM hits).\n+(16) E-value: The expectation value (statistical significance) of the target. This is a per query E-value; i.e. calculated as the expected number of false positives achieving this comparison\xe2\x80\x99s score for a single query against the search space Z. For cmsearch Z is defined as the total number of nucleotides in the target dataset multiplied by 2 because both strands are searched. For cmscan Z is the total number of nucleotides in the query sequence multiplied by 2 because both strands are searched and multiplied by the number of models in the target database. If you search with multiple queries and if you want to control the overall false positive rate of that search rather than the false positive rate per query, you will want to multiply this per-query E-value by how many queries you\xe2\x80\x99re doing.\n+(17) inc: Indicates whether or not this hit achieves the inclusion threshold: \xe2\x80\x99!\xe2\x80\x99 if it does, \xe2\x80\x99?\xe2\x80\x99 if it does not (and rather only achieves the reporting threshold). By default, the inclusion threshold is an E-value of 0.01 and the reporting threshold is an E-value of 10.0, but these can be changed with command line options as described in the manual pages.\n+(18) description of target: The remainder of the line is the target\xe2\x80\x99s description line, as free text.\n+\n+\n+For further questions please refere to the Infernal Userguide_.\n+\n+.. _Userguide: http://selab.janelia.org/software/infernal/Userguide.pdf\n+\n+\n+How do I cite Infernal?\n+-----------------------\n+\n+The recommended citation for using Infernal 1.1 is E. P. Nawrocki and S. R. Eddy, Infernal 1.1: 100-fold faster RNA homology searches , Bioinformatics 29:2933-2935 (2013). \n+\n+**Galaxy Wrapper Author**::\n+\n+    *  Bjoern Gruening, University of Freiburg\n+\n+    </help>\n+</tool>\n'
b
diff -r 000000000000 -r 652f9d550531 cmstat.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cmstat.xml Tue Apr 22 13:56:22 2014 -0400
b
@@ -0,0 +1,101 @@
+<tool id="infernal_cmstat" name="Summary statistics" version="1.1.0.1">
+    <description>for covariance model (cmstat)</description>
+    <requirements>
+        <requirement type="package">infernal</requirement>
+        <requirement type="package" version="1.1">infernal</requirement>
+        <requirement type="package" version="8.21">gnu_coreutils</requirement>
+    </requirements>
+    <command>
+        ## a temp file is needed, because the standard tabular output from infernal is not usefull in Galaxy
+        ## it will be converted to a tab delimited file and piped to Galaxy
+        temp_tabular_output=\$(mktemp);
+
+        cmstat
+
+            #if str($cm_opts.cm_opts_selector) == "db":
+                $cm_opts.database.fields.path
+            #else:
+                $cm_opts.cmfile
+            #end if
+
+            > \$temp_tabular_output
+            ;
+
+            ## 1. replace all lines starting # (comment lines)
+            ## 2. replace the first 18 spaces with tabs, 18th field is a free text field (can contain spaces)
+            sed -e 's/#.*$//' -e '/^$/d' -e 's/ /\t/g' -e 's/\t/ /18g' \$temp_tabular_output > $outfile
+
+    </command>
+        <inputs>
+            <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>
+                  <option value="histdb">Covariance model from your history</option>
+                </param>
+                <when value="db">
+                    <param name="database" type="select" label="Covariance models">
+                        <options from_file="infernal.loc">
+                          <column name="value" index="0"/>
+                          <column name="name" index="1"/>
+                          <column name="path" index="2"/>
+                        </options>
+                    </param>
+                </when>
+                <when value="histdb">
+                    <param name="cmfile" type="data" format="cm" label="Covariance models file from the history."/>
+                </when>
+            </conditional>
+        </inputs>
+    <outputs>
+        <data format="tabular" name="outfile" label="cmstat on ${on_string}"/>
+    </outputs>
+    <help>
+
+
+**What it does**
+
+The cmstat utility prints out a tabular file of summary statistics for each given covariance model.
+
+
+Output format
+-------------
+
+By default, cmstat prints general statistics of the model and the alignment it was built from, one line per model in a
+tabular format. 
+
+The columns are:
+
+(1) The index of this profile, numbering each on in the file starting from 1.
+(2) The name of the profile.
+(3) The optional accession of the profile, or ”-” if there is none.
+(4) The number of sequences that the profile was estimated from.
+(5) The effective number of sequences that the profile was estimated from, after Infernal applied an effective sequence number calculation such as the default entropy weighting.
+(6) The length of the model in consensus residues (match states).
+(7) The expected maximum length of a hit to the model.
+(8) The number of basepairs in the model.
+(9) The number of bifurcations in the model.
+(10) What type of model will be used by default in cmsearch and cmscan for this profile, either ”cm” or ”hmm”. For profiles with 0 basepairs, this will be ”hmm” (unless the --nohmmonly option is used). For all other profiles, this will be ”cm”.
+(11) Mean relative entropy per match state, in bits. This is the expected (mean) score per con-
+     sensus position. This is what the default entropy-weighting method for effective sequence
+     number estimation focuses on, so for default Infernal, this value will often reflect the default
+     target for entropy-weighting. If the ”model” field for this profile is ”hmm”, this field will be ”-”.
+(12) Mean relative entropy per match state, in bits, if the CM were transformed into an HMM (information from structure is ignored). The larger the difference between the CM and HMM
+     relative entropy, the more the model will rely on structural conservation relative sequence conservation when identifying homologs.
+
+
+For further questions please refere to the Infernal Userguide_.
+
+.. _Userguide: http://selab.janelia.org/software/infernal/Userguide.pdf
+
+
+How do I cite Infernal?
+-----------------------
+
+The recommended citation for using Infernal 1.1 is E. P. Nawrocki and S. R. Eddy, Infernal 1.1: 100-fold faster RNA homology searches , Bioinformatics 29:2933-2935 (2013). 
+
+**Galaxy Wrapper Author**::
+
+    *  Bjoern Gruening, University of Freiburg
+
+    </help>
+</tool>
b
diff -r 000000000000 -r 652f9d550531 datatypes_conf.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/datatypes_conf.xml Tue Apr 22 13:56:22 2014 -0400
b
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+  <datatypes>
+   <datatype_files>
+     <datatype_file name="infernal.py"/>
+   </datatype_files>
+   <registration>
+        <!--INFERNAL1.1 Datatypes -->
+        <datatype extension="cm" type="galaxy.datatypes.infernal:Infernal_CM_1_1" display_in_upload="False" />
+   </registration>
+   <sniffers>
+        <sniffer type="galaxy.datatypes.infernal:Infernal_CM_1_1"/>
+   </sniffers>
+</datatypes>
b
diff -r 000000000000 -r 652f9d550531 infernal.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/infernal.py Tue Apr 22 13:56:22 2014 -0400
[
@@ -0,0 +1,128 @@
+# -*- coding: utf-8 -*-
+
+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
+import os
+
+from galaxy.datatypes.metadata import MetadataElement
+from galaxy.datatypes import metadata
+
+def count_special_lines( word, filename, invert = False ):
+    """
+        searching for special 'words' using the grep tool
+        grep is used to speed up the searching and counting
+        The number of hits is returned.
+    """
+    try:
+        cmd = ["grep", "-c"]
+        if invert:
+            cmd.append('-v')
+        cmd.extend([word, filename])
+        out = subprocess.Popen(cmd, stdout=subprocess.PIPE)
+        return int(out.communicate()[0].split()[0])
+    except:
+        pass
+    return 0
+
+def count_lines( filename, non_empty = False):
+    """
+        counting the number of lines from the 'filename' file
+    """
+    try:
+        if non_empty:
+            out = subprocess.Popen(['grep', '-cve', '^\s*$', filename], stdout=subprocess.PIPE)
+        else:
+            out = subprocess.Popen(['wc', '-l', filename], stdout=subprocess.PIPE)
+        return int(out.communicate()[0].split()[0])
+    except:
+        pass
+    return 0
+
+
+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 )
+
+    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 model"
+            else:
+                dataset.blurb = "%s models" % 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("^INFERNAL1/a", 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("^INFERNAL1/a", 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("CM-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 CM-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_cm_records( filename ):
+            lines = []
+            with open(filename) as handle:
+                for line in handle:
+                    if line.startswith("INFERNAL1/a") and lines:
+                        yield lines
+                        lines = [line]
+                    else:
+                        lines.append( line )
+            yield lines
+
+        def _write_part_cm_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:
+            cm_records = _read_cm_records( input_files[0] )
+            cm_lines_accumulated = []
+            for counter, cm_record in enumerate( cm_records, start = 1):
+                cm_lines_accumulated.extend( cm_record )
+                if counter % chunk_size == 0:
+                    _write_part_cm_file( cm_lines_accumulated )
+                    cm_lines_accumulated = []
+            if cm_lines_accumulated:
+                _write_part_cm_file( cm_lines_accumulated )
+        except Exception,  e:
+            log.error('Unable to split files: %s' % str(e))
+            raise
+    split = classmethod(split)
+
+if __name__ == '__main__':
+    Infernal_CM_1_1()
+    Stockholm_1_0()
+
b
diff -r 000000000000 -r 652f9d550531 readme.rst
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/readme.rst Tue Apr 22 13:56:22 2014 -0400
b
@@ -0,0 +1,67 @@
+================================================
+Galaxy wrapper for Infernal prediction tools
+================================================
+
+Infernal ("INFERence of RNA ALignment") is for searching DNA sequence databases 
+for RNA structure and sequence similarities. It is an implementation of a special 
+case of profile stochastic context-free grammars called covariance models (CMs). 
+A CM is like a sequence profile, but it scores a combination of sequence consensus 
+and RNA secondary structure consensus, so in many cases, it is more capable of 
+identifying RNA homologs that conserve their secondary structure more than their 
+primary sequence. 
+
+This wrapper is copyright 2013 by:
+ * Bjoern Gruening
+
+
+This prepository contains wrapper for the Infernal_ command line tool.
+
+.. _Infernal: http://infernal.janelia.org/
+
+
+The recommended citation for using Infernal 1.1 is E. P. Nawrocki and S. R. Eddy, Infernal 1.1: 100-fold faster RNA homology searches , Bioinformatics 29:2933-2935 (2013).
+
+
+============
+Installation
+============
+
+Please install Infernal and the tool wrappers with the Galaxy Tool Shed from
+
+http://toolshed.g2.bx.psu.edu/view/bgruening/infernal 
+
+
+=======
+History
+=======
+
+ - v1.1.0: Initial public release
+
+
+Bug Reports
+===========
+
+You can file an issue here https://github.com/bgruening/galaxytools/issues or ask
+us on the Galaxy development list http://lists.bx.psu.edu/listinfo/galaxy-dev
+
+
+Licence (MIT)
+=============
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
b
diff -r 000000000000 -r 652f9d550531 repository_dependencies.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/repository_dependencies.xml Tue Apr 22 13:56:22 2014 -0400
b
@@ -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="70227007b991" name="msa_datatypes" owner="iuc" toolshed="http://toolshed.g2.bx.psu.edu" />
+</repositories>
b
diff -r 000000000000 -r 652f9d550531 tool-data/infernal.loc.sample
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tool-data/infernal.loc.sample Tue Apr 22 13:56:22 2014 -0400
b
@@ -0,0 +1,17 @@
+#This is a sample file distributed with Galaxy that is used to define a
+#list of infernal covariance models, using three columns tab separated
+#(longer whitespace are TAB characters):
+#
+#The entries are as follows:
+#
+#<unique_id> <covariance model name> <path>
+#
+#Your infernal.loc file should include an entry per line for each "base name" 
+#you have stored.  For example:
+#
+#rfam01 RFAM 4.2 08 Aug 2013 /data/0/galaxy_data/infernal/08_08_2013/rfam.cm
+#
+#...etc...
+#
+
+
b
diff -r 000000000000 -r 652f9d550531 tool_dependencies.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_dependencies.xml Tue Apr 22 13:56:22 2014 -0400
b
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<tool_dependency>
+    <package name="infernal" version="1.1">
+        <repository changeset_revision="b5c01b683dc9" name="package_infernal_1_1" owner="iuc" toolshed="http://toolshed.g2.bx.psu.edu" />
+    </package>
+    <package name="gnu_coreutils" version="8.21">
+        <repository changeset_revision="5f6c9b57f32b" name="package_gnu_coreutils_8_21" owner="iuc" toolshed="http://toolshed.g2.bx.psu.edu" />
+    </package>
+</tool_dependency>