Question: extract nanopore reads from the bam/sam file
0
gravatar for kanshenglong
2.1 years ago by
Beijing
kanshenglong0 wrote:

Hi, After mapping the nanopore reads on the reference Genome, I want to extract raw reads from the bam/sam file. Can someone help me here? Thank you in advance!!

next-gen alignment genome • 1.1k views
ADD COMMENTlink written 2.1 years ago by kanshenglong0
1

samtools fastq should work. See inline help for options.

That said if you did the mapping yourself don't you have the original files? Or are you looking to get only mapped/unmapped reads?

ADD REPLYlink modified 2.1 years ago • written 2.1 years ago by genomax92k

Yes. I did this mapping by myself. And I am looking forward to get only mapped/unmapped reads. I mean to filter the nanopore reads which is identity with plastid genome by graphmap and samtools. So I can prevent from nuclear contamination when I assemble plastid genome. Thanks for your help!

ADD REPLYlink written 2.1 years ago by kanshenglong0

This information should have been in the original posting.

Take a look at: How To Filter Mapped Reads With Samtools

ADD REPLYlink written 2.1 years ago by genomax92k

What puzzles me is the command of filtering illumina reads same as nanopore reads? Thanks!

ADD REPLYlink written 2.1 years ago by kanshenglong0

Fastq format is a standard. Fastq headers will be different for illumina and nanopore.

If your reads are soft clipped (or not fully present in your alignment file) then you may want to gather just the nanopore headers of the two kinds and then retrieve the full reads from original data file.

ADD REPLYlink written 2.1 years ago by genomax92k

Thanks for your useful answer. And would you like to teach me to gather the headers of the mapped reads and retrieve the full reads from original data file.

ADD REPLYlink written 2.1 years ago by kanshenglong0
1

Filter the reads using the strategy above and then you could extract the read headers (will start with ^@something so grep for that pattern) and put them into a new file. Use the answer here to pull out those reads from original file: A: Extracting specific sequences from FASTQ using Seqtk

ADD REPLYlink modified 2.1 years ago • written 2.1 years ago by genomax92k

Thanks for your help!!

ADD REPLYlink written 2.1 years ago by kanshenglong0
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1308 users visited in the last hour