daler/gffutils — pull request #22 by yarden (2013-05-27 16:05:19+00:00)
Title: `rmdups` feature for gffutils-cli

Feature to remove duplicates from GFF/GTF files in `gffutils-cli`. Very helpful for me at least. Typical use case:

```
# A redundant gff file (containing duplicates)
$ cat newtest.gff
chr1	A3SS	mRNA	2492152	2492932	.	-	.	ID=chr1:2491992:2492152:-@chr1:2493253|2493253:2492932:-.A;Parent=chr1:2491992:2492152:-@chr1:2493253|2493253:2492932:-
chr1	A3SS	exon	2491992	2492152	.	-	.	ID=chr1:2491992:2492152:-@chr1:2493253|2493253:2492932:-.A.up;Parent=chr1:2491992:2492152:-@chr1:2493253|2493253:2492932:-.A
chr1	A3SS	exon	2492932	2493253	.	-	.	ID=chr1:2491992:2492152:-@chr1:2493253|2493253:2492932:-.A.coreAndExt;Parent=chr1:2491992:2492152:-@chr1:2493253|2493253:2492932:-.A
chr1	A3SS	mRNA	2492152	2492932	.	-	.	ID=chr1:2491992:2492152:-@chr1:2493253|2493253:2492932:-.A;Parent=chr1:2491992:2492152:-@chr1:2493253|2493253:2492932:-
chr1	A3SS	exon	2491992	2492152	.	-	.	ID=chr1:2491992:2492152:-@chr1:2493253|2493253:2492932:-.A.up;Parent=chr1:2491992:2492152:-@chr1:2493253|2493253:2492932:-.A
chr1	A3SS	exon	2492932	2493253	.	-	.	ID=chr1:2491992:2492152:-@chr1:2493253|2493253:2492932:-.A.coreAndExt;Parent=chr1:2491992:2492152:-@chr1:2493253|2493253:2492932:-.A
```

With `rmdups`:

```
$ gffutils-cli rmdups newtest.gff
#GFF3 file (created by gffutils (v0.8) on 2013-05-27 11:56:48)
chr1	A3SS	mRNA	2492152	2492932	.	-	.	ID=chr1:2491992:2492152:-@chr1:2493253|2493253:2492932:-.A;Parent=chr1:2491992:2492152:-@chr1:2493253|2493253:2492932:-
chr1	A3SS	exon	2491992	2492152	.	-	.	ID=chr1:2491992:2492152:-@chr1:2493253|2493253:2492932:-.A.up;Parent=chr1:2491992:2492152:-@chr1:2493253|2493253:2492932:-.A
chr1	A3SS	exon	2492932	2493253	.	-	.	ID=chr1:2491992:2492152:-@chr1:2493253|2493253:2492932:-.A.coreAndExt;Parent=chr1:2491992:2492152:-@chr1:2493253|2493253:2492932:-.A
```

As usual, by default it writes to `stdout` but if passed the `--in-place` optional argument it will overwrite the input file with a non-redundant version of itself.

When more merge strategies become available, it might be worth renaming this argument to something like `merge` and not just `rmdups`.