forked from sanger-pathogens/Artemis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
art
executable file
·159 lines (135 loc) · 5.36 KB
/
art
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#!/bin/bash -
#
# This script will start Artemis on a UNIX system.
#
QUIET=no
usage () {
echo "SYNOPSIS"
echo " Artemis: Genome Browser and Annotation Tool"
echo "USAGE"
echo " $0 [options] <SEQUENCE_FILE> [+FEATURE_FILE ...]"
echo "OPTIONS"
echo " SEQUENCE_FILE An EMBL, GenBank, FASTA, or GFF3 file"
echo " FEATURE_FILE An Artemis TAB file, or GFF file"
echo
echo " -options FILE Read a text file of options from FILE"
echo " -chado Connect to a Chado database (using PGHOST, PGPORT, PGDATABASE, PGUSER environment variables)"
echo
echo " -Dblack_belt_mode=? Keep warning messages to a minimum [true,false]"
echo " -Doffset=XXX Open viewer at base position XXX [integer >= 1]"
echo " -Duserplot=FILE[,FILE2] Open one or more userplots"
echo " -Dloguserplot=FILE[,FILE2] Open one or more userplots, take log(data)"
echo " -Dbam=FILE[,FILE2,...] Open one or more BAM, CRAM, VCF or BCF files"
echo " -DbamClone=n Open all BAM, CRAM, VCF or BCF files in multiple (n > 1) panels"
echo " -Dbam[1,2,..]=FILE[,FILE2,..] Open BAM, CRAM, VCF or BCF files in separate panels"
echo " -Dshow_snps Show SNP marks in BamView"
echo " -Dshow_snp_plot Open SNP plot in BamView"
echo " -Dshow_cov_plot Open coverage plot in BamView"
echo " -Dshow_forward_lines=? Hide/show forward frame lines [true,false]"
echo " -Dshow_reverse_lines=? Hide/show reverse frame lines [true,false]"
echo " -Dchado=\"h:p/d?u\" Get Artemis to open this CHADO database"
echo " -Dread_only Open CHADO database read-only"
echo "EXAMPLES"
echo " % art AJ006275.embl"
echo " % art contigs.fa +annotation.gff +islands.tab"
echo " % art -Dblack_belt_mode=true -Dbam=ecoli_hiseq.bam E_coli_K12.gbk"
echo " % art -Duserplot=repeatmap.plot,geecee.plot Plasmid.gff3"
echo "HOMEPAGE"
echo " http://www.sanger.ac.uk/science/tools/artemis"
echo
exit 1
}
add_proxy_properties() {
if [[ "$http_proxy" = "" ]]
then
http_proxy=$HTTP_PROXY
fi
if [[ "$http_proxy" = "" ]]
then
http_proxy=$HTTP_proxy
fi
if [[ "$http_proxy" != "" ]]
then
APPLICATION_PROPERTIES="$APPLICATION_PROPERTIES -DproxySet=true "`echo $http_proxy | sed 's/http:\/\/\(.*\):\(.*\)/ -Dhttp.proxyHost=\1 -Dhttp.proxyPort=\2/'`
fi
}
#
# Resolve script path (inc symlinks)
#
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
APPLICATION_HOME="$( cd -P "$( dirname "$SOURCE" )" && pwd )"; # get final path of this script
# Special Sanger override on chado PGUSER
if [[ "$ARTEMIS_SANGER_DBUSER" != "" ]]
then
export PGUSER=$ARTEMIS_SANGER_DBUSER
fi
#
# Parse arguments.
#
APPLICATION_PROPERTIES="-Djdbc.drivers=org.postgresql.Driver -Dartemis.environment=UNIX $SANGER_ARTEMIS_OPTIONS"
while test $# != 0
do
case $1 in
-options) APPLICATION_PROPERTIES="$APPLICATION_PROPERTIES -Dextra_options=$2"; shift ;;
-chado) APPLICATION_PROPERTIES="$APPLICATION_PROPERTIES -Dchado=$PGHOST:$PGPORT/$PGDATABASE?$PGUSER -Dibatis" ;;
-D*) APPLICATION_PROPERTIES="$APPLICATION_PROPERTIES $1" ;;
-quiet) QUIET=yes ; APPLICATION_PROPERTIES="$APPLICATION_PROPERTIES -Drun_quietly=true" ;;
-help) usage ;;
--help) usage ;;
-h) usage ;;
*) break ;;
esac
shift
done
JAR_NAME=artemis.jar
JAR_FILE_DEFAULT=$APPLICATION_HOME/target/jars/$JAR_NAME
JAR_FILE_INSTALLED=$APPLICATION_HOME/dist/$JAR_NAME
ARTEMIS_CP=$APPLICATION_HOME:$JAR_FILE_DEFAULT:$JAR_FILE_INSTALLED
#
# Use a custom Java version if necessary
#
if [[ "$ARTEMIS_JAVA_JRE" = "" ]]
then
JAVA=`which java`
else
JAVA_HOME=$ARTEMIS_JAVA_JRE
JAVA=$ARTEMIS_JAVA_JRE/bin/java
fi
#
# Allow URLs to work from behind firewalls.
#
add_proxy_properties
#
# "-mx2g" sets the maximum amount of memory to use.
# This may need to be increased when dealing with large files
#
if [[ "$ARTEMIS_JVM_FLAGS" = "" ]]
then
FLAGS="-mx2g -ms100m -noverify"
else
FLAGS="$ARTEMIS_JVM_FLAGS -noverify"
fi
#
# Temporary flags to avoid Java 9+ reflection warnings being written to the terminal.
# Should not be necessary when Ibatis is replaced.
#
FLAGS="$FLAGS --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED"
PLATTMP=`uname`
if [[ "$PLATTMP" = "Darwin" ]]
then
APPLICATION_PROPERTIES="$APPLICATION_PROPERTIES -Dapple.laf.useScreenMenuBar=true -Xdock:name=Artemis"
JAR_FILE_MACAPP=$APPLICATION_HOME/Java/$JAR_NAME
ARTEMIS_CP="$JAR_FILE_MACAPP:$ARTEMIS_CP"
fi
if [[ "$QUIET" = "no" ]]
then
echo "Starting Artemis with arguments: $FLAGS $APPLICATION_PROPERTIES $*"
fi
$JAVA $FLAGS $APPLICATION_PROPERTIES -cp "$ARTEMIS_CP" uk.ac.sanger.artemis.components.ArtemisMain $*
result=$?
exit $result