0
|
1 #!/usr/bin/env python
|
|
2 # This tool takes a gff file as input and counts the number of features in it.
|
|
3
|
|
4 import sys, fileinput
|
|
5 from galaxy import eggs
|
|
6 from galaxy.datatypes.util.gff_util import GFFReaderWrapper
|
|
7 from bx.intervals.io import GenomicInterval
|
|
8
|
|
9 # Get args.
|
|
10 input_file = sys.argv[1:]
|
|
11
|
|
12 # Count features.
|
|
13 count = 0
|
|
14 for feature in GFFReaderWrapper( fileinput.FileInput( input_file ), fix_strand=True ):
|
|
15 if isinstance( feature, GenomicInterval ):
|
|
16 count += 1
|
|
17
|
|
18 print count |