Mercurial > repos > guerler > springsuite
annotate spring_map.py @ 41:f316caf098a6 draft default tip
"planemo upload commit 685e1236afde7cf6bb0c9236de06998d2c211dd3"
author | guerler |
---|---|
date | Mon, 01 Mar 2021 15:02:36 +0000 |
parents | 172398348efd |
children |
rev | line source |
---|---|
37
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
1 #! /usr/bin/env python3 |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
2 import argparse |
39
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
3 from os import mkdir, system |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
4 from os.path import isfile, isdir |
37
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
5 |
39
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
6 from spring_package.DBKit import DBKit |
37
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
7 from spring_package.Molecule import Molecule |
39
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
8 from spring_package.Utilities import getId, getChain, getName |
37
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
9 |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
10 |
39
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
11 def getPDB(line, pdbDatabase): |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
12 pdb = getName(line) |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
13 pdbChain = getChain(line) |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
14 pdbFile = "temp/temp.pdb" |
37
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
15 pdbDatabaseId = "%s.pdb" % pdb |
39
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
16 pdbDatabase.createFile(pdbDatabaseId, pdbFile) |
37
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
17 return pdbFile, pdbChain |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
18 |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
19 |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
20 def getSequences(fileName): |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
21 sequences = dict() |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
22 with open(fileName) as file: |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
23 for line in file: |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
24 if line.startswith(">"): |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
25 name = getId(line.split()[0][1:]) |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
26 nextLine = next(file) |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
27 sequences[name] = nextLine |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
28 return sequences |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
29 |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
30 |
39
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
31 def findMatch(identifier, templates, databaseFile, pdbDatabase, evalue=0.0): |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
32 if identifier in templates: |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
33 return identifier |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
34 resultSub = identifier[:2] |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
35 fastaFile = "temp/%s/%s.fasta" % (resultSub, identifier) |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
36 resultFile = "%s.result" % fastaFile |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
37 if not isfile(resultFile): |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
38 resultDir = "temp/%s" % resultSub |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
39 if not isdir(resultDir): |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
40 mkdir(resultDir) |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
41 pdbFile, pdbChain = getPDB(identifier, pdbDatabase) |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
42 mol = Molecule(pdbFile) |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
43 seq = mol.getSequence(pdbChain) |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
44 with open(fastaFile, "w") as fasta: |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
45 fasta.write(">%s\n" % identifier) |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
46 fasta.write("%s" % seq) |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
47 system("psiblast -query %s -db %s -out %s" % (fastaFile, databaseFile, resultFile)) |
37
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
48 maxMatch = None |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
49 try: |
39
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
50 with open(resultFile) as file: |
37
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
51 for i in range(38): |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
52 line = next(file) |
39
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
53 columns = line.split() |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
54 maxMatch = getId(columns[0]) |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
55 maxScore = float(columns[2]) |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
56 if maxScore > evalue: |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
57 return None |
37
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
58 except Exception: |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
59 return None |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
60 return maxMatch |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
61 |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
62 |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
63 def main(args): |
39
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
64 if not isdir("temp"): |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
65 mkdir("temp") |
37
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
66 logFile = open(args.log, "w") |
39
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
67 templateSequenceFile = "temp/templates.fasta" |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
68 pdbDatabase = DBKit(args.index, args.database) |
37
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
69 templates = set() |
39
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
70 with open(args.list) as file: |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
71 for rawId in file: |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
72 templateId = getId(rawId) |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
73 templates.add(templateId) |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
74 if not isfile(templateSequenceFile): |
37
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
75 templateSequences = open(templateSequenceFile, "w") |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
76 with open(args.list) as file: |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
77 for rawId in file: |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
78 templateId = getId(rawId) |
39
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
79 pdbFile, pdbChain = getPDB(templateId, pdbDatabase) |
37
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
80 try: |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
81 templateMol = Molecule(pdbFile) |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
82 templateSeq = templateMol.getSequence(pdbChain) |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
83 templateSequences.write(">%s\n" % templateId) |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
84 templateSequences.write("%s\n" % templateSeq) |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
85 except Exception: |
39
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
86 logFile.write("Warning: File not found [%s].\n" % templateId) |
37
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
87 templateSequences.close() |
39
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
88 system("makeblastdb -in %s -dbtype prot" % templateSequenceFile) |
37
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
89 else: |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
90 logFile.write("Using existing sequences for templates [%s].\n" % templateSequenceFile) |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
91 logFile.write("Found %s template entries from `%s`.\n" % (len(templates), args.list)) |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
92 logFile.flush() |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
93 |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
94 crossReference = list() |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
95 with open(args.cross) as file: |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
96 for line in file: |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
97 cols = line.split() |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
98 if len(cols) != 2: |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
99 raise Exception("Invalid line in crossreference [%s]." % line) |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
100 crossReference.append(dict(core=cols[0], partner=cols[1])) |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
101 logFile.write("Loaded crossreference with %d entries.\n" % len(crossReference)) |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
102 logFile.flush() |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
103 |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
104 for refEntry in crossReference: |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
105 coreId = refEntry["core"] |
39
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
106 logFile.write("Processing %s.\n" % coreId) |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
107 coreMatch = findMatch(coreId, templates, templateSequenceFile, pdbDatabase, evalue=args.evalue) |
37
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
108 partnerId = refEntry["partner"] |
39
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
109 logFile.write("Processing %s.\n" % partnerId) |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
110 partnerMatch = findMatch(partnerId, templates, templateSequenceFile, pdbDatabase, evalue=args.evalue) |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
111 if partnerMatch is None or coreMatch is None: |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
112 logFile.write("Warning: Failed alignment [%s, %s].\n" % (coreId, partnerId)) |
37
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
113 else: |
39
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
114 logFile.write("Found matching entries [%s, %s].\n" % (coreMatch, partnerMatch)) |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
115 refEntry["coreMatch"] = coreMatch |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
116 refEntry["partnerMatch"] = partnerMatch |
37
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
117 logFile.flush() |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
118 |
39
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
119 entryCount = 0 |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
120 with open(args.output, 'w') as output_file: |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
121 for refEntry in crossReference: |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
122 coreId = refEntry["core"] |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
123 partnerId = refEntry["partner"] |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
124 if "coreMatch" in refEntry and "partnerMatch" in refEntry: |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
125 entry = "%s\t%s\t%s\t%s\n" % (refEntry["coreMatch"], refEntry["partnerMatch"], refEntry["core"], refEntry["partner"]) |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
126 output_file.write(entry) |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
127 entryCount = entryCount + 1 |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
128 else: |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
129 logFile.write("Warning: Skipping failed missing partner match [%s, %s].\n" % (coreId, partnerId)) |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
130 logFile.write("Found %s cross reference entries.\n" % entryCount) |
37
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
131 logFile.close() |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
132 |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
133 |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
134 if __name__ == "__main__": |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
135 parser = argparse.ArgumentParser(description='Maps binding partners to template library') |
38
80a4b98121b6
"planemo upload commit 22cd6b0fa88ce0ddc4052beab306f5ba10754f12"
guerler
parents:
37
diff
changeset
|
136 parser.add_argument('-l', '--list', help='List of template entries `PDB_CHAIN`', required=True) |
39
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
137 parser.add_argument('-i', '--index', help='PDB Database Index file (ffindex)', required=True) |
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
138 parser.add_argument('-d', '--database', help='PDB Database files (ffdata)', required=True) |
37
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
139 parser.add_argument('-c', '--cross', help='Cross reference (unmapped)', required=True) |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
140 parser.add_argument('-o', '--output', help='Cross reference', required=True) |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
141 parser.add_argument('-g', '--log', help='Log File', required=True) |
39
172398348efd
"planemo upload commit 26b4018c88041ee0ca7c2976e0a012015173d7b6-dirty"
guerler
parents:
38
diff
changeset
|
142 parser.add_argument('-e', '--evalue', help='e-Value threshold', type=float, default=0.0) |
37
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
143 args = parser.parse_args() |
0be0af9e695d
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
guerler
parents:
diff
changeset
|
144 main(args) |