Mercurial > repos > abims-sbr > pairwise
annotate scripts/functions.py @ 4:6709645eff5d draft
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
| author | abims-sbr |
|---|---|
| date | Wed, 17 Jan 2018 08:53:53 -0500 |
| parents | |
| children | 471ed956ff13 |
| rev | line source |
|---|---|
|
4
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
1 import string |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
2 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
3 # Used in S05 and |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
4 def split_file(path_in, keyword): |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
5 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
6 file_in = open(path_in, "r") |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
7 RUN = '' |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
8 BASH1={} |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
9 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
10 with open(path_in, "r") as file_in: |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
11 for nextline in file_in.readlines(): |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
12 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
13 ################################## |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
14 ### [A] FORMATTING QUERY NAME ### |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
15 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
16 # Get query name |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
17 if nextline[0:6]=='Query=': |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
18 L1 = string.split(nextline, "||") |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
19 L2 = string.split(L1[0], " ") |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
20 query = L2[1] |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
21 if query[-1] == "\n": |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
22 query = query[:-1] |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
23 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
24 ### [A] END FORMATTING QUERY NAME ### |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
25 ###################################### |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
26 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
27 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
28 ### split the file with keyword ### |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
29 if keyword in nextline: |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
30 # Two cases here: |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
31 #1# If it is the first "RUN" in the block (i.e. the first occurence of "BLASTN" in the file), we have just to add the new lines in the "RUN" list ... 2nd , we have also to detect the 'key' of bash1, which is the "query" name ... and third we will have to save this "RUN" in the bash1, once we will have detected a new "RUN" (i.e. a new line beginning with "BLASTN". |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
32 #2# If it isn't the first run, we have the save the previous "RUN" in the "bash1", before to re-initialize the RUN list (RUN =[]), before to append lines to the new "RUN" |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
33 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
34 if RUN == '': # case #1# |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
35 RUN = RUN + nextline # we just added the first line of the file |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
36 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
37 else: # case #2# (there was a run before) |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
38 BASH1[query] = RUN # add the previous run to the bash |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
39 RUN = '' # re-initialize the "RUN" |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
40 RUN = RUN + nextline # add the line starting with the keyword ("BLASTN") (except the first line of the file (the first "RUN") |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
41 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
42 else: # Treatment of the subsequent lines of the one starting with the keyword ("BLASTN") (which is not treated here but previously) |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
43 RUN = RUN + nextline |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
44 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
45 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
46 if RUN: |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
47 BASH1[query] = RUN # add the last "RUN" |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
48 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
49 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
50 return(BASH1) |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
51 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
52 def detect_Matches(query, MATCH, WORK_DIR, bash1): |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
53 F5 = open("%s/blastRun2.tmp" %WORK_DIR, 'w') |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
54 F5.write(bash1[query]) |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
55 F5.close() |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
56 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
57 F6 = open("%s/blastRun2.tmp" %WORK_DIR, 'r') |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
58 list1 =[] |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
59 list2 =[] |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
60 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
61 while 1: |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
62 nexteu = F6.readline() |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
63 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
64 if not nexteu : break |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
65 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
66 if "***** No hits found ******" in nexteu : |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
67 hit = 0 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
68 break |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
69 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
70 if 'Sequences producing significant alignments:' in nexteu: |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
71 hit = 1 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
72 F6.readline() # jump a line |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
73 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
74 while 1: |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
75 nexteu2 = F6.readline() |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
76 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
77 if nexteu2[0]==">": break |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
78 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
79 ###################################### |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
80 ### [B] FORMAT MATCH NAME 1st STEP ### |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
81 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
82 if nexteu2 != '\n': |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
83 LL1 = string.split(nexteu2, " ") # specific NORTH database names !!!!!!! |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
84 match = LL1[0] #### SOUTH databank // NORTH will have "|" separators |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
85 list1.append(match) |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
86 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
87 match2 = ">" + LL1[0] # more complete name // still specific NORTH database names !!!!!!! |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
88 list2.append(match2) #### SOUTH databank // NORTH will have "|" separators |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
89 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
90 if MATCH == 0: ## Only read the 1rst line (i.e. the First Match) |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
91 break |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
92 else: ## Read the other lines (i.e. All the Matches) |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
93 continue |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
94 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
95 ### [B] END FORMAT MATCH NAME 1st STEP ### |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
96 ########################################## |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
97 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
98 break |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
99 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
100 F6.close() |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
101 return(list1, list2, hit) # list1 = short name // list2 = more complete name |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
102 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
103 def get_information_on_matches(list_of_line): |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
104 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
105 for line in list_of_line: |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
106 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
107 ## Score and Expect |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
108 if "Score" in line: |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
109 line = line[:-1] # remove "\n" |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
110 S_line = string.split(line, " = ") |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
111 Expect = S_line[-1] ## ***** Expect |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
112 S_line2 = string.split(S_line[1], " bits ") |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
113 Score = string.atof(S_line2[0]) |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
114 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
115 ## Identities/gaps/percent/divergence/length_matched |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
116 elif "Identities" in line: |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
117 line = line[:-1] # remove "\n" |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
118 g = 0 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
119 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
120 if "Gaps" in line: |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
121 pre_S_line = string.split(line, ",") |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
122 identity_line = pre_S_line[0] |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
123 gaps_line = pre_S_line[1] |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
124 g = 1 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
125 else: |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
126 identity_line = line |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
127 g = 0 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
128 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
129 ## treat identity line |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
130 S_line = string.split(identity_line, " ") |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
131 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
132 identities = S_line[-2] ## ***** identities |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
133 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
134 S_line2 = string.split(identities, "/") |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
135 hits = string.atof(S_line2[0]) ## ***** hits |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
136 length_matched = string.atof(S_line2[1]) ## ***** length_matched |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
137 abs_nb_differences = length_matched - hits ## ***** abs_nb_differences |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
138 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
139 identity_percent = hits/length_matched * 100 ## ***** identity_percent |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
140 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
141 divergence_percent = abs_nb_differences/length_matched*100 ## ***** divergence_percent |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
142 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
143 ## treat gap line if any |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
144 if g ==1: # means there are gaps |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
145 S_line3 = string.split(gaps_line, " ") |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
146 gaps_part = S_line3[-2] |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
147 S_line4 = string.split(gaps_part, "/") |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
148 gaps_number = string.atoi(S_line4[0]) ## ***** gaps_number |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
149 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
150 real_differences = abs_nb_differences - gaps_number ## ***** real_differences |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
151 real_divergence_percent = (real_differences/length_matched)*100 ## ***** real_divergence_percent |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
152 else: |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
153 gaps_number = 0 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
154 real_differences = 0 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
155 real_divergence_percent = divergence_percent |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
156 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
157 ## Frame |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
158 elif "Frame" in line: |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
159 line = line[:-1] # remove "\n" |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
160 S_line = string.split(line, " = ") |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
161 frame = S_line[1] |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
162 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
163 list_informations=[length_matched, Expect, Score, identities, hits, identity_percent, divergence_percent,gaps_number, real_divergence_percent, frame, length_matched] |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
164 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
165 return(list_informations) |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
166 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
167 # Used in S06, S09, S11 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
168 def get_pairs(fasta_file_path): |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
169 F2 = open(fasta_file_path, "r") |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
170 list_pairwises = [] |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
171 while 1: |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
172 next2 = F2.readline() |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
173 if not next2: |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
174 break |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
175 if next2[0] == ">": |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
176 fasta_name_query = next2[:-1] |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
177 next3 = F2.readline() |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
178 fasta_seq_query = next3[:-1] |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
179 next3 = F2.readline() ## jump one empty line (if any after the sequence) |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
180 fasta_name_match = next3[:-1] |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
181 next3 = F2.readline() |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
182 fasta_seq_match = next3[:-1] |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
183 pairwise = [fasta_name_query,fasta_seq_query,fasta_name_match,fasta_seq_match] |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
184 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
185 ## ADD pairwise with condition |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
186 list_pairwises.append(pairwise) |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
187 F2.close() |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
188 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
189 return(list_pairwises) |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
190 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
191 def extract_length(length_string): # format length string = 57...902 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
192 l3 = string.split(length_string, "...") |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
193 n1 = string.atoi(l3[0]) |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
194 n2 = string.atoi(l3[1]) |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
195 length = n2-n1 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
196 return(length) |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
197 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
198 def filter_redondancy(list_paireu, MIN_LENGTH): |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
199 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
200 bash1 = {} |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
201 list_pairout = [] |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
202 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
203 for pair in list_paireu: |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
204 query_name = pair[0] |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
205 query_seq = pair[1] |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
206 match_name = pair[2] |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
207 match_seq = pair[3] |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
208 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
209 l1 = string.split(query_name, "||") |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
210 short_query_name = l1[0][1:] |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
211 length_matched = extract_length(l1[1]) |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
212 l2 = string.split(match_name, "||") |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
213 short_match_name = l2[0][1:] |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
214 binom = "%s_%s" %(short_query_name, short_match_name) |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
215 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
216 if binom not in bash1.keys(): |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
217 bash1[binom] = [query_name, query_seq, match_name, match_seq, length_matched] |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
218 else: |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
219 old_length = bash1[binom][-1] |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
220 if length_matched > old_length: |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
221 bash1[binom] = [query_name, query_seq, match_name, match_seq, length_matched] |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
222 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
223 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
224 for bino in bash1.keys(): |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
225 length = bash1[bino][-1] |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
226 if length > MIN_LENGTH: |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
227 list_pairout.append(bash1[bino]) |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
228 |
|
6709645eff5d
planemo upload for repository https://github.com/abims-sbr/adaptsearch commit cf1b9c905931ca2ca25faa4844d45c908756472f
abims-sbr
parents:
diff
changeset
|
229 return(list_pairout) |
