<commit_before>#!/bin/bash
# Copyright: NCBI 2017
# Author: <NAME>

if [ "$#" -ne 4 ]; then
	echo "Description: given a file containing SRA accessions and a BLAST database, this script runs Magic-BLAST" 
	echo "on each SRA accessions."
	BASENAME=`basename "$0"`
	echo "Usage: ${BASENAME} [SRA accessions file] [BLASTDB dir path] [BLAST database name] [output directory]"
	exit 0
fi

# Maximum number of concurrent Magic-BLAST runs at a time
MAX_PROCS=10

# Retrieve the command line arguments
SRA=$1
BLASTDB=$2
DB_NAME=$3
OUTPUT_DIR=$4
MAPPER_NO_OVERLAPPED_HSP_MERGED=1

export BLASTDB
# This prevents ambiguous splicing from occuring in Magic-BLAST
export MAPPER_NO_OVERLAPPED_HSP_MERGED

for ACC in $(cat ${SRA}); do
	OUTPUT_FILE=${OUTPUT_DIR}/${ACC}.mbo
	magicblast -sra ${ACC} -db ${DB_NAME} -outfmt tabular -out ${OUTPUT_FILE} &
	# Limit the number of child processes running so we don't overload the local computer
	while [ $(jobs | wc -l) -gt "${MAX_PROCS}" ]; do sleep 1; done
done

# Wait for all processes to finish before exiting
wait<commit_msg>modified magicblast.sh so that it doesn't need to know where the BLAST database was created<commit_after>#!/bin/bash
# Copyright: NCBI 2017
# Author: <NAME>

if [ "$#" -ne 3 ]; then
	echo "Description: given a file containing SRA accessions and a BLAST database, this script runs Magic-BLAST" 
	echo "on each SRA accessions."
	BASENAME=`basename "$0"`
	echo "Usage: ${BASENAME} [SRA accessions file] [BLAST database name] [output directory]"
	exit 0
fi

# Maximum number of concurrent Magic-BLAST runs at a time
MAX_PROCS=10

# Retrieve the command line arguments
SRA=$1
DB_NAME=$2
OUTPUT_DIR=$3

# This prevents ambiguous splicing from occuring in Magic-BLAST
export MAPPER_NO_OVERLAPPED_HSP_MERGED=1

for ACC in $(cat ${SRA}); do
	OUTPUT_FILE=${OUTPUT_DIR}/${ACC}.mbo
	magicblast -sra ${ACC} -db ${DB_NAME} -outfmt tabular -out ${OUTPUT_FILE} &
	# Limit the number of child processes running so we don't overload the local computer
	while [ $(jobs | wc -l) -gt "${MAX_PROCS}" ]; do sleep 1; done
done

# Wait for all processes to finish before exiting
wait
{'fraction_non_alphanumeric': 0.1049645390070922, 'fraction_numerical': 0.013711583924349883, 'mean_word_length': 4.861495844875346, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '185712', 'n_tokens_mistral': 768, 'n_tokens_neox': 688, 'n_words': 270}