allpy
changeset 436:fedcd441e2fc
Fixed command line processing for mass_realine_blocks.py
* added comprehensive help
* fixed type errors in argument processing
author | Daniil Alexeyevsky <dendik@kodomo.fbb.msu.ru> |
---|---|
date | Tue, 15 Feb 2011 21:11:17 +0300 |
parents | e19b527196c7 |
children | f894437d30c9 |
files | utils/mass_realign_blocks.py |
diffstat | 1 files changed, 10 insertions(+), 3 deletions(-) [+] |
line diff
1.1 --- a/utils/mass_realign_blocks.py Tue Feb 15 21:03:19 2011 +0300 1.2 +++ b/utils/mass_realign_blocks.py Tue Feb 15 21:11:17 2011 +0300 1.3 @@ -1,7 +1,12 @@ 1.4 #!/usr/bin/python 1.5 -"""Realign given part of alignment. 1.6 +"""Realign parts of multiple sequences. 1.7 1.8 -All position indexes are counting from 1. 1.9 +Realignment task is given as a file of the following format: 1.10 + * each line has filename, first column number and last column number, separated with tabs 1.11 + * empty lines and lines beginning with # are ignored 1.12 + * index of first column is 1 1.13 + 1.14 +All column ranges for each file are joined to be realined as a single alignment. 1.15 """ 1.16 import optparse 1.17 import sys 1.18 @@ -13,9 +18,11 @@ 1.19 task = {} 1.20 for line in file: 1.21 line = line.rstrip("\n\r") 1.22 + if line.strip() == "" or line.strip()[0] == "#": 1.23 + continue 1.24 filename, begin, end = line.split("\t") 1.25 task[filename] = task.get(filename, []) 1.26 - task[filename].append((begin, end)) 1.27 + task[filename].append((int(begin), int(end))) 1.28 return task 1.29 1.30 def main():