def test_look_for_factor_pair(): print 'test_look_for_factor_pair' all_pairs = biopsy.load( 'c:/data/remos/0/0.top_pairs', display = 'pairs log odds' ) sascha_factors = [ "T00140", # c-Myc human, H**o sapiens "T00163", # CREB human, H**o sapiens "T00368", # HNF-1alpha-A human, H**o sapiens "T00594", # RelA-p65 human, H**o sapiens "T00671", # p53 human, H**o sapiens "T00759", # Sp1 human, H**o sapiens "T00781", # TAF(II)250 human, H**o sapiens "T03286", # HNF-6alpha human, H**o sapiens "T03828", # HNF-4alpha human, H**o sapiens ] sascha_pssms = set() for factor in sascha_factors: pssms_for_factor = biopsy.get_pssms_for_factor( factor ) print 'Pssms for %s: %s' % ( factor, " ".join( pssms_for_factor ) ) for pssm in pssms_for_factor: sascha_pssms.add( pssm ) look_for_factor_pair( 'sascha', all_pairs, sascha_pssms, sascha_pssms )
def test_pair_go_analysis(): import rpy rpy.r.library("Category") rpy.r.library("biomaRt") rpy.r.source('../../R/go_categorise.R') remome_threshold = 100 analysis_file = 'c:/data/remos/%d/%d.analysis' \ % ( remome_threshold, remome_threshold ) pairs_file = 'C:/Data/ReMos/%d/%d.top_pairs' \ % ( remome_threshold, remome_threshold ) gene_universe_file = 'c:/Data/remos/%d/%d.uniq_genes' \ % ( remome_threshold, remome_threshold ) gene_universe = rpy.r.read_table( gene_universe_file )["V1"] analysis = biopsy.Analysis.deserialise( analysis_file ) pairs = biopsy.load( pairs_file, display = 'pairs' ) biopsy.print_pairs_go_analysis( pairs[:150], gene_universe, analysis ) print 'done'
def test_saschas_pairs(): pair_dists = biopsy.load( 'saschas.pairs' ) for p, d in pair_dists.iteritems(): if ( p[0] == 'M01019' and p[1] == 'M01043' ) \ or ( p[1] == 'M01019' and p[0] == 'M01043' ): print p print d
def pair_log_odds_histogram(): pairs = biopsy.load( 'c:/data/remos/100/100.pairs_lor', display = 'pairs log odds' ) import pylab, math pylab.hist( [ p.log_odds_ratio for p in pairs ], 100 ) pylab.show()
def test_get_pairs_for_pssm(): pssm = 'M00736' pairs = biopsy.load( 'c:/data/remos/100/100.top_pairs', display = 'pairs log odds' ) pssm_pairs = biopsy.get_pairs_for_pssm( pairs, pssm ) print 'Got %d pairs for %s from total of %d' % \ ( len(pssm_pairs), pssm, len(pairs) ) for p in pssm_pairs[:20]: print p.binder_pair, p.log_odds_ratio biopsy.write_pair_separation_histograms( pssm_pairs[:20], pssm )
def test_research_pair(): import biopsy.r_go, rpy pair = ('M00293', 'R04602', False, True) remome_threshold = 100 analysis_file = 'c:/data/remos/%d/%d.analysis' % ( remome_threshold, remome_threshold ) pairs_file = 'C:/Data/ReMos/%d/%d.top_pairs' % ( remome_threshold, remome_threshold ) gene_universe_file = 'c:/Data/remos/%d/%d.uniq_genes' % ( remome_threshold, remome_threshold ) gene_universe = rpy.r.read_table( gene_universe_file )["V1"] analysis = biopsy.Analysis.deserialise( analysis_file ) pairs = biopsy.load( pairs_file, display = 'pairs' ) mart = biopsy.r_go.get_mart( "mmusculus_gene_ensembl" ) categs = biopsy.r_go.categorise_genes( mart, gene_universe ) biopsy.research_pair( analysis, mart, categs, pair )