def mirmapredict(seq_mirna, seq_target): seq_target_1 = "".join(map(lambda x: RULE2[x], seq_target.upper())) mim = mirmap.mm(seq_target_1, seq_mirna) mim.find_potential_targets_with_seed(allowed_lengths=[6, 7], allowed_gu_wobbles={ 6: 0, 7: 0 }, allowed_mismatches={ 6: 0, 7: 0 }, take_best=True) if len(mim.end_sites) != 0: mim.eval_tgs_au(with_correction=False) mim.eval_tgs_pairing3p(with_correction=False) mim.eval_tgs_position(with_correction=False) mim.eval_tgs_score(with_correction=False) #mim.eval_score() mim.libs = mirmap.library_link.LibraryLink( '/home/f*x/tools/miRmap-1.1/libs/lib-archlinux-x86_64') mim.exe_path = '/home/f*x/tools/miRmap-1.1/libs/exe-archlinux-x86_64' mim.dg_duplex mim.dg_open mim.dg_binding mim.prob_exact mim.eval_score outPut(mim.report())
def main (): global options, args # ****************************** main body ********************************* print 'Script for testing the miRmap library' # Open files target = open(options.target, 'r') mirna = open(options.mirna, 'r') # Show and save files contents: print 'Target file:' seq_target = target.read() print seq_target print 'miRNA sequence:' seq_mirna = mirna.read() print seq_mirna # Perform different actions: mim = mirmap.mm(seq_target, seq_mirna) mim.find_potential_targets_with_seed(allowed_lengths=[6,7], allowed_gu_wobbles={6:0,7:0}, allowed_mismatches={6:0,7:0}, take_best=True) print 'mim.end_sites: {}' . format(mim.end_sites) # Coordinate(s) (3' end) of the target site on the target sequence mim.eval_tgs_au(with_correction=False) # TargetScan features manually evaluated with mim.eval_tgs_pairing3p(with_correction=False) # a non-default parameter. mim.eval_tgs_position(with_correction=False) print 'mim.prob_binomial: {}' . format(mim.prob_binomial) # mim's attribute: the feature is automatically computed print 'mim.report: {}' . format(mim.report())
def predict_on_mim(args): mirna, transcript = args mimset = mirmap.mm(transcript[1], mirna[1]) if shared.libs: mimset.libs = shared.libs if shared.exe_path: mimset.exe_path = shared.exe_path mimset.find_potential_targets_with_seed() if len(mimset.end_sites) > 0: shared.logger.debug('Evaluating mirna:%s transcript:%s'%(mirna[0], transcript[0])) # De novo features mimset.eval_tgs_au() mimset.eval_tgs_position() mimset.eval_tgs_pairing3p() mimset.eval_tgs_score() mimset.eval_dg_duplex() mimset.eval_dg_open() mimset.eval_dg_total() mimset.eval_prob_exact() mimset.eval_prob_binomial() # Rest of the features mimset.cons_blss = [0.] * len(mimset.end_sites) mimset.selec_phylops = [1.] * len(mimset.end_sites) if hasattr(shared, 'aln_path'): aln_fname = os.path.join(shared.aln_path, '%s.fa'%(transcript[0])) if os.path.exists(aln_fname): if shared.mod_path: mod_fname = os.path.join(shared.mod_path, '%s.mod'%(transcript[0])) if os.path.exists(mod_fname): with open(mod_fname) as modf: mod = modf.read() start = mod.find('TREE: ') + 6 end = mod.find(';', start) + 1 tree = mod[start:end] mimset.eval_cons_bls(aln_fname=aln_fname, tree=tree, fitting_tree=False) mimset.eval_selec_phylop(aln_fname=aln_fname, mod_fname=mod_fname) else: mimset.eval_cons_bls(aln_fname=aln_fname, tree='species.tree', fitting_tree=True) mimset.eval_selec_phylop(aln_fname=aln_fname, mod_fname=mod_fname) mimset.eval_score() if shared.combine: return mirna[0], transcript[0], mimset.end_sites, mimset.seed_lengths, mimset.nb_mismatches_except_gu_wobbles, mimset.nb_gu_wobbles, mimset.tgs_au, mimset.tgs_position, mimset.tgs_pairing3p, mimset.tgs_score, mimset.dg_duplex, mimset.dg_binding, mimset.dg_duplex_seed, mimset.dg_binding_seed, mimset.dg_open, mimset.dg_total, mimset.prob_exact, mimset.prob_binomial, mimset.cons_bls, mimset.selec_phylop, mimset.score else: return mirna[0], transcript[0], mimset.end_sites, mimset.seed_lengths, mimset.nb_mismatches_except_gu_wobbles, mimset.nb_gu_wobbles, mimset.tgs_aus, mimset.tgs_positions, mimset.tgs_pairing3ps, mimset.tgs_scores, mimset.dg_duplexs, mimset.dg_bindings, mimset.dg_duplex_seeds, mimset.dg_binding_seeds, mimset.dg_opens, mimset.dg_totals, mimset.prob_exacts, mimset.prob_binomials, mimset.cons_blss, mimset.selec_phylops, mimset.scores
def main(): global options, args # ****************************** main body ********************************* print 'Script for testing the miRmap library' # Open files target = open(options.target, 'r') mirna = open(options.mirna, 'r') # Show and save files contents: print 'Target file:' seq_target = target.read() print seq_target print 'miRNA sequence:' seq_mirna = mirna.read() print seq_mirna # Perform different actions: mim = mirmap.mm(seq_target, seq_mirna) mim.find_potential_targets_with_seed(allowed_lengths=[6, 7], allowed_gu_wobbles={ 6: 0, 7: 0 }, allowed_mismatches={ 6: 0, 7: 0 }, take_best=True) print 'mim.end_sites: {}'.format( mim.end_sites ) # Coordinate(s) (3' end) of the target site on the target sequence mim.eval_tgs_au( with_correction=False) # TargetScan features manually evaluated with mim.eval_tgs_pairing3p(with_correction=False) # a non-default parameter. mim.eval_tgs_position(with_correction=False) print 'mim.prob_binomial: {}'.format( mim.prob_binomial ) # mim's attribute: the feature is automatically computed print 'mim.report: {}'.format(mim.report())