Mercurial > repos > earlhaminst > blast_parser
annotate blast_parser.py @ 4:363f3480622d draft default tip
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
author | earlhaminst |
---|---|
date | Thu, 12 Oct 2017 07:25:29 -0400 |
parents | 70df762b48a8 |
children |
rev | line source |
---|---|
3
70df762b48a8
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 32272744ad83a704fd427b48aae574496a279901-dirty
earlhaminst
parents:
diff
changeset
|
1 """ |
70df762b48a8
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 32272744ad83a704fd427b48aae574496a279901-dirty
earlhaminst
parents:
diff
changeset
|
2 Simple parser to convert a BLAST 12-column or 24-column tabular output into a |
70df762b48a8
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 32272744ad83a704fd427b48aae574496a279901-dirty
earlhaminst
parents:
diff
changeset
|
3 3-column tabular input for hcluster_hg (id1, id2, weight): |
70df762b48a8
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 32272744ad83a704fd427b48aae574496a279901-dirty
earlhaminst
parents:
diff
changeset
|
4 """ |
70df762b48a8
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 32272744ad83a704fd427b48aae574496a279901-dirty
earlhaminst
parents:
diff
changeset
|
5 import argparse |
70df762b48a8
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 32272744ad83a704fd427b48aae574496a279901-dirty
earlhaminst
parents:
diff
changeset
|
6 import math |
4
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
7 import sqlite3 |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
8 import tempfile |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
9 |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
10 BATCH_SIZE = 2000 |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
11 |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
12 |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
13 def create_tables(conn): |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
14 cur = conn.cursor() |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
15 cur.execute('''CREATE TABLE alignment ( |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
16 id INTEGER PRIMARY KEY, |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
17 sequence1_id VARCHAR NOT NULL, |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
18 sequence2_id VARCHAR NOT NULL, |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
19 weight INTEGER NOT NULL)''') |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
20 conn.commit() |
3
70df762b48a8
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 32272744ad83a704fd427b48aae574496a279901-dirty
earlhaminst
parents:
diff
changeset
|
21 |
70df762b48a8
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 32272744ad83a704fd427b48aae574496a279901-dirty
earlhaminst
parents:
diff
changeset
|
22 |
70df762b48a8
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 32272744ad83a704fd427b48aae574496a279901-dirty
earlhaminst
parents:
diff
changeset
|
23 def main(): |
70df762b48a8
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 32272744ad83a704fd427b48aae574496a279901-dirty
earlhaminst
parents:
diff
changeset
|
24 parser = argparse.ArgumentParser() |
70df762b48a8
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 32272744ad83a704fd427b48aae574496a279901-dirty
earlhaminst
parents:
diff
changeset
|
25 parser.add_argument('-i', metavar='in-file', type=argparse.FileType('rt'), required=True, help='Path to input file') |
70df762b48a8
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 32272744ad83a704fd427b48aae574496a279901-dirty
earlhaminst
parents:
diff
changeset
|
26 parser.add_argument('-o', metavar='out-file', type=argparse.FileType('wt'), required=True, help='Path to output file') |
70df762b48a8
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 32272744ad83a704fd427b48aae574496a279901-dirty
earlhaminst
parents:
diff
changeset
|
27 parser.add_argument('-r', action='store_true', default=False, |
70df762b48a8
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 32272744ad83a704fd427b48aae574496a279901-dirty
earlhaminst
parents:
diff
changeset
|
28 dest='reciprocal', |
70df762b48a8
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 32272744ad83a704fd427b48aae574496a279901-dirty
earlhaminst
parents:
diff
changeset
|
29 help='Annotate homolog pair') |
70df762b48a8
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 32272744ad83a704fd427b48aae574496a279901-dirty
earlhaminst
parents:
diff
changeset
|
30 options = parser.parse_args() |
70df762b48a8
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 32272744ad83a704fd427b48aae574496a279901-dirty
earlhaminst
parents:
diff
changeset
|
31 |
4
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
32 db_file = tempfile.NamedTemporaryFile(suffix=".sqlite") |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
33 |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
34 conn = sqlite3.connect(db_file.name) |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
35 conn.execute('PRAGMA foreign_keys = ON') |
3
70df762b48a8
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 32272744ad83a704fd427b48aae574496a279901-dirty
earlhaminst
parents:
diff
changeset
|
36 |
4
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
37 create_tables(conn) |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
38 |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
39 cur = conn.cursor() |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
40 |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
41 i = 0 |
3
70df762b48a8
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 32272744ad83a704fd427b48aae574496a279901-dirty
earlhaminst
parents:
diff
changeset
|
42 for line in options.i: |
70df762b48a8
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 32272744ad83a704fd427b48aae574496a279901-dirty
earlhaminst
parents:
diff
changeset
|
43 line = line.rstrip() |
70df762b48a8
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 32272744ad83a704fd427b48aae574496a279901-dirty
earlhaminst
parents:
diff
changeset
|
44 line_cols = line.split('\t') |
70df762b48a8
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 32272744ad83a704fd427b48aae574496a279901-dirty
earlhaminst
parents:
diff
changeset
|
45 sequence1_id = line_cols[0] |
70df762b48a8
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 32272744ad83a704fd427b48aae574496a279901-dirty
earlhaminst
parents:
diff
changeset
|
46 sequence2_id = line_cols[1] |
70df762b48a8
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 32272744ad83a704fd427b48aae574496a279901-dirty
earlhaminst
parents:
diff
changeset
|
47 |
70df762b48a8
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 32272744ad83a704fd427b48aae574496a279901-dirty
earlhaminst
parents:
diff
changeset
|
48 # Ignore self-matching hits |
4
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
49 if sequence1_id == sequence2_id: |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
50 continue |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
51 |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
52 i = i + 1 |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
53 evalue = float(line_cols[10]) |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
54 |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
55 # Convert evalue to an integer weight with max 100 |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
56 if evalue != 0.0: |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
57 weight = min(100, round(math.log10(evalue) / -2.0)) |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
58 else: |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
59 # If the evalue is 0, leave weight at 100 |
3
70df762b48a8
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 32272744ad83a704fd427b48aae574496a279901-dirty
earlhaminst
parents:
diff
changeset
|
60 weight = 100 |
70df762b48a8
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 32272744ad83a704fd427b48aae574496a279901-dirty
earlhaminst
parents:
diff
changeset
|
61 |
4
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
62 cur.execute('INSERT INTO alignment (id, sequence1_id, sequence2_id, weight) VALUES (?, ?, ?, ?)', |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
63 (i, sequence1_id, sequence2_id, weight)) |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
64 |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
65 # Commit transaction at every BATCH_SIZE rows to save memory |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
66 if i % BATCH_SIZE == 0: |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
67 conn.commit() |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
68 # Commit final transaction |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
69 conn.commit() |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
70 options.i.close() |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
71 |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
72 # Delete alternative alignments keeping only one with max weight |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
73 cur.execute('DELETE FROM alignment WHERE id NOT IN (SELECT id FROM alignment GROUP BY sequence1_id, sequence2_id HAVING weight=max(weight))') |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
74 conn.commit() |
3
70df762b48a8
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 32272744ad83a704fd427b48aae574496a279901-dirty
earlhaminst
parents:
diff
changeset
|
75 |
4
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
76 if options.reciprocal: |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
77 query = 'SELECT a1.sequence1_id, a1.sequence2_id, a1.weight FROM alignment a1, alignment a2 WHERE a1.sequence1_id = a2.sequence2_id AND a1.sequence2_id = a2.sequence1_id ORDER BY a1.id' |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
78 else: |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
79 query = 'SELECT sequence1_id, sequence2_id, weight FROM alignment ORDER BY id' |
3
70df762b48a8
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 32272744ad83a704fd427b48aae574496a279901-dirty
earlhaminst
parents:
diff
changeset
|
80 |
4
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
81 cur.execute(query) |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
82 while True: |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
83 rows = cur.fetchmany(BATCH_SIZE) |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
84 if not rows: |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
85 break |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
86 for row in rows: |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
87 options.o.write("%s\t%s\t%d\n" % row) |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
88 |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
89 conn.close() |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
90 db_file.close() |
363f3480622d
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 598e396ffaf5834a1c8f32868b1568a2b48a0a78-dirty
earlhaminst
parents:
3
diff
changeset
|
91 options.o.close() |
3
70df762b48a8
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 32272744ad83a704fd427b48aae574496a279901-dirty
earlhaminst
parents:
diff
changeset
|
92 |
70df762b48a8
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 32272744ad83a704fd427b48aae574496a279901-dirty
earlhaminst
parents:
diff
changeset
|
93 |
70df762b48a8
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 32272744ad83a704fd427b48aae574496a279901-dirty
earlhaminst
parents:
diff
changeset
|
94 if __name__ == "__main__": |
70df762b48a8
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/blast_parser commit 32272744ad83a704fd427b48aae574496a279901-dirty
earlhaminst
parents:
diff
changeset
|
95 main() |