Mercurial > repos > davidvanzessen > shm_csr
comparison baseline/script_imgt.py @ 32:4c5ba6b5d10d draft
Uploaded
author | davidvanzessen |
---|---|
date | Thu, 15 Dec 2016 09:21:54 -0500 |
parents | c33d93683a09 |
children | 8728284105ee |
comparison
equal
deleted
inserted
replaced
31:fe44a905aee9 | 32:4c5ba6b5d10d |
---|---|
9 parser.add_argument("--id", help="ID to be used at the '>>>' line in the output") | 9 parser.add_argument("--id", help="ID to be used at the '>>>' line in the output") |
10 | 10 |
11 args = parser.parse_args() | 11 args = parser.parse_args() |
12 | 12 |
13 refdic = dict() | 13 refdic = dict() |
14 with open(args.ref, 'r') as ref: | 14 with open(args.ref, 'rU') as ref: |
15 currentSeq = "" | 15 currentSeq = "" |
16 currentId = "" | 16 currentId = "" |
17 for line in ref: | 17 for line in ref: |
18 if line[0] is ">": | 18 if line[0] is ">": |
19 if currentSeq is not "" and currentId is not "": | 19 if currentSeq is not "" and currentId is not "": |
35 | 35 |
36 #vPattern = re.compile(r"|".join(vPattern)) | 36 #vPattern = re.compile(r"|".join(vPattern)) |
37 vPattern = re.compile("|".join(vPattern)) | 37 vPattern = re.compile("|".join(vPattern)) |
38 | 38 |
39 def filterGene(s, pattern): | 39 def filterGene(s, pattern): |
40 s1 = s[s.find(" ") + 1:] | |
41 return s1[:s1.find(" ")] | |
42 """ | |
40 if type(s) is not str: | 43 if type(s) is not str: |
41 return None | 44 return None |
42 res = pattern.search(s) | 45 res = pattern.search(s) |
43 if res: | 46 if res: |
44 return res.group(0) | 47 return res.group(0) |
45 return None | 48 return None |
46 | 49 """ |
47 | 50 |
48 | 51 |
49 currentSeq = "" | 52 currentSeq = "" |
50 currentId = "" | 53 currentId = "" |
51 first=True | 54 first=True |