Mercurial > repos > devteam > count_gff_features
comparison count_gff_features.py @ 1:188392a0d0a8 draft default tip
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/count_gff_features commit d242cab2b4e86bc8a16eeaee7e5dc0264e617170
author | devteam |
---|---|
date | Tue, 06 Jun 2017 18:37:53 -0400 |
parents | fabda887a71f |
children |
comparison
equal
deleted
inserted
replaced
0:fabda887a71f | 1:188392a0d0a8 |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # This tool takes a gff file as input and counts the number of features in it. | 2 # This tool takes a gff file as input and counts the number of features in it. |
3 | 3 |
4 import sys, fileinput | 4 from __future__ import print_function |
5 from galaxy import eggs | 5 |
6 import fileinput | |
7 import sys | |
8 | |
9 from bx.intervals.io import GenomicInterval | |
6 from galaxy.datatypes.util.gff_util import GFFReaderWrapper | 10 from galaxy.datatypes.util.gff_util import GFFReaderWrapper |
7 from bx.intervals.io import GenomicInterval | |
8 | 11 |
9 # Get args. | 12 # Get args. |
10 input_file = sys.argv[1:] | 13 input_file = sys.argv[1:] |
11 | 14 |
12 # Count features. | 15 # Count features. |
13 count = 0 | 16 count = 0 |
14 for feature in GFFReaderWrapper( fileinput.FileInput( input_file ), fix_strand=True ): | 17 for feature in GFFReaderWrapper( fileinput.FileInput( input_file ), fix_strand=True ): |
15 if isinstance( feature, GenomicInterval ): | 18 if isinstance( feature, GenomicInterval ): |
16 count += 1 | 19 count += 1 |
17 | 20 |
18 print count | 21 print(count) |