SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



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

Reply
 
Thread Tools
Old 09-08-2010, 10: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, 02:24 PM   #2
Leif Bergsagel
Junior Member
 
Location: Arizona

Join Date: Aug 2010
Posts: 2
Default

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, 12:50 PM   #3
rakeshponnala
Junior Member
 
Location: nutley,nj

Join Date: Jun 2010
Posts: 4
Default F 1806

Hello,

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
Best,
Rakesh
rakeshponnala is offline   Reply With Quote
Reply

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 12:41 AM.


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