633cc56e1b1043b0ab6e1fd0e9b90154e2c03c0c hiram Mon Apr 20 13:00:51 2026 -0700 document procedure for import of VGP 577-way maf result refs #34370 diff --git src/hg/makeDb/doc/vgp577way/sumBlocks.py src/hg/makeDb/doc/vgp577way/sumBlocks.py new file mode 100755 index 00000000000..fc5c09988a7 --- /dev/null +++ src/hg/makeDb/doc/vgp577way/sumBlocks.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python3 + +import sys + +def sumByIdentifier(inputFile): + sums = {} + + with open(inputFile, 'r') as f: + for line in f: + parts = line.strip().split() + if len(parts) == 2: + value = int(parts[0]) + identifier = parts[1] + + if identifier in sums: + sums[identifier] += value + else: + sums[identifier] = value + + for identifier, total in sums.items(): + print(f"{total}\t{identifier}") + +if __name__ == "__main__": + if len(sys.argv) != 2: + print("Usage: script.py input_file > output_file") + sys.exit(1) + + inputFile = sys.argv[1] + sumByIdentifier(inputFile)