Go Back   SEQanswers > Bioinformatics > Bioinformatics

Similar Threads
Thread Thread Starter Forum Replies Last Post
paired-end, bam-file-format Azazel Bioinformatics 4 06-27-2012 11:09 PM
how to filter a bam file paolo.kunder Bioinformatics 2 01-20-2012 01:07 AM
how to filter BWA paired-end alignments? guru Bioinformatics 2 08-24-2011 12:32 PM
Paired-end Bam from single-end aligned sam ramouz87 Bioinformatics 4 08-17-2011 12:55 PM
Tophat output BAM file ISIZE Error ghbore RNA Sequencing 2 11-28-2010 11:49 PM

Thread Tools
Old 09-08-2010, 09:54 PM   #1
Leif Bergsagel
Junior Member
Location: Arizona

Join Date: Aug 2010
Posts: 2
Unhappy Filter paired end BAM file based on iSize

I have aligned Illumina Mate Pair data using bwa. I only care about large structural variation, and would like to discard paired ends with iSize less then 1000. This would get rid of a lot of small fragments that represent artifacts of the library construction. How can I do this?

The steps I have followed to now are summarized below:

# create bwa index for human genome
bwa index -a bwtsw human_g1k_v37.fasta

#Reverse complement fastq to convert from Mate Pair to Paired End
fastx_reverse_complement -i R1_Ill.fastq -o R1.fastq
fastx_reverse_complement -i R2_Ill.fastq -o R2.fastq

#Align individual reads
bwa aln -I human_g1k_v37.fasta R1.fastq>R1.sai
bwa aln -I human_g1k_v37.fasta R2.fastq>R2.sai

# Align paired ends
bwa sampe human_g1k_v37.fasta R1.sai R2.sai R1.fastq R2.fastq>pe.sam

# create BAM file
samtools view -bT human_g1k_v37.fasta -o pe.bam pe.sam
sort pe.bam pe_sort
samtools index pe_sort.bam

# discard concordant pairs or low quality or unmapped or unmapped mate
samtools view -b -q 37 -F 1806 pe_sort.bam -o pe_discordant.bam
Leif Bergsagel is offline   Reply With Quote
Old 09-09-2010, 01:24 PM   #2
Leif Bergsagel
Junior Member
Location: Arizona

Join Date: Aug 2010
Posts: 2

I have found a simple answer:

cat XXX.sam | awk -F'\t' '{if ($9 > 1000 || $9 < -1000 || $9 == 0 ) print $0}' >output
Leif Bergsagel is offline   Reply With Quote
Old 12-16-2010, 11:50 AM   #3
Junior Member
Location: nutley,nj

Join Date: Jun 2010
Posts: 4
Default F 1806


To remove properly paired reads or concordant reads why do you use F 1806 . I guess to remove or filter out properly paired reads shouldn't we use F 2 , Since properly paired read flag is 2 ?

Thanks a lot
rakeshponnala is offline   Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT -8. The time now is 03:05 AM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO