Question: Export reads from an alignment file
gravatar for elena.syp
2.8 years ago by
elena.syp0 wrote:

Hi! I have annotated some clustered genes in a very fragmented genome assembly based on Illumina reads. I want to study their synteny (impossible in the assembly I have) and I have a lot of nanopore reads as well. I had aligned the nanopore reads to the Illumina annotated-genes using BWA and I have now an alignment file. I now want to get the COMPLETE SEQUENCE of the reads aligning to my reference (so I can make a local assembly of those reads and hopefully get the synteny) and NOT ONLY THE PART OF THE READS THAT ALIGN TO THE REFERENCE. Is it possible to do that? How can I do it? Thanks a lot!

mapping nanopore sam samtools bwa • 942 views
ADD COMMENTlink written 2.8 years ago by elena.syp0

samtools view | cut?? #oramimissingsomething ?

ADD REPLYlink written 2.8 years ago by Pierre Lindenbaum129k

As per Pierre, you can just use samtools view -b -f 0x2 MyBAM.bam in order to extract just the reads that have aligned successfully to your genome (assuming paired-end). You can then use the cut command in combination in order to pull out information relating to read positions if you want to group them into specific loci prior to performing local assembly.

Another way to extract aligned reads over a defined genomic region is, for example:

samtools view -b -f 0x2 MyBAM.bam 5:135396277-135396306
ADD REPLYlink written 2.8 years ago by Kevin Blighe63k
Please log in to add an answer.


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