1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/6a03e7197bdc/ changeset: 6a03e7197bdc user: jgoecks date: 2013-01-30 18:22:59 summary: Collect and output comments when reading unordered GTF. Handle comments when converting from GTF to FLI. affected #: 2 files
diff -r f787a69139a284fe6c8fcaa52e506a6fa952c330 -r 6a03e7197bdc83512444d66bfd793e0c91596217 lib/galaxy/datatypes/converters/interval_to_fli.py --- a/lib/galaxy/datatypes/converters/interval_to_fli.py +++ b/lib/galaxy/datatypes/converters/interval_to_fli.py @@ -16,6 +16,8 @@
import sys, optparse from galaxy import eggs +import pkg_resources; pkg_resources.require( "bx-python" ) +from bx.tabular.io import Comment from galaxy.datatypes.util.gff_util import GFFReaderWrapper, read_unordered_gtf, convert_gff_coords_to_bed
def main(): @@ -38,6 +40,9 @@ in_reader = read_unordered_gtf( open( in_fname, 'r' ) )
for feature in in_reader: + if isinstance( feature, Comment ): + continue + for name in feature.attributes: val = feature.attributes[ name ] try:
diff -r f787a69139a284fe6c8fcaa52e506a6fa952c330 -r 6a03e7197bdc83512444d66bfd793e0c91596217 lib/galaxy/datatypes/util/gff_util.py --- a/lib/galaxy/datatypes/util/gff_util.py +++ b/lib/galaxy/datatypes/util/gff_util.py @@ -384,9 +384,14 @@ key_fn = lambda fields: fields[0] + '_' + get_transcript_id( fields )
- # Aggregate intervals by transcript_id. + # Aggregate intervals by transcript_id and collect comments. feature_intervals = odict() + comments = [] for count, line in enumerate( iterator ): + if line.startswith( '#' ): + comments.append( Comment( line ) ) + continue + line_key = key_fn( line.split('\t') ) if line_key in feature_intervals: feature = feature_intervals[ line_key ] @@ -413,7 +418,13 @@ for features in chroms_features_sorted: features.sort( lambda a,b: cmp( a.start, b.start ) )
- # Yield. + # Yield comments first, then features. + # FIXME: comments can appear anywhere in file, not just the beginning. + # Ideally, then comments would be associated with features and output + # just before feature/line. + for comment in comments: + yield comment + for chrom_features in chroms_features_sorted: for feature in chrom_features: yield feature
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
galaxy-commits@lists.galaxyproject.org