示例#1
0
	def test_package_names(self):
		os.chdir(self.tmpdir)
		os.symlink('.', 'bazel-testlogs')

		self.make_result(name='coal/sub_test')
		self.make_result(name='coal/other_test')
		self.make_result(name='some/deep/package/go_test')

		coalesce.main()

		with open('_artifacts/junit_bazel.xml') as f:
			data = f.read()

		root = ET.fromstring(data)
		names = [x.attrib['name'] for x in root.findall('testcase')]
		self.assertEqual(names, ['//coal:other_test', '//coal:sub_test', '//some/deep/package:go_test'])
    def test_package_names(self):
        os.chdir(self.tmpdir)
        os.putenv('WORKSPACE', self.tmpdir)
        os.symlink('.', 'bazel-testlogs')

        self.make_result(name='coal/sub_test')
        self.make_result(name='coal/other_test')
        self.make_result(name='some/deep/package/go_test')

        coalesce.main()

        # Pass the encoding parameter to avoid ascii decode error for some
        # platform.
        with open('_artifacts/junit_bazel.xml', encoding='utf-8') as fp:
            data = fp.read()

        root = ET.fromstring(data)
        names = [x.attrib['name'] for x in root.findall('testcase')]
        self.assertEqual(names, [
            '//coal:other_test', '//coal:sub_test',
            '//some/deep/package:go_test'
        ])
示例#3
0
def main():
    split.main('webwxgetms01.gif')
    coalesce.main(' PHP ')
示例#4
0
文件: run.py 项目: DomNelson/ISGen
def main(args):
    ## Run contribution allele dropping simulations
    if not os.path.isfile(os.path.expanduser(args.contrib_outfile)):
        assert args.contrib_iterations is not None, "Missing iterations " +\
                "for allele dropping simulations"

        contrib_args = argparse.Namespace(regionfile=args.proband_regions,
                                          verbose=args.verbose,
                                          pedfile=args.pedfile,
                                          outfile=args.contrib_outfile,
                                          iterations=args.contrib_iterations)

        ind_contrib.main(contrib_args)

    ## Run coalescence simulations if file does not already exist
    if not os.path.isfile(os.path.expanduser(args.climb_outfile)):
        assert args.climb_iterations is not None, "Missing iterations " +\
                "for allele climbing simulations"

        coalesce_args = argparse.Namespace(sim_homs=args.sim_homs,
                                           pedfile=args.pedfile,
                                           outfile=args.climb_outfile,
                                           iterations=args.climb_iterations,
                                           kinship=args.kinship,
                                           verbose=args.verbose)

        if 'hetfile' in vars(args):
            vars(coalesce_args)['hetfile'] = args.hetfile
        if 'homfile' in vars(args):
            vars(coalesce_args)['homfile'] = args.homfile

        coalesce.main(coalesce_args)

    ## Calculate control likelihoods of each simulated tree
    if (not os.path.isfile(os.path.expanduser(args.control_outfile))
            and os.path.isfile(os.path.expanduser(args.contrib_outfile))):

        control_args = argparse.Namespace(pedfile=args.pedfile,
                                          climb_likfile=args.climb_outfile,
                                          outfile=args.control_outfile,
                                          contrib_file=args.contrib_outfile,
                                          freq_params=args.freq_params,
                                          verbose=args.verbose)

        control_lik.main(control_args)

    ## Calculate estimated regional allele frequencies
    if (args.regional_freq_outfile is not None and
        (not os.path.isfile(os.path.expanduser(args.regional_freq_outfile))
         and os.path.isfile(os.path.expanduser(args.contrib_outfile)))):

        N, n, k = [float(x) for x in args.freq_params.split(',')]
        observed_freq = 1. * k / n

        regional_freq_args = argparse.Namespace(
            regionsfile=args.regions_to_calculate,
            pedfile=args.pedfile,
            contrib_h5=args.contrib_outfile,
            climb_likfile=args.climb_outfile,
            observed_freq=observed_freq,
            control_freq_likfile=args.control_outfile,
            freq_params=args.freq_params,
            outfile=args.regional_freq_outfile)

        regional_freq.main(regional_freq_args)