Mercurial > repos > xuebing > sharplabtool
comparison tools/stats/count_gff_features.py @ 0:9071e359b9a3
Uploaded
author | xuebing |
---|---|
date | Fri, 09 Mar 2012 19:37:19 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:9071e359b9a3 |
---|---|
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 |