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?
Seqanswers Leaderboard Ad
Collapse
Announcement
Collapse
No announcement yet.
X
-
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?
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.
-
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:
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 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 -
-
by seqadmin
Despite advancements in sequencing platforms and related sample preparation technologies, certain sample types continue to present significant challenges that can compromise sequencing results. Pedro Echave, Senior Manager of the Global Business Segment at Revvity, explained that the success of a sequencing experiment ultimately depends on the amount and integrity of the nucleic acid template (RNA or DNA) obtained from a sample. “The better the quality of the nucleic acid isolated...-
Channel: Articles
03-22-2024, 06:39 AM -
ad_right_rmr
Collapse
News
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by seqadmin, 04-11-2024, 12:08 PM
|
0 responses
30 views
0 likes
|
Last Post
by seqadmin
04-11-2024, 12:08 PM
|
||
Started by seqadmin, 04-10-2024, 10:19 PM
|
0 responses
32 views
0 likes
|
Last Post
by seqadmin
04-10-2024, 10:19 PM
|
||
Started by seqadmin, 04-10-2024, 09:21 AM
|
0 responses
28 views
0 likes
|
Last Post
by seqadmin
04-10-2024, 09:21 AM
|
||
Started by seqadmin, 04-04-2024, 09:00 AM
|
0 responses
53 views
0 likes
|
Last Post
by seqadmin
04-04-2024, 09:00 AM
|
Comment