3skimfiles = json.loads(open(snakemake.input.skim_dirs,
"r").read())
4outputfiles = snakemake.output
5BatchesPerSkim = snakemake.params.BatchesPerSkim
7binwidth = int(len(skimfiles)/BatchesPerSkim)
9 raise ValueError(
"Attempting to batching with binwidth smaller 1. Decrease the number of batches!")
12for batch
in range(BatchesPerSkim):
13 if(batch == BatchesPerSkim - 1):
14 batches.update({outputfiles[batch]: list(skimfiles[binwidth*batch:])})
16 batches.update({outputfiles[batch]: list(skimfiles[binwidth*batch:binwidth*(batch+1)])})
18for key, file_list
in batches.items():
19 with open(key,
"w")
as f:
20 f.write(json.dumps(file_list))