Created
August 15, 2011 18:33
-
-
Save starenka/1147379 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import re | |
RE_SPLIT = re.compile(r'\W+') | |
file_obj = open('/junk/in') | |
def parse_file(file_obj,re_split): | |
for line in file_obj: | |
yield re.split(re_split,line)[1:-1] | |
for l in parse_file(file_obj,RE_SPLIT): | |
print l | |
''' | |
1: sp|Q8GBW6|12S_PROFR 100 8 5 6 7 9 6 5 | |
2: sp|P93343|1433C_TOBAC 8 100 5 9 7 4 6 8 | |
3: sp|P18485|1A12_SOLLC 5 5 100 5 5 8 5 8 | |
4: sp|P37821|1A1C_MALDO 6 9 5 100 6 9 7 6 | |
5: sp|Q00740|1A1D_PSEUD 7 7 5 6 100 6 25 10 | |
6: sp|O57809|1A1D_PYRHO 9 4 8 9 6 100 8 6 | |
7: sp|Q7M523|1A1D_CYBSA 6 6 5 7 25 8 100 7 | |
8: sp|Q96QU6|1A1L1_HUMAN 5 8 8 6 10 6 7 100 | |
''' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment