Skip to content

Commit

Permalink
[ci skip] Merge PR 36787
Browse files Browse the repository at this point in the history
Merge PR #36787, commits were: 
 * fix quote
 * quiet down curl
 * update patch files for v2
 * Update sra-human-scrubber to 2.0.0
 * Update sra-human-scrubber to 1.1.0
  • Loading branch information
BiocondaBot authored Sep 19, 2022
1 parent c5e7e4e commit 5384883
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 40 deletions.
27 changes: 10 additions & 17 deletions recipes/sra-human-scrubber/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
#!/bin/bash

# Setup shared directory
SHARE_DIR="${PREFIX}/share/${PKG_NAME}-${PKG_VERSION}"
mkdir -p ${SHARE_DIR}/data
cp -r ./test ${SHARE_DIR}/
touch ${SHARE_DIR}/data/sra-human-scrubber-placeholder.txt

# Replace with share directory path
sed -i "s=BIOCONDA_SED_REPLACE=$SHARE_DIR=" init_db.sh
sed -i "s=BIOCONDA_SED_REPLACE=$SHARE_DIR=" scripts/scrub.sh

# Add scripts
mkdir -p ${PREFIX}/bin
chmod 755 bin/*
Expand All @@ -8,20 +18,3 @@ chmod 755 scripts/*
cp scripts/* ${PREFIX}/bin
chmod 755 init_db.sh
cp init_db.sh ${PREFIX}/bin

# Setup shared directory
SHARE_DIR="${PREFIX}/share/${PKG_NAME}-${PKG_VERSION}"
mkdir -p ${SHARE_DIR}/data
cp -r ./test ${SHARE_DIR}/
touch ${SHARE_DIR}/data/sra-human-scrubber-placeholder.txt

# Setup the VADR env variables
mkdir -p ${PREFIX}/etc/conda/activate.d ${PREFIX}/etc/conda/deactivate.d
echo "export SCRUBBER_ROOT=${PREFIX}" > ${PREFIX}/etc/conda/activate.d/sra-human-scrubber.sh
echo "export SCRUBBER_SHARE=${SHARE_DIR}" >> ${PREFIX}/etc/conda/activate.d/sra-human-scrubber.sh
chmod a+x ${PREFIX}/etc/conda/activate.d/sra-human-scrubber.sh

# Unset them
echo "unset SCRUBBER_ROOT" > ${PREFIX}/etc/conda/deactivate.d/sra-human-scrubber.sh
echo "unset SCRUBBER_SHARE" >> ${PREFIX}/etc/conda/deactivate.d/sra-human-scrubber.sh
chmod a+x ${PREFIX}/etc/conda/deactivate.d/sra-human-scrubber.sh
15 changes: 11 additions & 4 deletions recipes/sra-human-scrubber/fix_init_db_path.patch
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
diff --git a/init_db.sh b/init_db.sh
index 54abf86..435351a 100755
index de67e29..03a69c5 100755
--- a/init_db.sh
+++ b/init_db.sh
@@ -1,5 +1,5 @@
@@ -1,7 +1,10 @@
#!/bin/bash
set -eu

-curl -vf "https://ftp.ncbi.nlm.nih.gov/sra/dbs/human_filter.db" -o ./data/human_filter.db
+curl -vf "https://ftp.ncbi.nlm.nih.gov/sra/dbs/human_filter.db" -o ${SCRUBBER_SHARE}/data/human_filter.db
+SCRUBBER_SHARE=BIOCONDA_SED_REPLACE
VERSION=$(curl "https://ftp.ncbi.nlm.nih.gov/sra/dbs/human_filter/current/version.txt")
-cd data && curl -vf "https://ftp.ncbi.nlm.nih.gov/sra/dbs/human_filter/${VERSION}.human_filter.db" -o "${VERSION}.human_filter.db"
-ln -s "${VERSION}".human_filter.db human_filter.db
+cd ${SCRUBBER_SHARE}/data && \
+ curl -f "https://ftp.ncbi.nlm.nih.gov/sra/dbs/human_filter/${VERSION}.human_filter.db" -o "${VERSION}.human_filter.db" &&
+ ln -s -f "${VERSION}".human_filter.db human_filter.db
+
exit 0

50 changes: 35 additions & 15 deletions recipes/sra-human-scrubber/fix_scrub_path.patch
Original file line number Diff line number Diff line change
@@ -1,28 +1,48 @@
diff --git a/scripts/scrub.sh b/scripts/scrub.sh
index fc2f35c..1fdfaab 100755
index f6b310c..6848a94 100755
--- a/scripts/scrub.sh
+++ b/scripts/scrub.sh
@@ -27,17 +27,17 @@ done
shift $((OPTIND-1))
fastq="$1"
@@ -27,7 +27,8 @@ RUNTEST=false
THREADS=
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
-ROOT=$(dirname $DIR)
ROOT=$(dirname $DIR)
-DB=$ROOT/data/human_filter.db
+ROOT=${SCRUBBER_ROOT}
+SCRUBBER_SHARE=BIOCONDA_SED_REPLACE
+DB=${SCRUBBER_SHARE}/data/human_filter.db

-if [ "$1" == "test" ] && [ -e "$ROOT/test/scrubber_test.fastq" ];
+if [ "$1" == "test" ] && [ -e "${SCRUBBER_SHARE}/test/scrubber_test.fastq" ];
#Get input
while getopts ":i:o:d:p:hxrt" opts; do
@@ -65,10 +66,10 @@ if [ "$INFILE" == "test" ];
fi

#TESTING create temp dir and set infile
-if $RUNTEST && [ -e "$ROOT/test/scrubber_test.fastq" ];
+if $RUNTEST && [ -e "${SCRUBBER_SHARE}/test/scrubber_test.fastq" ];
then
TMP_DIR=$(mktemp -d)
- cp "$ROOT"/test/* "$TMP_DIR/"
+ cp "${SCRUBBER_SHARE}"/test/* "$TMP_DIR/"
fastq=$TMP_DIR/scrubber_test.fastq
INFILE=$TMP_DIR/scrubber_test.fastq
fi

@@ -85,17 +86,17 @@ if [ ! -e "${INFILE}" ];
INFILE="$TMP_F_DIR/temp.fastq"
fi
-python "$ROOT/scripts/fastq_to_fasta.py" < "$fastq" > "$fastq.fasta"
-${ROOT}/bin/aligns_to -db "$ROOT/data/human_filter.db" "$fastq.fasta" | "$ROOT/scripts/cut_spots_fastq.py" "$fastq" ${OPTS} > "$fastq.clean"
+fastq_to_fasta.py < "$fastq" > "$fastq.fasta"
+aligns_to -db "${DB}" "$fastq.fasta" | cut_spots_fastq.py "$fastq" ${OPTS} > "$fastq.clean"
if [ "$1" == "test" ];
#Use infile or temp fastq and generate fasta
-"$ROOT/scripts/fastq_to_fasta.py" < "${INFILE}" > "$TMP_F_DIR/temp.fasta"
+fastq_to_fasta.py < "${INFILE}" > "$TMP_F_DIR/temp.fasta"
if [ "$OUTFILE" ] && [ "$OUTFILE" != "-" ];
then
if [ -e "$TMP_DIR/scrubber_test.fastq.clean" ] &&
- "${ROOT}"/bin/aligns_to -db "${DB}" $(if [[ "$THREADS" =~ ^[0-9]+$ ]]; then printf "%s" "-num_threads $THREADS"; fi) "$TMP_F_DIR/temp.fasta" | "$ROOT/scripts/cut_spots_fastq.py" "$INFILE" "$REPLACEN" "$SAVEIDSPOTS" > "$OUTFILE"
+ aligns_to -db "${DB}" $(if [[ "$THREADS" =~ ^[0-9]+$ ]]; then printf "%s" "-num_threads $THREADS"; fi) "$TMP_F_DIR/temp.fasta" | cut_spots_fastq.py "$INFILE" "$REPLACEN" "$SAVEIDSPOTS" > "$OUTFILE"
if [ "$SAVEIDSPOTS" ] && [ -e "$TMP_F_DIR/temp.fastq.removed_spots" ];
then
cp "$TMP_F_DIR/temp.fastq.removed_spots" "$OUTFILE.removed_spots"
fi
else
- "${ROOT}"/bin/aligns_to -db "${DB}" $(if [[ "$THREADS" =~ ^[0-9]+$ ]]; then printf "%s" "-num_threads $THREADS"; fi) "$TMP_F_DIR/temp.fasta" | "$ROOT/scripts/cut_spots_fastq.py" "$INFILE" "$REPLACEN"
+ aligns_to -db "${DB}" $(if [[ "$THREADS" =~ ^[0-9]+$ ]]; then printf "%s" "-num_threads $THREADS"; fi) "$TMP_F_DIR/temp.fasta" | cut_spots_fastq.py "$INFILE" "$REPLACEN"
fi

#Check if TESTING was successful
4 changes: 2 additions & 2 deletions recipes/sra-human-scrubber/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@

{% set name = "sra-human-scrubber" %}
{% set version = "1.0.2021_05_05" %}
{% set version = "2.0.0" %}

package:
name: {{ name }}
version: {{ version }}

source:
- url: https://github.com/ncbi/{{ name }}/archive/refs/tags/{{ version|replace("_", "-") }}.tar.gz
sha256: ccedb2c253e8db560a08c2f78139c50f84eb2bb5870914a23b7007f920969fe4
sha256: c4c9078325b01c7aa8bc0bcdee37f2b102880d66e478d19858eef1f00056d435
patches:
- fix_scrub_path.patch
- fix_init_db_path.patch
Expand Down
2 changes: 0 additions & 2 deletions recipes/sra-human-scrubber/post-link.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@

echo "
Please run 'init_db.sh' to download the database required to run sra-human-scrubber.
These files will be downloaded to ${SCRUBBER_SHARE}/data.
" >> ${PREFIX}/.messages.txt
printf '%s\n' "${URLS[@]}" >> "${PREFIX}/.messages.txt" 2>&1

0 comments on commit 5384883

Please sign in to comment.