示例#1
0
    def test_load_opensnp_datadump_file(self):
        # temporarily set resources dir to tests
        r = Resources()
        r._resources_dir = "tests/resources"

        # write test openSNP datadump zip
        with atomic_write("tests/resources/opensnp_datadump.current.zip",
                          mode="wb",
                          overwrite=True) as f:
            with zipfile.ZipFile(f, "w") as f_zip:
                f_zip.write("tests/input/generic.csv", arcname="generic1.csv")
                f_zip.write("tests/input/generic.csv", arcname="generic2.csv")

        snps1 = SNPs(r.load_opensnp_datadump_file("generic1.csv"))
        snps2 = SNPs(r.load_opensnp_datadump_file("generic2.csv"))

        pd.testing.assert_frame_equal(snps1.snps, self.generic_snps())
        pd.testing.assert_frame_equal(snps2.snps, self.generic_snps())

        r._resources_dir = "resources"
示例#2
0
    def _setup_gsa_test(resources_dir):
        # reset resource if already loaded
        r = Resources()
        r._resources_dir = resources_dir
        r._gsa_resources = {}

        gzip_file(
            "tests/resources/gsa_rsid_map.txt",
            os.path.join(resources_dir, "gsa_rsid_map.txt.gz"),
        )
        gzip_file(
            "tests/resources/gsa_chrpos_map.txt",
            os.path.join(resources_dir, "gsa_chrpos_map.txt.gz"),
        )
示例#3
0
    def _setup_gsa_test(resources_dir):
        # reset resource if already loaded
        r = Resources()
        r._resources_dir = resources_dir
        r._init_resource_attributes()

        gzip_file(
            "tests/resources/gsa_rsid_map.txt",
            os.path.join(resources_dir, "gsa_rsid_map.txt.gz"),
        )
        gzip_file(
            "tests/resources/gsa_chrpos_map.txt",
            os.path.join(resources_dir, "gsa_chrpos_map.txt.gz"),
        )
        gzip_file(
            "tests/resources/dbsnp_151_37_reverse.txt",
            os.path.join(resources_dir, "dbsnp_151_37_reverse.txt.gz"),
        )
示例#4
0
 def _teardown_gsa_test():
     r = Resources()
     r._resources_dir = "resources"
     r._gsa_resources = {}
示例#5
0
 def _teardown_gsa_test():
     r = Resources()
     r._resources_dir = "resources"
     r._init_resource_attributes()