How to sort chromosome name in bed file
1
0
Entering edit mode
8.4 years ago
raya.girish ▴ 40

Hello Friends!

I have one stupid question. I have a bed file

chr1 955541 955763 AGRN.chr1.955552.955753
chr1 957569 957852 AGRN.chr1.957580.95784

in my bed file my chromosome name are not sorted I want output in

chr1 chr2 ..... chr22 chrX chrY chrM

Can anyone help me out

Thanks!

bed • 3.9k views
ADD COMMENT
1
Entering edit mode

use the sortBed

ADD REPLY
0
Entering edit mode

can you tell me how should i sort using sortbed i mean commands

ADD REPLY
0
Entering edit mode

i used bedtool/sort -chrThenSizeA -i my.bed > new.bed

it not working

ADD REPLY
0
Entering edit mode

Please see the answer below and provide feedback.

If an answer was helpful, you should upvote it; if the answer resolved your question, you should mark it as accepted. Upvote|Bookmark|Accept

ADD REPLY
3
Entering edit mode
8.4 years ago
Prasad ★ 1.6k
sortBed -i inputfile >outfile

By default it sorts by chromosome and then by start position in ascending order. It has many other options, kindly go through the manual

ADD COMMENT
1
Entering edit mode

@Prasad - It would be better if you change it answer from comment and format the code, so that OP can accept the answer and the question will not remain as unanswered, and also helpful for future googlers.

ADD REPLY
2
Entering edit mode

@Venu - Sure i will keep that in mind. @genomax - thanks for the format

ADD REPLY

Login before adding your answer.

Traffic: 2796 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