-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.py
72 lines (58 loc) · 1.65 KB
/
update.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import logging
import argparse
from argparse import RawTextHelpFormatter
from ftplib import FTP
import localgb
parser = argparse.ArgumentParser(
description='Create or update a local mirror of GenBank flat files',
formatter_class=RawTextHelpFormatter
)
parser.add_argument(
"-v", "--verbosity", action="count", help="increase output verbosity"
)
parser.add_argument(
"-d", "--divisions", nargs='*', required=True,
help="""
space-separated list of the divisions you want to download. Valid divisions
are:
Organismal divisions
BCT Bacterial sequences
PRI Primate sequences
ROD Rodent sequences
MAM Other mammalian sequences
VRT Other vertebrate sequences
INV Invertebrate sequences
PLN Plant sequences
VRL Viral sequences
PHG Phage sequences
RNA Structural RNA sequences
SYN Synthetic and chimeric sequences
UNA Unannotated sequences
ENV Environmental samples
Functional Divisions
EST Expressed sequence tags
STS Sequence tagged sites
GSS Genome survey sequences
HTG High throughput genomic sequences
HTC High throughput cDNA
PAT Patent sequences
TSA Transcriptome shotgun data
"""
)
parser.add_argument(
"--force",
action="store_true",
help="delete existing files and download the current release even if your\
copy is up to date"
)
args = parser.parse_args()
args.divisions = [d.upper() for d in args.divisions]
if args.verbosity is None:
logging.basicConfig(level=logging.INFO)
elif args.verbosity > 0:
logging.basicConfig(level=logging.DEBUG)
if localgb.need_to_update_release() or args.force:
localgb.delete_old_files()
localgb.do_update_release(args.divisions)
localgb.get_daily_updates()
localgb.get_taxdump()