forked from DerrickWood/kraken2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd_to_library.sh
executable file
·38 lines (29 loc) · 947 Bytes
/
add_to_library.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
#!/bin/bash
# Copyright 2013-2019, Derrick Wood <[email protected]>
#
# This file is part of the Kraken 2 taxonomic sequence classification system.
# Copy specified file into a Kraken library
set -u # Protect against uninitialized vars.
set -e # Stop on error
LIBRARY_DIR="$KRAKEN2_DB_NAME/library"
if [ ! -e "$1" ]
then
1>&2 echo "Can't add \"$1\": file does not exist"
exit 1
fi
if [ ! -f "$1" ]
then
1>&2 echo "Can't add \"$1\": not a regular file"
exit 1
fi
add_dir="$LIBRARY_DIR/added"
mkdir -p "$add_dir"
prelim_map=$(cp_into_tempfile.pl -t "prelim_map_XXXXXXXXXX" -d "$add_dir" -s txt /dev/null)
scan_fasta_file.pl "$1" > "$prelim_map"
filename=$(cp_into_tempfile.pl -t "XXXXXXXXXX" -d "$add_dir" -s fna "$1")
if [ -n "$KRAKEN2_MASK_LC" ]; then
1>&2 echo -n "Masking low-complexity regions of new file..."
mask_low_complexity.sh $filename
1>&2 echo " done."
fi
1>&2 echo "Added \"$1\" to library ($KRAKEN2_DB_NAME)"