-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Vyacheslav Brover
committed
Aug 12, 2024
1 parent
bd54a96
commit a895521
Showing
1 changed file
with
17 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,34 @@ | ||
#!/bin/bash --noprofile | ||
THIS=`dirname $0` | ||
source $THIS/../bash_common.sh | ||
if [ $# -ne 2 ]; then | ||
if [ $# -ne 3 ]; then | ||
echo "Return: top 100 BLASTN hits in top strand" | ||
echo "#1; query DNA sequence" | ||
echo "#2: subject DNA BLAST database" | ||
echo "#3: subset of sequence id's or ''" | ||
exit 1 | ||
fi | ||
QUERY=$1 | ||
DB=$2 | ||
SUBSET=$3 | ||
|
||
|
||
TMP=`mktemp` | ||
TMP=$( mktemp ) | ||
#comment $TMP | ||
|
||
|
||
blastn -db $DB -query $QUERY -strand plus -task blastn -num_threads 5 -outfmt '6 sseqid nident' | sort -k 2 -n -r | cut -f 1 > $TMP | ||
head -100 $TMP | sort -u | ||
blastn -db $DB -query $QUERY -strand plus -task blastn -num_threads 5 -outfmt '6 sseqid nident' | sort -u > $TMP | ||
|
||
# $TMP -> $TMP.inter | ||
if [ $SUBSET ]; then | ||
sort -cu $SUBSET | ||
join -1 1 -2 1 $TMP $SUBSET | tr ' ' '\t' > $TMP.inter | ||
else | ||
mv $TMP $TMP.inter | ||
fi | ||
|
||
sort -k2nr $TMP.inter | cut -f 1 > $TMP.sorted | ||
head -100 $TMP.sorted | ||
|
||
|
||
rm $TMP* |