forked from pcingola/SnpEff
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildDbNcbi.sh
executable file
·51 lines (40 loc) · 1.05 KB
/
buildDbNcbi.sh
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
#!/bin/sh -e
#-------------------------------------------------------------------------------
#
# Download a GenBank file form NCBI and build the corresponding SnpEff database
#
# Note: It is assumed to be run form SnpEff's directory and that
# the 'data' directory is 'data'
#
# Usage example:
# $ cd ~/snpEff
# $ ./scripts/buildDbNcbi.sh CP000724.1
#
# Pablo Cingolani 2015
#-------------------------------------------------------------------------------
#---
# Command line arguments
#---
ID=$1
if [ -z "$ID" ]
then
echo "Usage: $0 ncbi_genbank_accession"
exit 1
fi
DIR="data/$ID"
GENE_FILE="$DIR/genes.gbk"
#---
# Download data
#---
# Create db directory
mkdir -p "$DIR" >/dev/null 2>&1 || true
# Download GenBank file
echo "Downloading genome $ID"
curl "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nucleotide&id=$ID&rettype=gbwithparts&retmode=text" > $GENE_FILE
#---
# Build database
#---
# Add entry to config file
echo "$ID.genome : $ID" >> snpEff.config
# Build database
java -jar snpEff.jar build -v $ID