def main(): r""" Runs trcls. """ parser = cli.get_parser() args = parser.parse_args() logger = setup_logging(args) if args.version: print('trcls {}'.format(VERSION)) exit(0) if args.alignment == None or args.features == None: logger.error( 'Both SAM alignment and GTF annotation files must be provided') parser.print_help() exit(1) with open(args.features) as features_file: annotations = Annotations(features_file) with open(args.alignment) as alignment_file: alignments = alignment_file.readlines() headers = filter(lambda l: l.startswith('@'), alignments) headers = map(str.strip, headers) alignments = filter(lambda l: not l.startswith('@'), alignments) transcripts = get_transcripts(alignments, args.skip_tolerance, args.map_tolerance) print('\n'.join(headers)) for transcript in transcripts: transcript.annotate(annotations, args.junction_tolerance) print(transcript)
def test_singularity_rootfs(self): '''test_singularity_rootfs ensures that --rootfs is required ''' print("Testing --rootfs command...") parser = get_parser() (args, options) = parser.parse_args([]) with self.assertRaises(SystemExit) as cm: run(args) self.assertEqual(cm.exception.code, 1)
def main(): with App() as app: parser = get_parser(app) args = parser.parse_args() app.config(args.config_path) if 'func' in args: args.func(args) else: parser.print_help()
def test_singularity_rootfs(self): '''test_singularity_rootfs ensures that --rootfs is required ''' print("Testing --rootfs command...") parser = get_parser() (args,options) = parser.parse_args([]) with self.assertRaises(SystemExit) as cm: run(args) self.assertEqual(cm.exception.code, 1)
def main(): parser = cli.get_parser() args = parser.parse_args() print(f">>> args: {args}") console = logging.StreamHandler(sys.stdout) if args.v == 4: console.setLevel(logging.TRACE) fmt = ColorFormatter( '[%(levelname)s]: %(message)s (%(filename)s:%(lineno)s)') elif args.v == 3: console.setLevel(logging.DEBUG) fmt = ColorFormatter( '[%(levelname)s]: %(message)s (%(filename)s:%(lineno)s)') elif args.v == 2: console.setLevel(logging.INFO) fmt = ColorFormatter('[%(levelname)s]: %(message)s') elif args.v == 1: console.setLevel(logging.WARNING) fmt = ColorFormatter('[%(levelname)s]: %(message)s') else: console.setLevel(logging.ERROR) fmt = ColorFormatter('[%(levelname)s]: %(message)s') console.setFormatter(fmt) logging.getLogger().addHandler(console) # add to root logger # # Create STREAM HANDLER # console = logging.StreamHandler(sys.stdout) # console.setFormatter(fmt) # logging.getLogger().addHandler(console) # add to root logger # log.trace(f"T MAIN Totally detailed message") log.info(f"E MAIN Log level: {logging.root.level}") add_result = add(2, 3) log.debug(f"D MAIN add_result: {add_result}") multiply_result = multiply(2, 3) log.info(f"I MAIN multiply_result: {multiply_result}")
import logging, sys import alias, cli, constants, profile logging.basicConfig(format='[%(asctime)s/%(levelname)s] %(message)s') logger = logging.getLogger('bedshape') logger.setLevel(logging.INFO) if __name__ == '__main__': root_parser, alias_parser, profile_parser = cli.get_parser() args = root_parser.parse_args() if args.which_subcommand == None: root_parser.print_help() elif args.which_subcommand == 'alias': alias_parser.print_help() elif args.which_subcommand == 'list': alias.list() elif args.which_subcommand == 'add': alias.add(args) elif args.which_subcommand == 'rm': alias.rm(args) elif args.which_subcommand == 'profile': profile.validate(args, profile_parser.print_help) profile.run(args) else: raise RuntimeError('Unrecognised subcommand.')
import embed import alignment_task import comparison_plots import metrics import runners import cli importlib.reload(icp) importlib.reload(data) importlib.reload(embed) importlib.reload(alignment_task) importlib.reload(comparison_plots) importlib.reload(runners) importlib.reload(cli) #%% parser = cli.get_parser() # methods = ['None', 'MNN', 'SeuratV3', 'ScAlign', 'ICP', 'ICP2', 'ICP2_xentropy'] #arguments = '--methods SeuratV3 --datasets panc8 --input_space GENE --epochs=5 --no_standardize' arguments = '--methods SeuratV3 --datasets panc8 --input_space GENE --epochs=10 --seurat_env_path C:\\Users\\Amir\\Anaconda3\\envs\\seuratV3' #arguments = '--methods SeuratV3 --datasets panc8-all --input_space GENE --epochs=10 --seurat_env_path C:\\Users\\Amir\\Anaconda3\\envs\\seuratV3' args = parser.parse_args(arguments.split()) #%% datasets = {} alignment_tasks = [] #%% if 'Kowalcyzk' in args.datasets: datasets['Kowalcyzk'] = data.get_data('Kowalcyzk') embed.embed(datasets,
from cli import get_parser from utils import set_logger if __name__ == "__main__": set_logger() parser = get_parser() args = parser.parse_args() try: args.func(args) except AttributeError: parser.print_help()