예제 #1
0
    def test_deletion(self):
        db = update_vv_db.connect()
        initial_count = self.count_rows(db, 'LRG_transcripts')
        if initial_count > 0:
            pytest.skip(
                "Already have data so not going to run this test here.")
        db.insert_refseq_gene_data([
            'id', 'chr', 'genome', '0', '1', '1', '10', '2', '2', '1', 'hgnc',
            'False'
        ])

        count = self.count_rows(db, 'refSeqGene_loci')
        self.assertGreaterEqual(count, 1)

        update_vv_db.delete()
        db = update_vv_db.connect()
        for table in [
                'transcript_info', 'refSeqGene_loci', 'LRG_transcripts',
                'LRG_proteins', 'LRG_RSG_lookup'
        ]:
            print(table)
            count = self.count_rows(db, table)
            self.assertEqual(count, 0)
#! /usr/bin/env python

from VariantValidator import update_vv_db
import argparse

if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument('--delete', '-d', action='store_true', help='Delete the contents of the current database '
                                                                    'before updating')

    args = parser.parse_args()
    if args.delete:
        print("Deleting current database contents")
        update_vv_db.delete()

    update_vv_db.update()

# <LICENSE>
# Copyright (C) 2019 VariantValidator Contributors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License