How To Rearrange Paired End Bam File?
2
0
Entering edit mode
11.6 years ago

Hello all,

I have a paired end bam file and I want to use bedtools for them. After merging, the paired end read alignments are not lying next to each other. It is making problems in the bedtools process. Is there any tool available to rearrange the paired end read alignments in bam file?

Thanks, Deeps

paired-end bedtools • 8.1k views
ADD COMMENT
1
Entering edit mode
11.6 years ago
matted 7.8k

Assuming read pairs have the same name, you can sort the BAM by read name with samtools:

samtools sort -n in.bam -o > out.bam
ADD COMMENT
1
Entering edit mode
11.6 years ago

If you are using Picard , you can sort by queryname.

Copy and pasting from Picard's manual:

SortSam

USAGE: SortSam [options]

Documentation: http://picard.sourceforge.net/command-line-overview.shtml#SortSam

Sorts the input SAM or BAM.

Input and output formats are determined by file extension.

Option Description

INPUT=File The BAM or SAM file to sort. Required.

OUTPUT=File The sorted BAM or SAM output file. Required.

SORT_ORDER=SortOrder Sort order of output file Required. Possible values: {unsorted, queryname, coordinate}

ADD COMMENT

Login before adding your answer.

Traffic: 1979 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6