Mercurial > repos > iuc > vardict_java
diff split.py @ 3:e0734e88a104 draft default tip
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/vardict commit 80e3742f499e8efabad1fe7627201466d0bdd190"
author | iuc |
---|---|
date | Thu, 27 Jan 2022 15:19:23 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/split.py Thu Jan 27 15:19:23 2022 +0000 @@ -0,0 +1,16 @@ +import sys + + +fai = sys.argv[1] +chunk_size = int(sys.argv[2]) +overlap = int(sys.argv[3]) # Base pairs +with open(fai, 'r') as infile: + for line in infile: + name = line.split('\t')[0] + stop = int(line.split('\t')[1]) + start = 1 + while start < stop: + start = max(1, start - overlap) + print('\t'.join([name, str(start), + str(min(start + chunk_size, stop))])) + start += chunk_size