Update fastq format.

Now we only support FastqSolexa variants.
If the quality scores are presented as characters,
the integer values are obtained by their ascii code subtract 64.
This commit is contained in:
Wen-Yu Chung
2008-06-06 18:52:11 +00:00
parent e767816519
commit 782d7db6be
10 changed files with 70 additions and 132 deletions
+21 -14
View File
@@ -89,23 +89,30 @@ A sequence in FASTA format consists of a single-line description, followed by li
-----
**Fastq**
**FastqSolexa**
Fastq format stores sequences and Phred qualities in a single file. We define Fastq as the Sanger/Standard variant::
Fastq format stores sequences and quality scores in a single file. We define FastqSolexa as the Illumina (Solexa) variant::
@EAS54_6_R1_2_1_413_324
CCCTTCTTGTCTTCAGCGTTTCTCC
+
;;3;;;;;;;;;;;;7;;;;;;;88
@EAS54_6_R1_2_1_540_792
TTGGCAGGCCAAGGCCGATGGATCA
+
;;;;;;;;;;;7;;;;;-;;;3;83
@EAS54_6_R1_2_1_443_348
GTTGCTTCTGGCGTGGGTGGGGGGG
+EAS54_6_R1_2_1_443_348
;;;;;;;;;;;9;7;;.7;393333
@seq1
GACAGCTTGGTTTTTAGTGAGTTGTTCCTTTCTTT
+seq1
hhhhhhhhhhhhhhhhhhhhhhhhhhPW@hhhhhh
@seq2
GCAATGACGGCAGCAATAAACTCAACAGGTGCTGG
+seq2
hhhhhhhhhhhhhhYhhahhhhWhAhFhSIJGChO
Or::
@seq1
GAATTGATCAGGACATAGGACAACTGTAGGCACCAT
+seq1
40 40 40 40 35 40 40 40 25 40 40 26 40 9 33 11 40 35 17 40 40 33 40 7 9 15 3 22 15 30 11 17 9 4 9 4
@seq2
GAGTTCTCGTCGCCTGTAGGCACCATCAATCGTATG
+seq2
40 15 40 17 6 36 40 40 40 25 40 9 35 33 40 14 14 18 15 17 19 28 31 4 24 18 27 14 15 18 2 8 12 8 11 9
-----
**Gff**
+2 -6
View File
@@ -36,7 +36,7 @@ def __main__():
datatype = sys.argv[4]
seq_title_startswith = ''
qual_title_startswith = ''
default_coding_value = 33
default_coding_value = 64
fastq_block_lines = 0
for i, line in enumerate( file( infile_name ) ):
@@ -92,10 +92,6 @@ def __main__():
# digits
qual = line
else:
if datatype == 'fastqsolexa':
outfile_seq.close()
outfile_score.close()
stop_err( "This tool currently only works with the fastq solexa variant if the socres are integers, not ascii." )
# ascii
quality_score_length = len( line )
if quality_score_length == read_length + 1:
@@ -107,7 +103,7 @@ def __main__():
else:
stop_err( 'Invalid fastq format at line %d: the number of quality scores ( %d ) is not the same as bases ( %d ).' % ( i + 1, quality_score_length, read_length ) )
for j, char in enumerate( line ):
score = ord( char ) - qual_score_startswith # 33
score = ord( char ) - qual_score_startswith # 64
qual = "%s%s " % ( qual, str( score ) )
outfile_score.write( '%s\n' % qual )
+22 -32
View File
@@ -2,7 +2,7 @@
<description>extracts sequences and quality scores from FASTQ data</description>
<command interpreter="python">fastq_to_fasta_qual.py $input1 $output1 $output2 $input1.extension</command>
<inputs>
<param name="input1" type="data" format="fastq,fastqsolexa" label="Fastq file"/>
<param name="input1" type="data" format="fastqsolexa" label="Fastq file"/>
</inputs>
<outputs>
<data name="output1" format="fasta"/>
@@ -11,11 +11,11 @@
<tests>
<!-- NOTE: this tool generates 2 output files, but our functional tests currently only handle the last one generated -->
<test>
<param name="input1" value="1.fastq" ftype="fastq" />
<param name="input1" value="1.fastq" ftype="fastqsolexa" />
<output name="output1" file="fastq_to_fasta_qual_out2.fasta" />
</test>
<test>
<param name="input1" value="1.fastqsolexa" ftype="fastq" />
<param name="input1" value="1.fastqsolexa" ftype="fastqsolexa" />
<output name="output1" file="fastq_to_fasta_qual_out4.fasta" />
</test>
</tests>
@@ -23,13 +23,13 @@
.. class:: warningmark
IMPORTANT: With the Fastq Solexa variant, this tool currently only works with data where the quality scores are integers, ASCII quality scores are not supported.
IMPORTANT: This tool currently only support data where the quality scores are integers or ASCII quality scores with base 64.
-----
**What it does**
This tool extracts sequences and quality scores from FASTQ data ( both Sanger/Standard and Solexa variants ), producing a FASTA dataset and a QUAL dataset. With the Solexa variant, this tool currently only works with data where the quality scores are integers, ASCII quality scores are not supported.
This tool extracts sequences and quality scores from FASTQ data ( Solexa variants ), producing a FASTA dataset and a QUAL dataset.
-----
@@ -37,38 +37,28 @@ This tool extracts sequences and quality scores from FASTQ data ( both Sanger/St
- Converting the following Sanger/Standard fastq data::
@EAS54_6_R1_2_1_413_324
CCCTTCTTGTCTTCAGCGTTTCTCC
+
;;3;;;;;;;;;;;;7;;;;;;;88
@EAS54_6_R1_2_1_540_792
TTGGCAGGCCAAGGCCGATGGATCA
+
;;;;;;;;;;;7;;;;;-;;;3;83
@EAS54_6_R1_2_1_443_348
GTTGCTTCTGGCGTGGGTGGGGGGG
+EAS54_6_R1_2_1_443_348
;;;;;;;;;;;9;7;;.7;393333
@seq1
GACAGCTTGGTTTTTAGTGAGTTGTTCCTTTCTTT
+seq1
hhhhhhhhhhhhhhhhhhhhhhhhhhPW@hhhhhh
@seq2
GCAATGACGGCAGCAATAAACTCAACAGGTGCTGG
+seq2
hhhhhhhhhhhhhhYhhahhhhWhAhFhSIJGChO
- will extract the following sequences::
>EAS54_6_R1_2_1_413_324
CCCTTCTTGTCTTCAGCGTTTCTCC
>EAS54_6_R1_2_1_540_792
TTGGCAGGCCAAGGCCGATGGATCA
>EAS54_6_R1_2_1_443_348
GTTGCTTCTGGCGTGGGTGGGGGGG
>seq1
GACAGCTTGGTTTTTAGTGAGTTGTTCCTTTCTTT
>seq2
GCAATGACGGCAGCAATAAACTCAACAGGTGCTGG
- and quality scores::
>EAS54_6_R1_2_1_413_324
26 26 18 26 26 26 26 26 26 26 26 26 26 26 26 22 26 26 26 26 26 26 26 23 23
>EAS54_6_R1_2_1_540_792
26 26 26 26 26 26 26 26 26 26 26 22 26 26 26 26 26 12 26 26 26 18 26 23 18
>EAS54_6_R1_2_1_443_348
26 26 26 26 26 26 26 26 26 26 26 24 26 22 26 26 13 22 26 18 24 18 18 18 18
>seq1
40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 16 23 0 40 40 40 40 40 40
>seq2
40 40 40 40 40 40 40 40 40 40 40 40 40 40 25 40 40 33 40 40 40 40 23 40 1 40 6 40 19 9 10 7 3 40 15
**Example2**