Created
October 21, 2016 22:35
-
-
Save n-long/2cbb616e7745de27581fac949015f362 to your computer and use it in GitHub Desktop.
convert lastz alignment output format to PALS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import glob,re | |
csv=glob.glob('*.csv') | |
for filename in csv: | |
fi = open(filename, 'r') | |
fo = open(filename.replace('.csv','.gff'), 'w') | |
for line in fi: | |
if not line.startswith("#"): | |
cols=line.split('\t') | |
maxexp=float(re.sub("[^0-9\.]","", cols[9])) | |
maxexp_value=((100-maxexp)/100) | |
print >> fo, '{0}\tpals\thit\t{1}\t{2}\t{3}\t{4}\t.\tTarget {5} {6} {7}; maxe {8}'\ | |
.format(cols[0], cols[1], cols[2], cols[3], cols[4], cols[5], cols[6], cols[7], maxexp_value) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment