-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathbuild_rmis_dna.sh
executable file
·54 lines (47 loc) · 1.64 KB
/
build_rmis_dna.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
51
52
53
54
#! /usr/bin/env bash
if ! command -v bwa-meme-train-prmi &> /dev/null
then
# bwa-meme-train-prmi command not found, should build it
# To build the command, RMI folder should exist
if [ ! -d RMI ]
then
# echo "ERROR:"
echo ERROR: BWA-MEME/RMI directory does not exist or run this script in BWA-MEME folder
exit 1
fi
# check Cargo exists
if ! command -v cargo &> /dev/null
then
echo "Command: cargo could not be found, please install cargo from https://rustup.rs/"
exit 1
fi
# build the binary
cd RMI && cargo build --release && cd ..
fi
if [ -z "$1" ]; then
echo "Usage: build_rmis_dna.sh <reference file>
ex) ./build_rmis_dna.sh ./human.fasta"
echo "About: RMI training script for BWA-MEME. Training requires about 15 minute with single thread"
exit 0
fi
if [ ! -f $1.suffixarray_uint64 ]
then
# echo "ERROR:"
echo "ERROR: suffixarray_uint64 file does not exists in `dirname $1`
Correct the path or build the suffixarray index first with command: bwa-meme index"
exit 1
fi
function build_rmi_set() {
DATA_PATH=$1
DATA_NAME=`basename $1`
DIR_NAME=`dirname $1`
shift 1
if ! command -v bwa-meme-train-prmi &> /dev/null
then
# RMI/target/release/bwa-meme-train-prmi --data-path $DIR_NAME $DATA_PATH $DATA_NAME pwl,linear,linear_spline 1024
RMI/target/release/bwa-meme-train-prmi --data-path $DIR_NAME $DATA_PATH $DATA_NAME pwl,linear,linear_spline 268435456
else
bwa-meme-train-prmi --data-path $DIR_NAME $DATA_PATH $DATA_NAME pwl,linear,linear_spline 268435456
fi
}
build_rmi_set $1.suffixarray_uint64