def testProcessWeightDBRun(self):
        dummy = buildDummyArgs("_test")
        setupDataForArgs(dummy, "_test")
        p = ProcessWeightDB(dummy)

        try:
            p.run()
        except:
            self.assertEqual(False, True, "Prerequisites should have run without error")

        with gzip.open(p.covariance_output) as f:
            expected_lines = ["GENE RSID1 RSID2 VALUE",
                            "A rs1 rs1 1.0",
                            "A rs1 rs2 0.0",
                            "A rs1 rs3 -0.3333333333333333",
                            "A rs2 rs2 0.0",
                            "A rs2 rs3 0.0",
                            "A rs3 rs3 0.3333333333333333",
                            "C rs6 rs6 1.0",
                            "B rs4 rs4 0.0",
                            "B rs4 rs5 0.0",
                            "B rs5 rs5 0.3333333333333333",
                            "D rs1 rs1 1.0"]
            for i,expected_line in enumerate(expected_lines):
                actual_line = f.readline().strip()
                self.assertEqual(actual_line, expected_line)
        cleanUpDataForArgs("_test")
Ejemplo n.º 2
0
    def testProcessWeightDBRun(self):
        dummy = buildDummyArgs("_test")
        setupDataForArgs(dummy, "_test")
        p = ProcessWeightDB(dummy)

        try:
            p.run()
        except:
            self.assertEqual(False, True, "Prerequisites should have run without error")

        with gzip.open(p.covariance_output) as f:
            expected_lines = ["GENE RSID1 RSID2 VALUE",
                            "A rs1 rs1 1.0",
                            "A rs1 rs2 0.0",
                            "A rs1 rs3 -0.3333333333333333",
                            "A rs2 rs2 0.0",
                            "A rs2 rs3 0.0",
                            "A rs3 rs3 0.3333333333333333",
                            "B rs4 rs4 0.0",
                            "B rs4 rs5 0.0",
                            "B rs5 rs5 0.3333333333333333",
                            "C rs6 rs6 1.0",
                            "D rs1 rs1 1.0"]
            for i,expected_line in enumerate(expected_lines):
                actual_line = f.readline().decode().strip()
                self.assertEqual(actual_line, expected_line)
        cleanUpDataForArgs("_test")
Ejemplo n.º 3
0
 def testProcessPrerequisitesConstructor(self):
     dummy = buildDummyArgs("_test")
     p = ProcessWeightDB(dummy)
     self.assertEqual(p.weight_db, "test.db")
     self.assertEqual(p.db_path, "_test/test.db")
     self.assertEqual(p.data_folder, "_test/filtered_dosage")
     self.assertEqual(p.correlation_output, None)
     self.assertEqual(p.covariance_output, "_test/covariance/cov.txt.gz")
     self.assertEqual(p.input_format, Formats.PrediXcan)
     self.assertEqual(p.min_maf_filter, None)
     self.assertEqual(p.max_maf_filter, None)
Ejemplo n.º 4
0
 def testProcessPrerequisitesConstructorDefaultCovariance(self):
     dummy = buildDummyArgs("_test")
     dummy.covariance_output = None
     p = ProcessWeightDB(dummy)
     self.assertEqual(p.covariance_output,
                      "intermediate/cov/test.cov.txt.gz")
Ejemplo n.º 5
0
 def testProcessPrerequisitesnoArgConstructor(self):
     with self.assertRaises(AttributeError):
         dummy = Dummy()
         p = ProcessWeightDB(dummy)