ribolands/barmap.py
def main():
    """ BarMap -- cotransriptional folding
      Dependencies: RNAsubopt, barriers, treekin

      TODO: 
        - change occupancy threshold to: Oc = Omin/c
        - reimplement to determine RNAsubopt energy range on the fly.
            The relevant local minima determine the necessary energy range for RNAsubopt.
            If a simulation requires a lager subopt than the previous one, well then recompute.
            Make use of the connect flag, if it is actually helpful.

    """
    parser = argparse.ArgumentParser(
        # formatter_class=argparse.RawTextHelpFormatter,
        formatter_class=argparse.ArgumentDefaultsHelpFormatter,
        # formatter_class=argparse.MetavarTypeHelpFormatter,
        description='echo sequence | %(prog)s [options]')

    add_barmap_args(parser)

    args = parser.parse_args()


    # ~~~~~~~~~~~~~
    # Logging Setup 
    # ~~~~~~~~~~~~~
    logger = logging.getLogger('ribolands')
    logger.setLevel(logging.DEBUG)

    ch = logging.StreamHandler()
    formatter = logging.Formatter('# %(levelname)s - %(message)s')
    ch.setLevel(logging.DEBUG)
    ch.setFormatter(formatter)
    logger.addHandler(ch)

    # Read Input & Update Arguments
    name, seq = ril.parse_vienna_stdin(sys.stdin)

    # One name, just to be clear ...
    (args.name, name) = (args.name, args.name) if args.name else (name, name)

    if args.stop is None:
        args.stop = len(seq)
    else:
        seq = seq[:args.stop]

    print("# Input: {:s} {:s}".format(name, seq))

    if args.s_ener is None:
        args.s_ener, args.s_maxn = ril.sys_subopt_range(seq,
                nos=args.s_maxn, maxe=args.s_maxe)
        print("# Energyrange {:.2f} computes {:d} sequences".format(
            args.s_ener, args.s_maxn))
    elif args.verbose:
        args.s_ener, args.s_maxn = ril.sys_subopt_range(seq,
                                                        nos=0, maxe=args.s_ener)
        print("# Energyrange {:.2f} computes {:d} sequences".format(
            args.s_ener, args.s_maxn))

    if not args.tmpdir:
        args.tmpdir = 'BarMap_' + args.name

    if not os.path.exists(args.tmpdir):
        os.makedirs(args.tmpdir)

    """# Starting with BarMap computations ... """

    while True:
        print("""# writing RNAsubopt files ... """)
        sname = "{}/{}-ener_{:.2f}".format(args.tmpdir, args.name, args.s_ener)
        #if args.circ: myfile += '_circ'
        if args.noLP:
            sname += '_noLP'
        sfiles = barmap_subopts(sname, seq, args)

        print("""# writing barriers files ... """)
        bname = "{}-minh_{}-maxn_{}-k0_{}".format(sname,
                                                  args.b_minh, args.b_maxn, args.k0)
        bfiles = barmap_barriers(bname, seq, sfiles, args)

        print("""# writing/parsing mapping information ... """)
        plist = barmap_mapping(bname, seq, args)

        print("""# simulations using treekin ... """)
        try:
            tfiles = barmap_treekin(bname, seq, bfiles, plist, args)
            break
        except LostPopulationError as e:
            if args.adaptive:
                args.s_ener += 2
                print('repeating caluclations with higher energy:', args.s_ener)
            else:
                print('caluclations failed with current suboptimal energy range:', args.s_ener)
                break
        except SubprocessError as e:
            if args.adaptive:
                args.s_ener += 2
                print('repeating caluclations with higher energy:', args.s_ener)
            else:
                print('caluclations failed with current suboptimal energy range:', args.s_ener)
                break

    if args.xmgrace or args.pyplot:
        print("""# Processing treekin results for plotting ... """)
        courses = get_plot_data(tfiles, plist, args)

        if args.xmgrace:
            grfile = plot_xmgrace(courses, plist, args)
            print("# Your results have been plotted in the file: {}".format(grfile))

        if args.pyplot:
            plotfile = plot_matplotlib(name, seq, courses, plist, args)
            print("# Your results have been plotted in the file: {}".format(plotfile))

    print("# Thank you for using BarMap b(^.^)d")
 BarMap -- cotransriptional folding
      Dependencies: RNAsubopt, barriers, treekin

      TODO: 
        - change occupancy threshold to: Oc = Omin/c
        - reimplement to determine RNAsubopt energy range on the fly.
            The relevant local minima determine the necessary energy range for RNAsubopt.
            If a simulation requires a lager subopt than the previous one, well then recompute.
            Make use of the connect flag, if it is actually helpful.

    
- cotransriptional folding
Dependencies: RNAsubopt, barriers, treekin

change occupancy threshold to: Oc = Omin/c
reimplement to determine RNAsubopt energy range on the fly.
The relevant local minima determine the necessary energy range for RNAsubopt.
If a simulation requires a lager subopt than the previous one, well then recompute.
Make use of the connect flag, if it is actually helpful.
- cotransriptional folding Dependencies : RNAsubopt barriers treekin change occupancy threshold to : Oc = Omin / c reimplement to determine RNAsubopt energy range on the fly . The relevant local minima determine the necessary energy range for RNAsubopt . If a simulation requires a lager subopt than the previous one well then recompute . Make use of the connect flag if it is actually helpful .
def main():
    parser = argparse.ArgumentParser(
        formatter_class=argparse.ArgumentDefaultsHelpFormatter,
        description='echo sequence | %(prog)s [options]')
    add_barmap_args(parser)
    args = parser.parse_args()
    logger = logging.getLogger('ribolands')
    logger.setLevel(logging.DEBUG)
    ch = logging.StreamHandler()
    formatter = logging.Formatter('# %(levelname)s - %(message)s')
    ch.setLevel(logging.DEBUG)
    ch.setFormatter(formatter)
    logger.addHandler(ch)
    name, seq = ril.parse_vienna_stdin(sys.stdin)
    (args.name, name) = (args.name, args.name) if args.name else (name, name)
    if args.stop is None:
        args.stop = len(seq)
    else:
        seq = seq[:args.stop]
    print("# Input: {:s} {:s}".format(name, seq))
    if args.s_ener is None:
        args.s_ener, args.s_maxn = ril.sys_subopt_range(seq,
                nos=args.s_maxn, maxe=args.s_maxe)
        print("# Energyrange {:.2f} computes {:d} sequences".format(
            args.s_ener, args.s_maxn))
    elif args.verbose:
        args.s_ener, args.s_maxn = ril.sys_subopt_range(seq,
                                                        nos=0, maxe=args.s_ener)
        print("# Energyrange {:.2f} computes {:d} sequences".format(
            args.s_ener, args.s_maxn))
    if not args.tmpdir:
        args.tmpdir = 'BarMap_' + args.name
    if not os.path.exists(args.tmpdir):
        os.makedirs(args.tmpdir)
    while True:
        print("""# writing RNAsubopt files ... """)
        sname = "{}/{}-ener_{:.2f}".format(args.tmpdir, args.name, args.s_ener)
        if args.noLP:
            sname += '_noLP'
        sfiles = barmap_subopts(sname, seq, args)
        print("""# writing barriers files ... """)
        bname = "{}-minh_{}-maxn_{}-k0_{}".format(sname,
                                                  args.b_minh, args.b_maxn, args.k0)
        bfiles = barmap_barriers(bname, seq, sfiles, args)
        print("""# writing/parsing mapping information ... """)
        plist = barmap_mapping(bname, seq, args)
        print("""# simulations using treekin ... """)
        try:
            tfiles = barmap_treekin(bname, seq, bfiles, plist, args)
            break
        except LostPopulationError as e:
            if args.adaptive:
                args.s_ener += 2
                print('repeating caluclations with higher energy:', args.s_ener)
            else:
                print('caluclations failed with current suboptimal energy range:', args.s_ener)
                break
        except SubprocessError as e:
            if args.adaptive:
                args.s_ener += 2
                print('repeating caluclations with higher energy:', args.s_ener)
            else:
                print('caluclations failed with current suboptimal energy range:', args.s_ener)
                break
    if args.xmgrace or args.pyplot:
        print("""# Processing treekin results for plotting ... """)
        courses = get_plot_data(tfiles, plist, args)
        if args.xmgrace:
            grfile = plot_xmgrace(courses, plist, args)
            print("# Your results have been plotted in the file: {}".format(grfile))
        if args.pyplot:
            plotfile = plot_matplotlib(name, seq, courses, plist, args)
            print("# Your results have been plotted in the file: {}".format(plotfile))
    print("# Thank you for using BarMap b(^.^)d")
def main ( ) : parser = argparse . ArgumentParser ( formatter_class = argparse . ArgumentDefaultsHelpFormatter , description = 'echo sequence | %(prog)s [options]' ) add_barmap_args ( parser ) args = parser . parse_args ( ) logger = logging . getLogger ( 'ribolands' ) logger . setLevel ( logging . DEBUG ) ch = logging . StreamHandler ( ) formatter = logging . Formatter ( '# %(levelname)s - %(message)s' ) ch . setLevel ( logging . DEBUG ) ch . setFormatter ( formatter ) logger . addHandler ( ch ) name , seq = ril . parse_vienna_stdin ( sys . stdin ) ( args . name , name ) = ( args . name , args . name ) if args . name else ( name , name ) if args . stop is None : args . stop = len ( seq ) else : seq = seq [ : args . stop ] print ( "# Input: {:s} {:s}" . format ( name , seq ) ) if args . s_ener is None : args . s_ener , args . s_maxn = ril . sys_subopt_range ( seq , nos = args . s_maxn , maxe = args . s_maxe ) print ( "# Energyrange {:.2f} computes {:d} sequences" . format ( args . s_ener , args . s_maxn ) ) elif args . verbose : args . s_ener , args . s_maxn = ril . sys_subopt_range ( seq , nos = 0 , maxe = args . s_ener ) print ( "# Energyrange {:.2f} computes {:d} sequences" . format ( args . s_ener , args . s_maxn ) ) if not args . tmpdir : args . tmpdir = 'BarMap_' + args . name if not os . path . exists ( args . tmpdir ) : os . makedirs ( args . tmpdir ) """# Starting with BarMap computations ... """ while True : print ( """# writing RNAsubopt files ... """ ) sname = "{}/{}-ener_{:.2f}" . format ( args . tmpdir , args . name , args . s_ener ) if args . noLP : sname += '_noLP' sfiles = barmap_subopts ( sname , seq , args ) print ( """# writing barriers files ... """ ) bname = "{}-minh_{}-maxn_{}-k0_{}" . format ( sname , args . b_minh , args . b_maxn , args . k0 ) bfiles = barmap_barriers ( bname , seq , sfiles , args ) print ( """# writing/parsing mapping information ... """ ) plist = barmap_mapping ( bname , seq , args ) print ( """# simulations using treekin ... """ ) try : tfiles = barmap_treekin ( bname , seq , bfiles , plist , args ) break except LostPopulationError as e : if args . adaptive : args . s_ener += 2 print ( 'repeating caluclations with higher energy:' , args . s_ener ) else : print ( 'caluclations failed with current suboptimal energy range:' , args . s_ener ) break except SubprocessError as e : if args . adaptive : args . s_ener += 2 print ( 'repeating caluclations with higher energy:' , args . s_ener ) else : print ( 'caluclations failed with current suboptimal energy range:' , args . s_ener ) break if args . xmgrace or args . pyplot : print ( """# Processing treekin results for plotting ... """ ) courses = get_plot_data ( tfiles , plist , args ) if args . xmgrace : grfile = plot_xmgrace ( courses , plist , args ) print ( "# Your results have been plotted in the file: {}" . format ( grfile ) ) if args . pyplot : plotfile = plot_matplotlib ( name , seq , courses , plist , args ) print ( "# Your results have been plotted in the file: {}" . format ( plotfile ) ) print ( "# Thank you for using BarMap b(^.^)d" )
BarMap -- cotransriptional folding
Dependencies: RNAsubopt, barriers, treekin
BarMap -- cotransriptional folding Dependencies : RNAsubopt barriers treekin
""" BarMap -- cotransriptional folding
      Dependencies: RNAsubopt, barriers, treekin

      TODO: 
        - change occupancy threshold to: Oc = Omin/c
        - reimplement to determine RNAsubopt energy range on the fly.
            The relevant local minima determine the necessary energy range for RNAsubopt.
            If a simulation requires a lager subopt than the previous one, well then recompute.
            Make use of the connect flag, if it is actually helpful.

    """ # formatter_class=argparse.RawTextHelpFormatter, # formatter_class=argparse.MetavarTypeHelpFormatter, # ~~~~~~~~~~~~~ # Logging Setup  # ~~~~~~~~~~~~~ # Read Input & Update Arguments # One name, just to be clear ... """# Starting with BarMap computations ... """ #if args.circ: myfile += '_circ'