Mercurial > repos > devteam > fastq_combiner
changeset 3:5b1f1064c5df draft
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/galaxy_sequence_utils/fastq_combiner commit f2582539542b33240234e8ea6093e25d0aee9b6a
author | devteam |
---|---|
date | Sat, 30 Sep 2017 14:55:16 -0400 |
parents | 4333affc32dd |
children | d0e9cb9ab094 |
files | fastq_combiner.py fastq_combiner.xml tool_dependencies.xml |
diffstat | 3 files changed, 70 insertions(+), 126 deletions(-) [+] |
line wrap: on
line diff
--- a/fastq_combiner.py Fri Dec 18 19:27:48 2015 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -#Dan Blankenberg -import sys, os, shutil -from galaxy_utils.sequence.fastq import fastqWriter, fastqSequencingRead, fastqCombiner, fastqFakeFastaScoreReader -from galaxy_utils.sequence.fasta import fastaReader, fastaNamedReader - -def main(): - #Read command line arguments - fasta_filename = sys.argv[1] - fasta_type = sys.argv[2] or 'fasta' #should always be fasta or csfasta? what if txt? - qual_filename = sys.argv[3] - qual_type = sys.argv[4] or 'qualsanger' #qual454 qualsolid - output_filename = sys.argv[5] - force_quality_encoding = sys.argv[6] - if force_quality_encoding == 'None': - force_quality_encoding = None - - format = 'sanger' - if fasta_type == 'csfasta' or qual_type == 'qualsolid': - format = 'cssanger' - elif qual_type == 'qualsolexa': - format = 'solexa' - elif qual_type == 'qualillumina': - format = 'illumina' - - out = fastqWriter( open( output_filename, 'wb' ), format = format, force_quality_encoding = force_quality_encoding ) - if qual_filename == 'None': - qual_input = fastqFakeFastaScoreReader( format, quality_encoding = force_quality_encoding ) - else: - qual_input = fastaNamedReader( open( qual_filename, 'rb' ) ) - - fastq_combiner = fastqCombiner( format ) - i = None - skip_count = 0 - for i, sequence in enumerate( fastaReader( open( fasta_filename, 'rb' ) ) ): - quality = qual_input.get( sequence ) - if quality: - fastq_read = fastq_combiner.combine( sequence, quality ) - out.write( fastq_read ) - else: - skip_count += 1 - out.close() - if i is None: - print "Your file contains no valid FASTA sequences." - else: - print qual_input.has_data() - print 'Combined %s of %s sequences with quality scores (%.2f%%).' % ( i - skip_count + 1, i + 1, float( i - skip_count + 1 ) / float( i + 1 ) * 100.0 ) - -if __name__ == "__main__": - main()
--- a/fastq_combiner.xml Fri Dec 18 19:27:48 2015 -0500 +++ b/fastq_combiner.xml Sat Sep 30 14:55:16 2017 -0400 @@ -1,67 +1,69 @@ -<tool id="fastq_combiner" name="Combine FASTA and QUAL" version="1.0.1"> - <description>into FASTQ</description> - <requirements> - <requirement type="package" version="1.0.0">galaxy_sequence_utils</requirement> - </requirements> - <command interpreter="python">fastq_combiner.py '$fasta_file' '${fasta_file.extension}' '$qual_file' '${qual_file.extension}' '$output_file' '$force_quality_encoding'</command> - <inputs> - <param name="fasta_file" type="data" format="fasta,csfasta" label="FASTA File" /> - <param name="qual_file" type="data" format="qual" label="Quality Score File" optional="True" /> - <param name="force_quality_encoding" type="select" label="Force Quality Score encoding"> - <option value="None">Use Source Encoding</option> - <option value="ascii" selected="True">ASCII</option> - <option value="decimal">Decimal</option> - </param> - </inputs> - <outputs> - <data name="output_file" format="fastqsanger"> - <change_format> - <when input_dataset="fasta_file" attribute="extension" value="csfasta" format="fastqcssanger" /> - <when input_dataset="qual_file" attribute="extension" value="qualsolid" format="fastqcssanger" /> - <when input_dataset="qual_file" attribute="extension" value="qualsolexa" format="fastqsolexa" /> - <when input_dataset="qual_file" attribute="extension" value="qualillumina" format="fastqillumina" /> - </change_format> - </data> - </outputs> - <tests> - <test> - <param name="fasta_file" value="s2fq_phiX.csfasta" ftype="csfasta" /> - <param name="qual_file" value="s2fq_phiX.qualsolid" ftype="qualsolid" /> - <param name="force_quality_encoding" value="None" /> - <output name="output_file" file="combine_phiX_out_1.fastqcssanger" /> - </test> - <test> - <param name="fasta_file" value="s2fq_phiX.csfasta" ftype="csfasta" /> - <param name="qual_file" value="s2fq_phiX.qualsolid" ftype="qualsolid" /> - <param name="force_quality_encoding" value="ascii" /> - <output name="output_file" file="combine_phiX_out_2.fastqcssanger" /> - </test> - <test> - <param name="fasta_file" value="fastq_combiner_in_1.fasta" ftype="fasta" /> - <param name="qual_file" value="fastq_combiner_in_1.qual454" ftype="qual454" /> - <param name="force_quality_encoding" value="None" /> - <output name="output_file" file="wrapping_as_sanger.fastqsanger" /> - </test> - <test> - <param name="fasta_file" value="fastq_combiner_in_1.fasta" ftype="fasta" /> - <param name="qual_file" value="fastq_combiner_in_1.qual454" ftype="qual454" /> - <param name="force_quality_encoding" value="decimal" /> - <output name="output_file" file="wrapping_as_sanger_decimal.fastqsanger" /> - </test> - <test> - <param name="fasta_file" value="fastq_combiner_in_1.fasta" ftype="fasta" /> - <param name="qual_file" /> - <param name="force_quality_encoding" value="decimal" /> - <output name="output_file" file="fastq_combiner_no_qual_decimal_out_1.fastqsanger" /> - </test> - <test> - <param name="fasta_file" value="s2fq_phiX.csfasta" ftype="csfasta" /> - <param name="qual_file" /> - <param name="force_quality_encoding" value="ascii" /> - <output name="output_file" file="fastq_combiner_no_qual_ascii_out_1.fastqcssanger" /> - </test> - </tests> - <help> +<tool id="fastq_combiner" name="Combine FASTA and QUAL" version="1.1.1"> + <description>into FASTQ</description> + <requirements> + <requirement type="package" version="1.1.1">galaxy_sequence_utils</requirement> + </requirements> + <command><![CDATA[ +gx-fastq-combiner '$fasta_file' '${fasta_file.extension}' '$qual_file' '${qual_file.extension}' '$output_file' $force_quality_encoding + ]]></command> + <inputs> + <param name="fasta_file" type="data" format="fasta,csfasta" label="FASTA File" /> + <param name="qual_file" type="data" format="qual" optional="true" label="Quality Score File" /> + <param name="force_quality_encoding" type="select" label="Force Quality Score encoding"> + <option value="None">Use Source Encoding</option> + <option value="ascii" selected="true">ASCII</option> + <option value="decimal">Decimal</option> + </param> + </inputs> + <outputs> + <data name="output_file" format="fastqsanger"> + <change_format> + <when input="fasta_file" value="csfasta" format="fastqcssanger" /> + <when input="qual_file" value="qualsolid" format="fastqcssanger" /> + <when input="qual_file" value="qualsolexa" format="fastqsolexa" /> + <when input="qual_file" value="qualillumina" format="fastqillumina" /> + </change_format> + </data> + </outputs> + <tests> + <test> + <param name="fasta_file" value="s2fq_phiX.csfasta" ftype="csfasta" /> + <param name="qual_file" value="s2fq_phiX.qualsolid" ftype="qualsolid" /> + <param name="force_quality_encoding" value="None" /> + <output name="output_file" file="combine_phiX_out_1.fastqcssanger" /> + </test> + <test> + <param name="fasta_file" value="s2fq_phiX.csfasta" ftype="csfasta" /> + <param name="qual_file" value="s2fq_phiX.qualsolid" ftype="qualsolid" /> + <param name="force_quality_encoding" value="ascii" /> + <output name="output_file" file="combine_phiX_out_2.fastqcssanger" /> + </test> + <test> + <param name="fasta_file" value="fastq_combiner_in_1.fasta" ftype="fasta" /> + <param name="qual_file" value="fastq_combiner_in_1.qual454" ftype="qual454" /> + <param name="force_quality_encoding" value="None" /> + <output name="output_file" file="wrapping_as_sanger.fastqsanger" /> + </test> + <test> + <param name="fasta_file" value="fastq_combiner_in_1.fasta" ftype="fasta" /> + <param name="qual_file" value="fastq_combiner_in_1.qual454" ftype="qual454" /> + <param name="force_quality_encoding" value="decimal" /> + <output name="output_file" file="wrapping_as_sanger_decimal.fastqsanger" /> + </test> + <test> + <param name="fasta_file" value="fastq_combiner_in_1.fasta" ftype="fasta" /> + <param name="qual_file" /> + <param name="force_quality_encoding" value="decimal" /> + <output name="output_file" file="fastq_combiner_no_qual_decimal_out_1.fastqsanger" /> + </test> + <test> + <param name="fasta_file" value="s2fq_phiX.csfasta" ftype="csfasta" /> + <param name="qual_file" /> + <param name="force_quality_encoding" value="ascii" /> + <output name="output_file" file="fastq_combiner_no_qual_ascii_out_1.fastqcssanger" /> + </test> + </tests> + <help><![CDATA[ **What it does** This tool joins a FASTA file to a Quality Score file, creating a single FASTQ block for each read. @@ -69,11 +71,8 @@ Specifying a set of quality scores is optional; when not provided, the output will be fastqsanger or fastqcssanger (when a csfasta is provided) with each quality score being the maximal allowed value (93). Use this tool, for example, to convert 454-type output to FASTQ. - - </help> - - <citations> - <citation type="doi">10.1093/bioinformatics/btq281</citation> - </citations> - + ]]></help> + <citations> + <citation type="doi">10.1093/bioinformatics/btq281</citation> + </citations> </tool>
--- a/tool_dependencies.xml Fri Dec 18 19:27:48 2015 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -<?xml version="1.0"?> -<tool_dependency> - <package name="galaxy_sequence_utils" version="1.0.0"> - <repository changeset_revision="6334612a010e" name="package_galaxy_utils_1_0" owner="devteam" toolshed="https://testtoolshed.g2.bx.psu.edu" /> - </package> -</tool_dependency>