示例#1
0
    def test_one(self):
        logging.info("TestSnpSet test_one")

        fn = "lrt_one_kernel_fixed_mixed_effect_linear_qqfit.N300.txt"
        tmpOutfile = self.file_name(fn)
        referenceOutfile = self._referenceOutfile(fn)

        result_dataframe = snp_set(
            test_snps = self.currentFolder+'/../../../tests/datasets/all_chr.maf0.001.N300',
            set_list = self.currentFolder+'/../../../tests/datasets/set_input.23.txt',
            pheno = self.currentFolder+'/../../../tests/datasets/phenSynthFrom22.23.N300.txt',
            output_file_name = tmpOutfile
            )


        out,msg=ut.compare_files(tmpOutfile, referenceOutfile, tolerance)                
        self.assertTrue(out, "msg='{0}', ref='{1}', tmp='{2}'".format(msg, referenceOutfile, tmpOutfile))
示例#2
0
    def test_one(self):
        logging.info("TestSnpSet test_one")

        fn = "lrt_one_kernel_fixed_mixed_effect_linear_qqfit.N300.txt"
        tmpOutfile = self.file_name(fn)
        referenceOutfile = self._referenceOutfile(fn)

        result_dataframe = snp_set(
            test_snps = self.currentFolder+'/../../../tests/datasets/all_chr.maf0.001.N300',
            set_list = self.currentFolder+'/../../../tests/datasets/set_input.23.txt',
            pheno = self.currentFolder+'/../../../tests/datasets/phenSynthFrom22.23.N300.txt',
            output_file_name = tmpOutfile
            )


        out,msg=ut.compare_files(tmpOutfile, referenceOutfile, tolerance)                
        self.assertTrue(out, "msg='{0}', ref='{1}', tmp='{2}'".format(msg, referenceOutfile, tmpOutfile))
示例#3
0
def main(args):
    # command line arguments
    genotype, phenotype, file_gene, fileout, file_sets = args

    genes = load_file(file_gene)

    # Running the method
    results_df = snp_set(test_snps=genotype,
                         G0=None,
                         set_list=file_sets,
                         pheno=phenotype,
                         test='lrt',
                         nperm=0)

    statistics = process_results(results_df, genes)
    save_file(fileout, statistics)
    return 0
示例#4
0
    def test_three(self):
        logging.info("TestSnpSet test_three")

        fn = "sc_davies_one_kernel_linear_qqfit.N300.txt"
        tmpOutfile = self.file_name(fn)
        referenceOutfile = self._referenceOutfile(fn)

        result_dataframe = snp_set(
            test_snps = self.currentFolder+'/../../../tests/datasets/all_chr.maf0.001.N300',
            set_list = self.currentFolder+'/../../../tests/datasets/set_input.small.txt',
            pheno = self.currentFolder+'/../../../tests/datasets/phenSynthFrom22.23.N300.txt',
            test = "sc_davies",
            output_file_name = tmpOutfile
            )


        out,msg=ut.compare_files(tmpOutfile, referenceOutfile, tolerance)                
        self.assertTrue(out,msg)#msg='Files %s and %s are different.' % (tmpOutfile, referenceOutfile))
示例#5
0
    def test_four(self):
        logging.info("TestSnpSet test_four")

        fn = "sc_davies_two_kernel_linear_qqfit.N300.noautoselect.txt"
        tmpOutfile = self.file_name(fn)
        referenceOutfile = self._referenceOutfile(fn)

        result_dataframe = snp_set(
            test_snps = self.currentFolder+'/../../../tests/datasets/all_chr.maf0.001.N300',
            set_list = self.currentFolder+'/../../../tests/datasets/set_input.small.txt',
            pheno = self.currentFolder+'/../../../tests/datasets/phenSynthFrom22.23.N300.randcidorder.txt',
            G0 = self.currentFolder+'/../../../tests/datasets/all_chr.maf0.001.chr22.23.N300.bed',
            test = 'sc_davies',
            output_file_name = tmpOutfile
            )


        out,msg=ut.compare_files(tmpOutfile, referenceOutfile, tolerance)                
        self.assertTrue(out, "msg='{0}', ref='{1}', tmp='{2}'".format(msg, referenceOutfile, tmpOutfile))
示例#6
0
    def test_two(self):
        logging.info("TestSnpSet test_two")

        fn = "lrt_up_two_kernel_mixed_effect_linear_qqfit.N300.fullrank.txt"
        tmpOutfile = self.file_name(fn)
        referenceOutfile = self._referenceOutfile(fn)

        result_dataframe = snp_set(
            test_snps = self.currentFolder+'/../../../tests/datasets/all_chr.maf0.001.N300',
            set_list = self.currentFolder+'/../../../tests/datasets/set_input.23.txt',
            pheno = self.currentFolder+'/../../../tests/datasets/phenSynthFrom22.23.N300.txt',
            G0 = self.currentFolder+'/../../../tests/datasets/all_chr.maf0.001.chr22.23.N300.bed',
            output_file_name = tmpOutfile,
            test="lrt"
            )


        out,msg=ut.compare_files(tmpOutfile, referenceOutfile, tolerance)                
        self.assertTrue(out,msg)#msg='Files %s and %s are different.' % (tmpOutfile, referenceOutfile))
示例#7
0
    def test_four(self):
        logging.info("TestSnpSet test_four")

        fn = "sc_davies_two_kernel_linear_qqfit.N300.noautoselect.txt"
        tmpOutfile = self.file_name(fn)
        referenceOutfile = self._referenceOutfile(fn)

        result_dataframe = snp_set(
            test_snps = self.currentFolder+'/../../../tests/datasets/all_chr.maf0.001.N300',
            set_list = self.currentFolder+'/../../../tests/datasets/set_input.small.txt',
            pheno = self.currentFolder+'/../../../tests/datasets/phenSynthFrom22.23.N300.randcidorder.txt',
            G0 = self.currentFolder+'/../../../tests/datasets/all_chr.maf0.001.chr22.23.N300.bed',
            test = 'sc_davies',
            output_file_name = tmpOutfile
            )


        out,msg=ut.compare_files(tmpOutfile, referenceOutfile, tolerance)                
        self.assertTrue(out, "msg='{0}', ref='{1}', tmp='{2}'".format(msg, referenceOutfile, tmpOutfile))
示例#8
0
    def test_two(self):
        logging.info("TestSnpSet test_two")

        fn = "lrt_up_two_kernel_mixed_effect_linear_qqfit.N300.fullrank.txt"
        tmpOutfile = self.file_name(fn)
        referenceOutfile = self._referenceOutfile(fn)

        result_dataframe = snp_set(
            test_snps = self.currentFolder+'/../../../tests/datasets/all_chr.maf0.001.N300',
            set_list = self.currentFolder+'/../../../tests/datasets/set_input.23.txt',
            pheno = self.currentFolder+'/../../../tests/datasets/phenSynthFrom22.23.N300.txt',
            G0 = self.currentFolder+'/../../../tests/datasets/all_chr.maf0.001.chr22.23.N300.bed',
            output_file_name = tmpOutfile,
            test="lrt"
            )


        out,msg=ut.compare_files(tmpOutfile, referenceOutfile, tolerance)                
        self.assertTrue(out,msg)#msg='Files %s and %s are different.' % (tmpOutfile, referenceOutfile))
def main(args):
    # command line arguments
    j, blocksize, genotype, phenotype, outdir = args

    # File with the set of SNPs corresponding to the 1-degree neighbourhoods
    file_sets = outdir + 'neighborhoods_' + blocksize + '/list_nb1_' + j + '.txt'

    # Output dir for the statistics on permuted settings
    outdir = outdir + 'statistics_' + blocksize + '/'
    if (not os.path.exists(outdir)):
        os.makedirs(outdir)

    # Running the method
    results_df = snp_set(test_snps=genotype,
                         G0=None,
                         set_list=file_sets,
                         pheno=phenotype,
                         test='lrt',
                         nperm=0)

    statistics = process_results(results_df)
    save_file(outdir + 'statistics_' + j + '.pkl', statistics)
    return 0