arq5x / bedtools

A powerful toolset for genome arithmetic.
http://code.google.com/p/bedtools/
GNU General Public License v2.0
140 stars 85 forks source link

Groupby columns specified like cut (but retaining order) #25

Closed brentp closed 12 years ago

brentp commented 12 years ago

Here's an initial go at it. You can specifiy -g 1-3 and -g 3-1, and in the latter case, the columns will be ordered in reverse as requested. Can also mix "," and "-", e.g. 1,2-4,6.

arq5x commented 12 years ago

You can haz the high fives!

brentp commented 12 years ago

:) I just realized it doesn't support open-ended ranges like cut would, e.g. cut -f 2-

arq5x commented 12 years ago

Yeah, but it is a great improvement nonetheless. I have been using groupby for some very wide files recently and this will be a big help. Plus, you typically know how many columns are in a file so it is not too inconvenient to have to write 2-22 versus 2-. Much easier than 2,3,4,5,6,...,22!