1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/0e2eb8ea274a/ changeset: 0e2eb8ea274a user: jgoecks date: 2012-10-30 20:15:11 summary: Data providers: (a) add option to report interchromosomal interactions and (b) pass kwargs to get_iterator method for filtering purposes. affected #: 2 files diff -r c0d8a9c916a50ef3f1fd7d67e987eba8f94e02a8 -r 0e2eb8ea274a1fedc2620f02adb6bbda81979f53 lib/galaxy/visualization/data_providers/genome.py --- a/lib/galaxy/visualization/data_providers/genome.py +++ b/lib/galaxy/visualization/data_providers/genome.py @@ -150,7 +150,7 @@ """ raise Exception( "Unimplemented Function" ) - def get_iterator( self, chrom, start, end ): + def get_iterator( self, chrom, start, end, **kwargs ): """ Returns an iterator that provides data in the region chrom:start-end """ @@ -172,7 +172,7 @@ dataset_type, data """ start, end = int( low ), int( high ) - iterator = self.get_iterator( chrom, start, end ) + iterator = self.get_iterator( chrom, start, end, **kwargs ) return self.process_data( iterator, start_val, max_vals, **kwargs ) def get_genome_data( self, chroms_info, **kwargs ): @@ -338,7 +338,7 @@ col_name_data_attr_mapping = { 4 : { 'index': 4 , 'name' : 'Score' } } - def get_iterator( self, chrom, start, end ): + def get_iterator( self, chrom, start, end, **kwargs ): start, end = int(start), int(end) if end >= (2<<29): end = (2<<29 - 1) # Tabix-enforced maximum @@ -387,7 +387,7 @@ Payload format: [ uid (offset), start, end, name, strand, thick_start, thick_end, blocks ] """ - def get_iterator( self, chrom, start, end ): + def get_iterator( self, chrom, start, end, **kwargs ): raise Exception( "Unimplemented Function" ) def process_data( self, iterator, start_val=0, max_vals=None, **kwargs ): @@ -467,7 +467,7 @@ dataset_type = 'interval_index' - def get_iterator( self, chrom, start, end ): + def get_iterator( self, chrom, start, end, **kwargs ): raise Exception( "Unimplemented Method" ) def process_data( self, iterator, start_val=0, max_vals=None, **kwargs ): @@ -562,7 +562,7 @@ for large datasets. """ - def get_iterator( self, chrom=None, start=None, end=None ): + def get_iterator( self, chrom=None, start=None, end=None, **kwargs ): # Read first line in order to match chrom naming format. line = source.readline() dataset_chrom = line.split()[0] @@ -706,7 +706,7 @@ for large datasets. """ - def get_iterator( self, chrom, start, end ): + def get_iterator( self, chrom, start, end, **kwargs ): # Read first line in order to match chrom naming format. line = source.readline() dataset_chrom = line.split()[0] @@ -864,7 +864,7 @@ new_bamfile.close() bamfile.close() - def get_iterator( self, chrom, start, end ): + def get_iterator( self, chrom, start, end, **kwargs ): """ Returns an iterator that provides data in the region chrom:start-end """ @@ -1174,7 +1174,7 @@ out.close() - def get_iterator( self, chrom, start, end ): + def get_iterator( self, chrom, start, end, **kwargs ): """ Returns an array with values: (a) source file and (b) an iterator that provides data in the region chrom:start-end @@ -1233,7 +1233,7 @@ dataset_type = 'interval_index' - def get_iterator( self, chrom, start, end ): + def get_iterator( self, chrom, start, end, **kwargs ): """ Returns an iterator that provides data in the region chrom:start-end as well as a file offset. @@ -1341,7 +1341,7 @@ Payload format: [ uid (offset), start, end, name, strand, thick_start, thick_end, blocks ] """ - def get_iterator( self, chrom, start, end ): + def get_iterator( self, chrom, start, end, **kwargs ): raise "Unimplemented Method" def process_data( self, iterator, start_val=0, max_vals=None, **kwargs ): @@ -1487,7 +1487,7 @@ return 100000; class ChromatinInteractionsTabixDataProvider( TabixDataProvider, ChromatinInteractionsDataProvider ): - def get_iterator( self, chrom, start=0, end=sys.maxint ): + def get_iterator( self, chrom, start=0, end=sys.maxint, interchromosomal=False, **kwargs ): """ """ # Modify start as needed to get earlier interactions with start region. @@ -1501,9 +1501,12 @@ c = feature[3] s2 = int( feature[4] ) e2 = int( feature[5] ) - #if ( s1 <= filter_end and e1 >= filter_start ) and ( s2 <= filter_end and e2 >= filter_start ) and ( max( s1, s2 ) - min( e1, e2 ) <= span * 2 ): + # Check for intrachromosal interactions. if ( ( s1 + s2 ) / 2 <= end ) and ( ( e1 + e2 ) / 2 >= start ) and ( c == chrom ): yield line + # Check for interchromosal interactions. + if interchromosomal and c != chrom: + yield line return filter( TabixDataProvider.get_iterator( self, chrom, filter_start, end ) ) # diff -r c0d8a9c916a50ef3f1fd7d67e987eba8f94e02a8 -r 0e2eb8ea274a1fedc2620f02adb6bbda81979f53 lib/galaxy/web/base/controller.py --- a/lib/galaxy/web/base/controller.py +++ b/lib/galaxy/web/base/controller.py @@ -630,8 +630,10 @@ data_provider = trans.app.data_provider_registry.get_data_provider( trans, original_dataset=dataset, source=source ) - # HACK: pass in additional params, which are only used for summary tree data, not BBI data. - rval = data_provider.get_genome_data( chroms_info, level=4, detail_cutoff=0, draw_cutoff=0 ) + # HACK: pass in additional params which are used for only some types of data providers; + # level, cutoffs used for summary tree, and interchromosomal used for chromatin interactions. + rval = data_provider.get_genome_data( chroms_info, level=4, detail_cutoff=0, draw_cutoff=0, + interchromosomal=True ) return rval 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.