comparison GAFA.py @ 7:b9f1bcf5ee59 draft default tip

planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/GAFA/ commit fa875eea77a9471acada2b7b8882a0467994c960
author earlhaminst
date Wed, 25 Apr 2018 10:59:55 -0400
parents 117fc7414307
children
comparison
equal deleted inserted replaced
6:c15476d4271c 7:b9f1bcf5ee59
5 import re 5 import re
6 import shutil 6 import shutil
7 import sqlite3 7 import sqlite3
8 8
9 version = "0.3.0" 9 version = "0.3.0"
10 compatible_version = ['0.3.0', '0.4.0']
10 11
11 Sequence = collections.namedtuple('Sequence', ['header', 'sequence']) 12 Sequence = collections.namedtuple('Sequence', ['header', 'sequence'])
12 13
13 14
14 def FASTAReader_gen(fasta_filename): 15 def FASTAReader_gen(fasta_filename):
52 cur = conn.cursor() 53 cur = conn.cursor()
53 # Check that the version of the input database is compatible 54 # Check that the version of the input database is compatible
54 cur.execute('SELECT version FROM meta') 55 cur.execute('SELECT version FROM meta')
55 result = cur.fetchone() 56 result = cur.fetchone()
56 input_meta_version = result[0] 57 input_meta_version = result[0]
57 if input_meta_version != '0.3.0': 58 if input_meta_version not in compatible_version:
58 raise Exception("Incompatible input meta version '%s'" % input_meta_version) 59 raise Exception("Incompatible input meta version '%s'" % input_meta_version)
59 cur.execute('UPDATE meta SET version=?', 60 cur.execute('UPDATE meta SET version=?',
60 (version, )) 61 (version, ))
61 62
62 cur.execute('''CREATE TABLE gene_family ( 63 cur.execute('''CREATE TABLE gene_family (
66 cur.execute('''CREATE TABLE gene_family_member ( 67 cur.execute('''CREATE TABLE gene_family_member (
67 gene_family_id INTEGER NOT NULL REFERENCES gene_family(gene_family_id), 68 gene_family_id INTEGER NOT NULL REFERENCES gene_family(gene_family_id),
68 protein_id VARCHAR KEY NOT NULL REFERENCES transcript(protein_id), 69 protein_id VARCHAR KEY NOT NULL REFERENCES transcript(protein_id),
69 protein_alignment VARCHAR NOT NULL, 70 protein_alignment VARCHAR NOT NULL,
70 PRIMARY KEY (gene_family_id, protein_id))''') 71 PRIMARY KEY (gene_family_id, protein_id))''')
72
71 conn.commit() 73 conn.commit()
72 74
73 75
74 def align_to_db(conn, i, fname): 76 def align_to_db(conn, i, fname):
75 cur = conn.cursor() 77 cur = conn.cursor()