def confirm_downloaded_files(self): try: checksums_file = read_remote_file(self.database_url + '/md5_checksums', is_gzip=False).strip() checksums = {} except: self.run.warning( "Checksum file '%s' is not available in FTP, Anvi'o won't be able to verify downloaded files." % (self.database_url + '/md5_checksums')) return for line in checksums_file.split('\n'): checksum, file_name = [ item.strip() for item in line.strip().split() ] checksums[file_name] = checksum for file_name in self.files: if not filesnpaths.is_file_exists(os.path.join( self.pfam_data_dir, file_name), dont_raise=True): # TO DO: Fix messages :( raise ConfigError("Have missing file %s, please run --reset" % file_name) hash_on_disk = utils.get_file_md5( os.path.join(self.pfam_data_dir, file_name)) expected_hash = checksums[file_name] if not expected_hash == hash_on_disk: # TO DO: Fix messages :( raise ConfigError( "Please run with --reset, one file hash doesn't match. %s" % file_name)
def confirm_downloaded_files(self): try: checksums_file = read_remote_file(self.database_url + '/md5_checksums', is_gzip=False).strip() checksums = {} except: self.run.warning("Checksum file '%s' is not available in FTP, Anvi'o won't be able to verify downloaded files." % (self.database_url + '/md5_checksums')) return for line in checksums_file.split('\n'): checksum, file_name = [item.strip() for item in line.strip().split()] checksums[file_name] = checksum for file_name in self.files: if not filesnpaths.is_file_exists(os.path.join(self.pfam_data_dir, file_name), dont_raise=True): # TO DO: Fix messages :( raise ConfigError("Have missing file %s, please run --reset" % file_name) hash_on_disk = utils.get_file_md5(os.path.join(self.pfam_data_dir, file_name)) expected_hash = checksums[file_name] if not expected_hash == hash_on_disk: # TO DO: Fix messages :( raise ConfigError("Please run with --reset, one file hash doesn't match. %s" % file_name)
def confirm_downloaded_files(self): try: checksums_file = read_remote_file(self.database_url + '/md5_checksums', is_gzip=False).strip() checksums = {} except: self.run.warning( "Checksum file '%s' is not available in FTP, Anvi'o won't be able to verify downloaded files." % (self.database_url + '/md5_checksums')) return for line in checksums_file.split('\n'): checksum, file_name = [ item.strip() for item in line.strip().split() ] checksums[file_name] = checksum for file_name in self.files: if not filesnpaths.is_file_exists(os.path.join( self.pfam_data_dir, file_name), dont_raise=True): raise ConfigError( f"Unfortunately, we failed to download the file {file_name}, please re-run setup " "with the --reset flag.") hash_on_disk = utils.get_file_md5( os.path.join(self.pfam_data_dir, file_name)) expected_hash = checksums[file_name] if not expected_hash == hash_on_disk: raise ConfigError( f"Please re-run setup with --reset, the file hash for {file_name} doesn't match to the hash " "we expected. If you continue to get this error after doing that, try removing the entire " f"Pfams data directory ({self.pfam_data_dir}) manually and running setup again (without the --reset flag)." )