def action(args): controls, sample_groups = get_input(args.infile, split_description=args.split_desc) qadata = qa_from_csv(qafile) matrix = read_matrix(matrix_file) style = "screen" if args.outfile == sys.stdout else "file" outfile = get_outfile(args, label="qa", ext="csv") if args.calculate_ion_ratios: qadata = add_ion_ratios(qadata, controls) # if a single compound is specified, define lambda cond to use as # a filter if args.compound_id: cond = lambda c: c["COMPOUND_id"] == args.compound_id else: cond = lambda c: True # controls compounds = [Compound(c, matrix, **qadata[c["COMPOUND_id"]]) for c in flatten(controls.values()) if cond(c)] display_controls(compounds, outfile=outfile, show_all=args.show_all, message=not args.outcomes_only, style=style) compounds = [Compound(c, matrix, **qadata[c["COMPOUND_id"]]) for c in flatten(sample_groups.values()) if cond(c)] display_specimens(compounds, outfile=outfile, show_all=args.show_all, message=not args.outcomes_only, style=style) if args.outfile is None: outfile.close()
def action(args): controls, sample_groups = get_input(args.infile, split_description=args.split_desc) qadata = qa_from_csv(qafile) matrix = read_matrix(matrix_file) style = 'screen' if args.outfile == sys.stdout else 'file' outfile = get_outfile(args, label='qa', ext='csv') if args.calculate_ion_ratios: qadata = add_ion_ratios(qadata, controls) # if a single compound is specified, define lambda cond to use as # a filter if args.compound_id: cond = lambda c: c['COMPOUND_id'] == args.compound_id else: cond = lambda c: True # controls compounds = [ Compound(c, matrix, **qadata[c['COMPOUND_id']]) for c in flatten(controls.values()) if cond(c) ] display_controls(compounds, outfile=outfile, show_all=args.show_all, message=not args.outcomes_only, style=style) compounds = [ Compound(c, matrix, **qadata[c['COMPOUND_id']]) for c in flatten(sample_groups.values()) if cond(c) ] display_specimens(compounds, outfile=outfile, show_all=args.show_all, message=not args.outcomes_only, style=style) if args.outfile is None: outfile.close()
def test02(self): compounds = [Compound(c, matrix, **qadata[c['COMPOUND_id']]) for c in flatten(sample_groups.values())] display_specimens(compounds, sys.stdout, message = False)
def test02(self): compounds = [ Compound(c, matrix, **qadata[c['COMPOUND_id']]) for c in flatten(sample_groups.values()) ] display_specimens(compounds, sys.stdout, message=False)