Hi Raghvendra,

Make a BED file with the regions of interest, one per line and then:

samtools view -L roi.bed alignments.sorted.bam > subset.alignments.sorted.bam

Best,
Devon

____________________________________________
Devon Ryan, Ph.D.
Email: [email protected]
Tel: +49 (0)178 298-6067
Molecular and Cellular Cognition Lab
German Centre for Neurodegenerative Diseases (DZNE)
Ludwig-Erhard-Allee 2
53175 Bonn, Germany

On May 28, 2014, at 8:47 PM, raghvendra singh wrote:

> I have paired end read data in R1 and R2 I mapped by using Bowtei2. R1.sam 
> and R2.sam.
> I have converted sam file to bam file and sorted and index it by using 
> samtools view -bS R1.sam | samtools sort - R1_sorted
> samtools index R1_sorted.bam 
> 
> now I want to extract all the reads that map on chr1:x-y position, 
> chr2:x'-y',chr1:x''-y'' ete etc.
> i have total 8000 coordinates through out genome. I want to extract all the 
> reads that mapped at all the 8000 coordinates.
> letter find out same for the R2_sorted.bam.
> in next step I have to find out how many reads are common (in terms of 
> similar ids with indication of r1 and R2 reads) between two different 
> coordinates.
> 
> thank you four your kind help
> 
> -- 
> ------------------------------------------------------------------------------------------------------
> Raghvendra Singh
>   Center of Bioinformatics
>   Nehru Science Center.
>   IIDS.
>   University of Allahabad.
>   +91-9559019566
> ------------------------------------------------------------------------------
> Time is money. Stop wasting it! Get your web API in 5 minutes.
> www.restlet.com/download
> http://p.sf.net/sfu/restlet_______________________________________________
> Samtools-help mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/samtools-help


------------------------------------------------------------------------------
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
_______________________________________________
Samtools-help mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/samtools-help

Reply via email to