commit/galaxy-central: jgoecks: Add support for comment handling to gff_to_interval_index tool.
1 new changeset in galaxy-central: http://bitbucket.org/galaxy/galaxy-central/changeset/d427df9eca38/ changeset: r5542:d427df9eca38 user: jgoecks date: 2011-05-11 21:38:57 summary: Add support for comment handling to gff_to_interval_index tool. affected #: 2 files (138 bytes) --- a/lib/galaxy/datatypes/converters/gff_to_interval_index_converter.py Wed May 11 15:07:24 2011 -0400 +++ b/lib/galaxy/datatypes/converters/gff_to_interval_index_converter.py Wed May 11 15:38:57 2011 -0400 @@ -23,17 +23,16 @@ index = Indexes() offset = 0 reader_wrapper = GFFReaderWrapper( fileinput.FileInput( input_fname ), fix_strand=True ) - for feature in list( reader_wrapper ): - # TODO: need to address comments: - # if comment: - # increment_offset. - + for feature in list( reader_wrapper ): # Add feature; index expects BED coordinates. - convert_gff_coords_to_bed( feature ) - index.add( feature.chrom, feature.start, feature.end, offset ) - + if isinstance( feature, GenomicInterval ): + convert_gff_coords_to_bed( feature ) + index.add( feature.chrom, feature.start, feature.end, offset ) + + # Always increment offset, even if feature is not an interval and hence + # not included in the index. offset += feature.raw_size - + index.write( open(out_fname, "w") ) if __name__ == "__main__": --- a/lib/galaxy/datatypes/util/gff_util.py Wed May 11 15:07:24 2011 -0400 +++ b/lib/galaxy/datatypes/util/gff_util.py Wed May 11 15:38:57 2011 -0400 @@ -165,9 +165,10 @@ #finally: raw_size += len( self.current_line ) - # If header or comment, clear seed interval and return it. + # If header or comment, clear seed interval and return it with its size. if isinstance( self.seed_interval, ( Header, Comment ) ): return_val = self.seed_interval + return_val.raw_size = len( self.current_line ) self.seed_interval = None return return_val @@ -225,7 +226,7 @@ self.end_col, self.strand_col, self.score_col, \ self.default_strand, fix_strand=self.fix_strand, \ intervals=feature_intervals, raw_size=raw_size ) - + # Convert to BED coords? if self.convert_to_bed_coord: convert_gff_coords_to_bed( 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.
participants (1)
-
Bitbucket