Ejemplo n.º 1
0
    def test_directory_hash(self):
        """Test that we can read a hashcode for a directory."""
        test_dir = "testdata/thaga_janakari_gene_ds/hg19"
        hasher = Hasher()

        self.assertTrue(
            hasher.create_hashcode_for_dir(
                test_dir) == "cd04c3299a21ce5fbe1bb9dc0d73d907",
            "Hashed directory did not match ground truth. (" +
            hasher.create_hashcode_for_dir(test_dir) + ")  for path:  " +
            os.path.abspath(test_dir))
Ejemplo n.º 2
0
 def create_datasource_md5_file(datasource_dir):
     """datasource_dir should be the /db_dir/ds_name/genome_build.
     For example,
     create_datasource_md5_file("/home/user/my_db_dir/gaf/hg19")
     """
     if datasource_dir.endswith('/'):
         datasource_dir = datasource_dir[:-1]
     md5_filename = os.path.abspath(datasource_dir) + ".md5"
     logging.getLogger(__name__).info("md5 being written to: " + os.path.abspath(md5_filename))
     hasher = Hasher()
     hashcode = hasher.create_hashcode_for_dir(datasource_dir)
     fp = file(md5_filename, "w")
     fp.write(hashcode)
     fp.close()
Ejemplo n.º 3
0
 def test_directory_hash(self):
     """Test that we can read a hashcode for a directory."""
     test_dir = "testdata/thaga_janakari_gene_ds/hg19"
     hasher = Hasher()
     
     self.assertTrue(hasher.create_hashcode_for_dir(test_dir)=="cd04c3299a21ce5fbe1bb9dc0d73d907", "Hashed directory did not match ground truth. (" + hasher.create_hashcode_for_dir(test_dir) + ")  for path:  " + os.path.abspath(test_dir))