mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Added solid_to_fastq and fastq_conversions converters to Convert Formats section
This commit is contained in:
@@ -77,6 +77,8 @@
|
||||
<tool file="maf/maf_to_bed.xml" />
|
||||
<tool file="maf/maf_to_fasta.xml" />
|
||||
<tool file="fasta_tools/tabular_to_fasta.xml" />
|
||||
<tool file="next_gen_conversion/solid_to_fastq.xml" />
|
||||
<tool file="next_gen_conversion/fastq_conversions.xml" />
|
||||
</section>
|
||||
<section name="Extract Features" id="features">
|
||||
<tool file="filters/ucsc_gene_bed_to_exon_bed.xml" />
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
#! /usr/bin/python
|
||||
|
||||
"""
|
||||
Performs various conversions around Sanger FASTQ data
|
||||
|
||||
usage: %prog [options]
|
||||
-c, --command=c: Command to run
|
||||
-i, --input=i: Input file to be converted
|
||||
-o, --outputFastqsanger=o: FASTQ Sanger converted output file for sol2std
|
||||
-s, --outputFastqsolexa=s: FASTQ Solexa converted output file
|
||||
-f, --outputFasta=f: FASTA converted output file
|
||||
|
||||
usage: %prog command input_file output_file
|
||||
"""
|
||||
|
||||
import os, sys, tempfile
|
||||
from galaxy import eggs
|
||||
import pkg_resources; pkg_resources.require( "bx-python" )
|
||||
from bx.cookbook import doc_optparse
|
||||
|
||||
def stop_err( msg ):
|
||||
sys.stderr.write( "%s\n" % msg )
|
||||
sys.exit()
|
||||
|
||||
def __main__():
|
||||
#Parse Command Line
|
||||
options, args = doc_optparse.parse( __doc__ )
|
||||
|
||||
cmd = "fq_all2std.pl %s %s > %s"
|
||||
if options.command == 'sol2std':
|
||||
cmd = cmd % (options.command, options.input, options.outputFastqsanger)
|
||||
elif options.command == 'std2sol':
|
||||
cmd = cmd % (options.command, options.input, options.outputFastqsolexa)
|
||||
elif options.command == 'fq2fa':
|
||||
cmd = cmd % (options.command, options.input, options.outputFasta)
|
||||
try:
|
||||
os.system(cmd)
|
||||
except Exception, eq:
|
||||
stop_err("Error converting data format.\n" + str(eq))
|
||||
|
||||
if __name__=="__main__": __main__()
|
||||
@@ -0,0 +1,133 @@
|
||||
<tool id="fastq_conversions" name="FASTQ Conversions" version="1.0.0">
|
||||
<description>converts between FASTQ data and other data formats</description>
|
||||
<command interpreter="python">
|
||||
fastq_conversions.py
|
||||
--command=$conversionType.type
|
||||
--input=$input
|
||||
#if $conversionType.type == "sol2std":
|
||||
--outputFastqsanger=$outputFastqsanger
|
||||
#else:
|
||||
--outputFastqsanger="None"
|
||||
#end if
|
||||
#if $conversionType.type == "std2sol":
|
||||
--outputFastqsolexa=$outputFastqsolexa
|
||||
#else:
|
||||
--outputFastqsolexa="None"
|
||||
#end if
|
||||
#if $conversionType.type == "fq2fa":
|
||||
--outputFasta=$outputFasta
|
||||
#else:
|
||||
--outputFasta="None"
|
||||
#end if
|
||||
</command>
|
||||
<inputs>
|
||||
<conditional name="conversionType">
|
||||
<param name="type" type="select" label="What type of conversion do you want to do?">
|
||||
<option value="sol2std">Solexa/Illumina FASTQ to standard Sanger FASTQ</option>
|
||||
<option value="std2sol">Standard Sanger FASTQ to Solexa/Illumina FASTQ</option>
|
||||
<option value="fq2fa">Various FASTQ to FASTA</option>
|
||||
</param>
|
||||
<when value="sol2std">
|
||||
<param name="input" type="data" format="fastqsolexa" label="File to convert" />
|
||||
</when>
|
||||
<when value="std2sol">
|
||||
<param name="input" type="data" format="fastqsanger" label="File to convert" />
|
||||
</when>
|
||||
<when value="fq2fa">
|
||||
<param name="input" type="data" format="fastqsolexa, fastqsanger" label="File to convert" />
|
||||
</when>
|
||||
</conditional>
|
||||
</inputs>
|
||||
<outputs>
|
||||
<data name="outputFastqsanger" format="fastqsanger">
|
||||
<filter>conversionType['type'] == 'sol2std'</filter>
|
||||
</data>
|
||||
<data name="outputFastqsolexa" format="fastqsolexa">
|
||||
<filter>conversionType['type'] == 'std2sol'</filter>
|
||||
</data>
|
||||
<data name="outputFasta" format="fasta">
|
||||
<filter>conversionType['type'] == 'fq2fa'</filter>
|
||||
</data>
|
||||
</outputs>
|
||||
<tests>
|
||||
<test>
|
||||
<param name="type" value="sol2std" />
|
||||
<param name="input" value="bwa_phiX_sanger.fastq" ftype="fastqsolexa" />
|
||||
<output name="outputFastqsanger" file="fastq_conv_out1.fastqsanger" />
|
||||
</test>
|
||||
<test>
|
||||
<param name="type" value="std2sol" />
|
||||
<param name="input" value="1.fastqsanger" ftype="fastqsanger" />
|
||||
<output name="outputFastqsolexa" file="fastq_conv_out2.fastqsolexa" />
|
||||
</test>
|
||||
<test>
|
||||
<param name="type" value="fq2fa" />
|
||||
<param name="input" value="1.fastqsanger" ftype="fastqsanger" />
|
||||
<output name="outputFasta" file="fastq_conv_out4.fasta" />
|
||||
</test>
|
||||
</tests>
|
||||
<help>
|
||||
**What it does**
|
||||
|
||||
This tool offers several conversions options relating to the FASTQ format.
|
||||
|
||||
-----
|
||||
|
||||
**Examples**
|
||||
|
||||
- Converting the Solexa/Illumina FASTQ data::
|
||||
|
||||
@081017-and-081020:1:1:1715:1759
|
||||
GGACTCAGATAGTAATCCACGCTCCTTTAAAATATC
|
||||
+
|
||||
II#IIIIIII$5+.(9IIIIIII$%*$G$A31I&&B
|
||||
|
||||
- will produce the following Sanger FASTQ data::
|
||||
|
||||
@081017-and-081020:1:1:1715:1759
|
||||
GGACTCAGATAGTAATCCACGCTCCTTTAAAATATC
|
||||
+
|
||||
++!+++++++!!!!!"+++++++!!!!)!%!!+!!%!
|
||||
|
||||
- Converting standard Sanger FASTQ::
|
||||
|
||||
@1831_573_1004/1
|
||||
AATACTTTCGGCGCCCTAAACCAGCTCACTGGGG
|
||||
+
|
||||
><C&&9952+C>5<.?<79,=42<292:<(9/-7
|
||||
@1831_573_1050/1
|
||||
TTTATGGGTATGGCCGCTCACAGGCCAGCGGCCT
|
||||
+
|
||||
;@@17?@=>7??@A8?==@4A?A4)&+.'&+'1,
|
||||
|
||||
- will produce the following Solexa/Illumina FASTQ data::
|
||||
|
||||
@1831_573_1004/1
|
||||
AATACTTTCGGCGCCCTAAACCAGCTCACTGGGG
|
||||
+
|
||||
][bEEXXTQJb]T[M^[VXK\SQ[QXQY[GXNLV
|
||||
@1831_573_1050/1
|
||||
TTTATGGGTATGGCCGCTCACAGGCCAGCGGCCT
|
||||
+
|
||||
Z__PV^_\]V^^_`W^\\_S`^`SHEJMFEJFPK
|
||||
|
||||
- Converting the Sanger FASTQ data::
|
||||
|
||||
@1831_573_1004/1
|
||||
AATACTTTCGGCGCCCTAAACCAGCTCACTGGGG
|
||||
+
|
||||
><C&&9952+C>5<.?<79,=42<292:<(9/-7
|
||||
@1831_573_1050/1
|
||||
TTTATGGGTATGGCCGCTCACAGGCCAGCGGCCT
|
||||
+
|
||||
;@@17?@=>7??@A8?==@4A?A4)&+.'&+'1,
|
||||
|
||||
- will produce the following FASTA data::
|
||||
|
||||
>1831_573_1004/1
|
||||
AATACTTTCGGCGCCCTAAACCAGCTCACTGGGG
|
||||
>1831_573_1050/1
|
||||
TTTATGGGTATGGCCGCTCACAGGCCAGCGGCCT
|
||||
|
||||
</help>
|
||||
</tool>
|
||||
@@ -0,0 +1,53 @@
|
||||
#! /usr/bin/python
|
||||
|
||||
"""
|
||||
Converts SOLiD data to Sanger FASTQ format.
|
||||
|
||||
usage: %prog [options]
|
||||
-i, --input1=i: Forward reads file
|
||||
-q, --input2=q: Forward qual file
|
||||
-I, --input3=I: Reverse reads file
|
||||
-Q, --input4=Q: Reverse qual file
|
||||
-o, --output1=o: Forward output
|
||||
-r, --output2=r: Reverse output
|
||||
|
||||
usage: %prog forward_reads_file forwards_qual_file reverse_reads_file(or_None) reverse_qual_file(or_None) output_file ouptut_id output_dir
|
||||
"""
|
||||
|
||||
import os, sys, tempfile
|
||||
from galaxy import eggs
|
||||
import pkg_resources; pkg_resources.require( "bx-python" )
|
||||
from bx.cookbook import doc_optparse
|
||||
|
||||
def stop_err( msg ):
|
||||
sys.stderr.write( "%s\n" % msg )
|
||||
sys.exit()
|
||||
|
||||
def __main__():
|
||||
#Parse Command Line
|
||||
options, args = doc_optparse.parse( __doc__ )
|
||||
# if paired-end data (have reverse input files)
|
||||
if options.input3 != "None" and options.input4 != "None":
|
||||
tmpf = tempfile.NamedTemporaryFile() #forward reads
|
||||
tmpr = tempfile.NamedTemporaryFile() #reverse reads
|
||||
|
||||
cmd1 = "bwa_solid2fastq_modified.pl 'yes' %s %s %s %s %s %s %s 2>&1" %(tmpf.name,tmpr.name,None,options.input1,options.input2,options.input3,options.input4)
|
||||
try:
|
||||
os.system(cmd1)
|
||||
os.system('gunzip -c %s >> %s' %(tmpf.name,options.output1))
|
||||
os.system('gunzip -c %s >> %s' %(tmpr.name,options.output2))
|
||||
|
||||
except Exception, eq:
|
||||
stop_err("Error converting data to fastq format.\n" + str(eq))
|
||||
# if single-end data
|
||||
else:
|
||||
tmpf = tempfile.NamedTemporaryFile()
|
||||
cmd1 = "bwa_solid2fastq_modified.pl 'no' %s %s %s %s %s %s %s 2>&1" % (tmpf.name, None, None, options.input1, options.input2, None, None)
|
||||
try:
|
||||
os.system(cmd1)
|
||||
os.system('gunzip -c %s >> %s' % (tmpf.name, options.output1))
|
||||
tmpf.close()
|
||||
except Exception, eq:
|
||||
stop_err("Error converting data to fastq format.\n" + str(eq))
|
||||
|
||||
if __name__=="__main__": __main__()
|
||||
@@ -0,0 +1,101 @@
|
||||
<tool id="solid_to_fastq" name="SOLiD-to-FASTQ" version="1.0.0">
|
||||
<description>converts SOLiD data to FASTQ data</description>
|
||||
<command interpreter="python">
|
||||
solid_to_fastq.py
|
||||
--input1=$input1
|
||||
--input2=$input2
|
||||
#if $paired.pairedSingle == "single":
|
||||
--input3="None"
|
||||
--input4="None"
|
||||
#else:
|
||||
--input3=$input3
|
||||
--input4=$input4
|
||||
#end if
|
||||
--output1=$output1
|
||||
#if $paired.pairedSingle == "single":
|
||||
--output2="None"
|
||||
#else:
|
||||
--output2=$output2
|
||||
#end if
|
||||
</command>
|
||||
<inputs>
|
||||
<conditional name="paired">
|
||||
<param name="pairedSingle" type="select" label="Is this library mate-paired?">
|
||||
<option value="single">Single</option>
|
||||
<option value="paired">Paired</option>
|
||||
</param>
|
||||
<when value="single">
|
||||
<param name="input1" type="data" format="csfasta" label="F3 read file" />
|
||||
<param name="input2" type="data" format="qualsolid" label="F3 qual file" />
|
||||
</when>
|
||||
<when value="paired">
|
||||
<param name="input1" type="data" format="csfasta" label="F3 read file" />
|
||||
<param name="input2" type="data" format="qualsolid" label="F3 qual file" />
|
||||
<param name="input3" type="data" format="csfasta" label="R3 read file" />
|
||||
<param name="input4" type="data" format="qualsolid" label="R3 qual file" />
|
||||
</when>
|
||||
</conditional>
|
||||
</inputs>
|
||||
<outputs>
|
||||
<!-- Variable number of outputs. Either one (for single-end) or two (for paired-end) -->
|
||||
<data name="output1" format="tabular"/>
|
||||
<data name="output2" format="tabular">
|
||||
<filter>paired['pairedSingle'] == 'paired'</filter>
|
||||
</data>
|
||||
</outputs>
|
||||
<tests>
|
||||
<test>
|
||||
<param name="pairedSingle" value="single" />
|
||||
<param name="input1" value="s2fq_phiX.csfasta" ftype="csfasta" />
|
||||
<param name="input2" value="s2fq_phiX.qualsolid" ftype="qualsolid" />
|
||||
<output name="output1" file="s2fq_out1.tabular" />
|
||||
</test>
|
||||
<!-- testing framework does not deal with multiple outputs yet
|
||||
<test>
|
||||
<param name="pairedSingle" value="paired" />
|
||||
<param name="input1" value="s2fq_paired_F3.csfasta" ftype="csfasta" />
|
||||
<param name="input2" value="s2fq_paired_F3_QV.qualsolid" ftype="qualsolid" />
|
||||
<param name="input3" value="s2fq_paired_R3.csfasta" ftype="csfasta" />
|
||||
<param name="input4" value="s2fq_paired_R3_QV.qualsolid" ftype="qualsolid" />
|
||||
<output name="output1" file="s2fq_out2.tabular" />
|
||||
<output name="output2" file="s2fq_out3.tabular" />
|
||||
</test>
|
||||
-->
|
||||
</tests>
|
||||
<help>
|
||||
|
||||
**What it does**
|
||||
|
||||
This tool takes reads and quality files and converts them to FASTQ data ( Sanger variant ). Note that it also converts sequences to base pairs.
|
||||
|
||||
-----
|
||||
|
||||
**Example**
|
||||
|
||||
- Converting the following sequences::
|
||||
|
||||
>seq1
|
||||
T00030133312212111300011021310132222
|
||||
>seq2
|
||||
T03330322230322112131010221102122113
|
||||
|
||||
- and quality scores::
|
||||
|
||||
>seq1
|
||||
4 29 34 34 32 32 24 24 20 17 10 34 29 20 34 13 30 34 22 24 11 28 19 17 34 17 24 17 25 34 7 24 14 12 22
|
||||
>seq2
|
||||
8 26 31 31 16 22 30 31 28 29 22 30 30 31 32 23 30 28 28 31 19 32 30 32 19 8 32 10 13 6 32 10 6 16 11
|
||||
|
||||
- will produce the following Sanger FASTQ data::
|
||||
|
||||
@seq1
|
||||
AATACTTTCGGCGCCCTAAACCAGCTCACTGGGG
|
||||
+
|
||||
>CCAA9952+C>5C.?C79,=42C292:C(9/-7
|
||||
@seq2
|
||||
TTTATGGGTATGGCCGCTCACAGGCCAGCGGCCT
|
||||
+
|
||||
;@@17?@=>7??@A8?==@4A?A4)A+.'A+'1,
|
||||
|
||||
</help>
|
||||
</tool>
|
||||
Reference in New Issue
Block a user