Mercurial > repos > devteam > count_gff_features
comparison count_gff_features.py @ 0:fabda887a71f draft
Imported from capsule None
author | devteam |
---|---|
date | Mon, 28 Jul 2014 11:56:10 -0400 |
parents | |
children | 188392a0d0a8 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:fabda887a71f |
---|---|
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 |