Is there a way to convert a fastq file back to the original csfasta and qual files?
Seqanswers Leaderboard Ad
Collapse
Announcement
Collapse
No announcement yet.
X
-
Originally posted by samt View PostIs there a way to convert a fastq file back to the original csfasta and qual files?
Code:#!/bin/perl use strict; use warnings; my $csfastq = shift; die unless defined($csfastq); my $csfasta = $csfastq; $csfasta =~ s/csfastq$/csfasta/; die unless !($csfastq eq $csfasta); my $qual = $csfastq; $qual =~ s/.csfastq$/_QV.qual/; die unless !($csfastq eq $qual); open(FHcsfastq, "$csfastq") || die; open(FHcsfasta, ">$csfasta") || die; open(FHqual, ">$qual") || die; my $state = 0; my ($n, $r, $q) = ("", "", ""); while(defined(my $line = <FHcsfastq>)) { chomp($line); if(0 == $state) { &print_out(\*FHcsfasta, \*FHqual, $n, $r, $q); $n = $line; $n =~ s/^\@/>/; } elsif(1 == $state) { $r = $line; } elsif(3 == $state) { $q = $line; # convert back from SANGER phred my $tmp_q = ""; for(my $i=0;$i<length($q);$i++) { my $Q = ord(substr($q, $i, 1)) - 33; die unless (0 < $Q); if(0 < $i) { $tmp_q .= " "; } $tmp_q .= "$Q"; } $q = $tmp_q; } $state = ($state+1)%4; } &print_out(\*FHcsfasta, \*FHqual, $n, $r, $q); close(FHcsfasta); close(FHcsfastq); close(FHqual); sub print_out { my ($FHcsfasta, $FHqual, $n, $r, $q) = @_; if(0 < length($n)) { print $FHcsfasta "$n\n$r\n"; print $FHqual "$n\n$q\n"; } }
-
Sorry to keep asking, I do appreciate your help..it crashed at:
Died at fastqtocs.pl line 34, <FHcsfastq> line 4.
for(my $i=0;$i<length($q);$i++) {
my $Q = ord(substr($q, $i, 1)) - 33;
--> die unless (0 < $Q);
From another post I read, is this a problem of negative qualities?
Comment
-
Originally posted by samt View PostSorry to keep asking, I do appreciate your help..it crashed at:
Died at fastqtocs.pl line 34, <FHcsfastq> line 4.
for(my $i=0;$i<length($q);$i++) {
my $Q = ord(substr($q, $i, 1)) - 33;
--> die unless (0 < $Q);
From another post I read, is this a problem of negative qualities?
I don't allow negetive qualities, though I guess they could be "missing".
Comment
-
A question about the BFAST solid2fastq script:
The SOLiD reads I have use "." instead of "4" for "N" basecalls. These bases have a qual score of -1.
After running the script on my reads, all the "." remain as "4", and the "-1" values were converted to " (ASCII 34). Should I manually convert the "." in the sequences to 4, and convert the " qualities to ! (ASCII 33, quality 0 ) ?
Example:
@226_3_65
T...11..3.2..1020.2.13.0.1....0...332..322.1233..1 3
+
"""51"","*""4405",")'"2")"""")"""'5$""0),"2(*5 ""%+
came from
>226_3_65_F3
T...11..3.2..1020.2.13.0.1....0...332..322.1233..1 3
and
>226_3_65_F3
-1 -1 -1 20 16 -1 -1 11 -1 9 -1 -1 19 19 15 20 -1 11 -1 8 6 -1 17 -1 8 -1 -1 -1 -1 8 -1 -1 -1 6 20 3 -1 -1 15 8 11 -1 17 7 9 20 -1 -1 4 10Last edited by juan; 10-28-2009, 09:04 AM.
Comment
-
That's strange, the space between the 1 and the 3 at the end of the line is a bug in the FORUM code! When I tried to remove the space by clicking "edit", the space does not appear. It pops up during the posting. Look below for example:
4441144342441020424134041444404443324432241233441222222
Comment
Latest Articles
Collapse
-
by seqadmin
The field of epigenetics has traditionally concentrated more on DNA and how changes like methylation and phosphorylation of histones impact gene expression and regulation. However, our increased understanding of RNA modifications and their importance in cellular processes has led to a rise in epitranscriptomics research. “Epitranscriptomics brings together the concepts of epigenetics and gene expression,” explained Adrien Leger, PhD, Principal Research Scientist...-
Channel: Articles
04-22-2024, 07:01 AM -
-
by seqadmin
Proteins are often described as the workhorses of the cell, and identifying their sequences is key to understanding their role in biological processes and disease. Currently, the most common technique used to determine protein sequences is mass spectrometry. While still a valuable tool, mass spectrometry faces several limitations and requires a highly experienced scientist familiar with the equipment to operate it. Additionally, other proteomic methods, like affinity assays, are constrained...-
Channel: Articles
04-04-2024, 04:25 PM -
ad_right_rmr
Collapse
News
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by seqadmin, Yesterday, 08:47 AM
|
0 responses
16 views
0 likes
|
Last Post
by seqadmin
Yesterday, 08:47 AM
|
||
Started by seqadmin, 04-11-2024, 12:08 PM
|
0 responses
60 views
0 likes
|
Last Post
by seqadmin
04-11-2024, 12:08 PM
|
||
Started by seqadmin, 04-10-2024, 10:19 PM
|
0 responses
60 views
0 likes
|
Last Post
by seqadmin
04-10-2024, 10:19 PM
|
||
Started by seqadmin, 04-10-2024, 09:21 AM
|
0 responses
54 views
0 likes
|
Last Post
by seqadmin
04-10-2024, 09:21 AM
|
Comment