0

In python when you use the bedtools sorting function, chromosomes are sorted lexicographically, so chr12 will come before chr9.
There are some ways to solve it when you are using bash such as - k1,1 - k2,2n which many sites described but none of them works in python syntax.
my code is as following:

import pybedtools as bt
sites = bt.BedTool(input.bed).sort().merge(d=-1, c=5, o='sum').saveas('output.bed')
Gsk
  • 2,929
  • 5
  • 22
  • 29
Shrm
  • 426
  • 4
  • 8
  • As this site does not allow, these tags bedtools or pybedtools removed when I post it. – Shrm Apr 12 '19 at 09:25
  • Hi, and welcome to StackOverflow. If you're able to add a [mcve], you're more likely to get the help you need! – Gsk Apr 12 '19 at 09:30

0 Answers0