I am trying to use various datasets from hudson alpha and the fastq files have dots in them. I don't know how to remove the dots. I'm not really a programmer, but I did try to remove them using grep from the command line. I thought it worked, because it got rid of some lines. But I didn't get rid of all of them. I think the problem has something to do with grooming them. Does anyone know how to get rid of these dots?
Unconfigured Ad
Collapse
X
-
What kind of reads are those? Are they short reads, and only have a single line per read, or do they span several lines per read? If they span several lines per read, I'd parse them with BioPython's SeqIO and do the replacement in there:Originally posted by Giles View PostI am trying to use various datasets from hudson alpha and the fastq files have dots in them. I don't know how to remove the dots. I'm not really a programmer, but I did try to remove them using grep from the command line. I thought it worked, because it got rid of some lines. But I didn't get rid of all of them. I think the problem has something to do with grooming them. Does anyone know how to get rid of these dots?
The above code can be used as follows (save the code in fastq_replace_dots_with_Ns_in_seq.py):Code:import sys from Bio import Seq, SeqRecord, SeqIO for record in SeqIO.parse(sys.stdin,"fastq-sanger"): SeqIO.write(SeqRecord.SeqRecord(seq=Seq.Seq(str(record.seq).replace(".","N")),letter_annotations=record.letter_annotations,id=record.id,name=record.name,description=record.description),sys.stdout,"fastq-sanger")
cat fastq_with_dots.fq | python fastq_replace_dots_with_Ns_in_seq.py > fastq_with_Ns.fq
If they are single line reads, an awk solution should be quite easily possible as well. A simple search/replace of "." will not work if you have a Sanger Phred encoded file, however, since "." is a valid quality score in a +33 encoding. Also, just simply dropping lines with dots will lead to a corrupted file - don't do that.
Anyways, beware that a IUPAC dot means an gap of unknown size, which is distinct from an N (any *one* base), so be careful with how the downstream alignment is done, especially if the reads come from a technology that delivers long gaps in the reads.
-
If that turns out to be a bit slow, you could drop down to plain Python strings instead, e.g.Originally posted by arvid View PostWhat kind of reads are those? Are they short reads, and only have a single line per read, or do they span several lines per read? If they span several lines per read, I'd parse them with BioPython's SeqIO and do the replacement in there:
See also http://news.open-bio.org/news/2009/0...on-fast-fastq/Code:import sys from Bio.SeqIO.QualityIO import FastqGeneralIterator for title, seq, qual in FastqGeneralIterator(sys.stdin): print "@%s\n%s\n+\n%s" % (title, seq.replace(".", "N"), qual)
Comment
Latest Articles
Collapse
-
by SEQadmin2
Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?
Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating...-
Channel: Articles
10-14-2026, 09:55 AM -
-
by SEQadmin2
Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.
We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing...-
Channel: Articles
-
ad_right_rmr
Collapse
News
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by SEQadmin2, 10-22-2026, 11:13 AM
|
0 responses
53 views
0 reactions
|
Last Post
by SEQadmin2
10-22-2026, 11:13 AM
|
||
|
Started by SEQadmin2, 10-22-2026, 10:48 AM
|
0 responses
40 views
0 reactions
|
Last Post
by SEQadmin2
10-22-2026, 10:48 AM
|
||
|
Started by SEQadmin2, 10-15-2026, 10:52 AM
|
0 responses
46 views
0 reactions
|
Last Post
by SEQadmin2
10-15-2026, 10:52 AM
|
||
|
Started by SEQadmin2, 10-14-2026, 05:39 AM
|
0 responses
46 views
0 reactions
|
Last Post
by SEQadmin2
10-14-2026, 05:39 AM
|
Comment