Skip to content
Permalink
Browse files

Rework workflow to check for result file, fix sam issue with --alignm…

…ent-mode 4 #143
  • Loading branch information...
martin-steinegger committed Apr 13, 2019
1 parent 5884ed2 commit 5d41e6b3b5a2ae222898efb858b75aa4dd3bc19e
@@ -16,7 +16,7 @@ notExists() {
# check if files exists
[ ! -f "$1" ] && echo "$1 not found!" && exit 1;
[ ! -f "$2" ] && echo "$2 not found!" && exit 1;
[ -f "$3" ] && echo "$3 exists already!" && exit 1;
[ -f "$3.dbtype" ] && echo "$3 exists already!" && exit 1;
[ ! -d "$4" ] && echo "tmp directory $4 not found!" && mkdir -p "$4";


@@ -16,7 +16,7 @@ notExists() {
# check if files exists
[ ! -f "$1" ] && echo "$1 not found!" && exit 1;
[ ! -f "$2" ] && echo "$2 not found!" && exit 1;
[ -f "$3" ] && echo "$3 exists already!" && exit 1;
[ -f "$3.dbtype" ] && echo "$3 exists already!" && exit 1;
[ ! -d "$4" ] && echo "tmp directory $4 not found!" && mkdir -p "$4";


@@ -16,7 +16,7 @@ notExists() {
# check if files exists
[ ! -f "$1" ] && echo "$1 not found!" && exit 1;
[ ! -f "$2" ] && echo "$2 not found!" && exit 1;
[ -f "$3" ] && echo "$3 exists already!" && exit 1;
[ -f "$3.dbtype" ] && echo "$3 exists already!" && exit 1;
[ ! -d "$4" ] && echo "tmp directory $4 not found!" && mkdir -p "$4";

QUERYDB="$1"
@@ -12,7 +12,7 @@ notExists() {
[ "$#" -ne 3 ] && echo "Please provide <sequenceDB> <outDB> <tmp>" && exit 1;
# check if files exists
[ ! -f "$1" ] && echo "$1 not found!" && exit 1;
[ -f "$2" ] && echo "$2 exists already!" && exit 1;
[ -f "$2.dbtype" ] && echo "$2 exists already!" && exit 1;
[ ! -d "$3" ] && echo "tmp directory $3 not found!" && mkdir -p "$3";

INPUT="$1"
@@ -13,7 +13,7 @@ notExists() {
[ "$#" -ne 3 ] && echo "Please provide <sequenceDB> <outDB> <tmp>" && exit 1;
# check if files exists
[ ! -f "$1" ] && echo "$1 not found!" && exit 1;
[ -f "$2" ] && echo "$2 exists already!" && exit 1;
[ -f "$2.dbtype" ] && echo "$2 exists already!" && exit 1;
[ ! -d "$3" ] && echo "tmp directory $3 not found!" && mkdir -p "$3";

INPUT="$1"
@@ -18,7 +18,7 @@ notExists() {
[ ! -f "$2" ] && echo "$2 not found!" && exit 1;
[ ! -f "$3" ] && echo "$3 not found!" && exit 1;
[ ! -f "$4" ] && echo "$4 not found!" && exit 1;
[ -f "$5" ] && echo "$5 exists already!" && exit 1;
[ -f "$5.dbtype" ] && echo "$5 exists already!" && exit 1;
[ ! -d "$6" ] && echo "tmp directory $6 not found!" && mkdir -p "$6";

QUERYDB="$1"
@@ -11,7 +11,7 @@ notExists() {
[ "$#" -ne 3 ] && echo "Please provide <sequenceDB> <outDB> <tmp>" && exit 1;
# check if files exists
[ ! -f "$1" ] && echo "$1 not found!" && exit 1;
[ -f "$2" ] && echo "$2 exists already!" && exit 1;
[ -f "$2.dbtype" ] && echo "$2 exists already!" && exit 1;
[ ! -d "$3" ] && echo "tmp directory $3 not found!" && mkdir -p "$3";

INPUT="$1"
@@ -16,7 +16,7 @@ notExists() {
# check if files exists
[ ! -f "$1" ] && echo "$1 not found!" && exit 1;
[ ! -f "$2" ] && echo "$2 not found!" && exit 1;
[ -f "$3" ] && echo "$3 exists already!" && exit 1;
[ -f "$3.dbtype" ] && echo "$3 exists already!" && exit 1;
[ ! -d "$4" ] && echo "tmp directory $4 not found!" && mkdir -p "$4";

QUERY="$1"
@@ -3,7 +3,7 @@
[ "$#" -ne 4 ] && echo "Please provide <queryDB> <targetDB> <outDB> <tmp>" && exit 1;
[ ! -f "$1" ] && echo "$1 not found!" && exit 1;
[ ! -f "$2" ] && echo "$2 not found!" && exit 1;
[ -f "$3" ] && echo "$3 exists already!" && exit 1;
[ -f "$3.dbtype" ] && echo "$3 exists already!" && exit 1;
[ ! -d "$4" ] && echo "tmp directory $4 not found!" && mkdir -p "$4";

# shellcheck disable=SC2086
@@ -14,7 +14,7 @@ notExists() {
# check if files exists
[ ! -f "$1" ] && echo "$1 not found!" && exit 1;
[ ! -f "$2" ] && echo "$2 not found!" && exit 1;
[ -f "$3" ] && echo "$3 exists already!" && exit 1;
[ -f "$3.dbtype" ] && echo "$3 exists already!" && exit 1;
[ ! -d "$4" ] && echo "tmp directory $4 not found!" && mkdir -p "$4";

A_DB="$1"
@@ -36,7 +36,7 @@ hasCommand sort
# check if files exists
[ ! -f "$1" ] && echo "$1 not found!" && exit 1;
[ ! -f "$2" ] && echo "$2 not found!" && exit 1;
[ -f "$3" ] && echo "$3 exists already!" && exit 1;
[ -f "$3.dbtype" ] && echo "$3 exists already!" && exit 1;
[ ! -d "$4" ] && echo "TMP directory $4 not found!" && mkdir -p "$4";

INPUT="$1"
@@ -13,7 +13,7 @@ notExists() {
# check if files exists
[ ! -f "$1" ] && echo "$1 not found!" && exit 1;
[ ! -f "$2" ] && echo "$2 not found!" && exit 1;
[ -f "$3" ] && echo "$3 exists already!" && exit 1;
[ -f "$3.dbtype" ] && echo "$3 exists already!" && exit 1;
[ ! -d "$4" ] && echo "tmp directory $4 not found!" && mkdir -p "$4";

INPUT="$1"
@@ -16,7 +16,7 @@ notExists() {
# check if files exists
[ ! -f "$1" ] && echo "$1 not found!" && exit 1;
[ ! -f "$2" ] && echo "$2 not found!" && exit 1;
[ -f "$3" ] && echo "$3 exists already!" && exit 1;
[ -f "$3.dbtype" ] && echo "$3 exists already!" && exit 1;
[ ! -d "$4" ] && echo "tmp directory $4 not found!" && mkdir -p "$4";


@@ -14,7 +14,7 @@ notExists() {
# check if files exists
[ ! -f "$1" ] && echo "$1 not found!" && exit 1;
[ ! -f "$2" ] && echo "$2 not found!" && exit 1;
[ -f "$3" ] && echo "$3 exists already!" && exit 1;
[ -f "$3.dbtype" ] && echo "$3 exists already!" && exit 1;
[ ! -d "$4" ] && echo "tmp directory $4 not found!" && mkdir -p "$4";

QUERY="$1"
@@ -60,7 +60,7 @@ if notExists "$4/aln.dbtype"; then
|| fail "Search step died"
fi

if notExists "$4/aln_offset.dbtype"; then
if notExists "$3.dbtype"; then
# shellcheck disable=SC2086
"$MMSEQS" offsetalignment "$1" "$QUERY_ORF" "$2" "$TARGET_ORF" "$4/aln" "$3" ${OFFSETALIGNMENT_PAR} \
|| fail "Offset step died"
@@ -389,8 +389,7 @@ std::pair<hit_t *, size_t> QueryMatcher::getResult(CounterResult * results,
//printf("%d\t%d\t%f\t%f\t%f\t%f\t%f\n", result->seqId, scoreCurr, seqLens[seqIdCurr], mu, logMatchProb, logScoreFactorial[scoreCurr]);
if(TYPE == KMER_SCORE){
// make sure score is not great > 255
unsigned char lookupScore = static_cast<unsigned char>(scoreCurr);
result->prefScore = -computeLogProbability(scoreCurr, seqLens[seqIdCurr], mu, logMatchProb, logScoreFactorial[lookupScore]);
result->prefScore = -computeLogProbability(scoreCurr, seqLens[seqIdCurr], mu, logMatchProb, logScoreFactorial[scoreCurr]);
}else{
//need to get the real score
if(rescaleScore != 0) {
@@ -126,8 +126,8 @@ int convertalignments(int argc, const char **argv, const Command &command) {
IndexReader tseqDbr(par.db2, par.threads, IndexReader::SEQUENCES, 0, IndexReader::PRELOAD_INDEX);
seqtargetAA = Parameters::isEqualDbtype(tseqDbr.sequenceReader->getDbtype(), Parameters::DBTYPE_AMINO_ACIDS);
} else if(targetNucs == true && queryNucs == true && par.searchType == Parameters::SEARCH_TYPE_AUTO){
Debug(Debug::INFO) << "Assume nucl/nucl search was performed. \n";
Debug(Debug::INFO) << "If this is not correct than please provide the parameter --search-type 2 (translated) or 3 (nucleotide)\n";
Debug(Debug::WARNING) << "Assume that nucleotide search was performed\n";
Debug(Debug::WARNING) << "If this is not correct than please provide the parameter --search-type 2 (translated) or 3 (nucleotide)\n";
} else if(par.searchType == Parameters::SEARCH_TYPE_TRANSLATED){
seqtargetAA = true;
}
@@ -227,8 +227,8 @@ int offsetalignment(int argc, const char **argv, const Command &command) {
isTransNucTransNucSearch = Parameters::isEqualDbtype(tseqDbr.sequenceReader->getDbtype(), Parameters::DBTYPE_AMINO_ACIDS);
}else{
if(par.searchType == Parameters::SEARCH_TYPE_AUTO && (targetNucl == true && queryNucl == true )){
Debug(Debug::INFO) << "Assume nucl/nucl search was performed. \n";
Debug(Debug::INFO) << "If this is not correct than please provide the parameter --search-type 2 (translated) or 3 (nucleotide)\n";
Debug(Debug::WARNING) << "Assume that nucleotide search was performed\n";
Debug(Debug::WARNING) << "If this is not correct than please provide the parameter --search-type 2 (translated) or 3 (nucleotide)\n";
} else if(par.searchType == Parameters::SEARCH_TYPE_TRANSLATED){
seqtargetNuc = false;
isTransNucTransNucSearch = true;
@@ -31,7 +31,10 @@ void setSearchDefaults(Parameters *p) {


void setNuclSearchDefaults(Parameters *p) {
p->alignmentMode = Parameters::ALIGNMENT_MODE_SCORE_COV_SEQID;
// leave ungapped alignment untouched
if(p->alignmentMode != Parameters::ALIGNMENT_MODE_UNGAPPED){
p->alignmentMode = Parameters::ALIGNMENT_MODE_SCORE_COV_SEQID;
}
//p->orfLongest = true;
p->exactKmerMatching = true;

@@ -154,8 +157,8 @@ int search(int argc, const char **argv, const Command& command) {
par.printParameters(command.cmd, argc, argv, par.searchworkflow);

if(isNuclNuclSearch == true && par.searchType == Parameters::SEARCH_TYPE_AUTO) {
Debug(Debug::INFO) << "Perform nucleotide search. \n";
Debug(Debug::INFO) << "To perform a translated search use --search-type 2 \n";
Debug(Debug::WARNING) << "Perform nucleotide search. \n";
Debug(Debug::WARNING) << "To perform a translated search use --search-type 2 \n";
}
if (FileUtil::directoryExists(par.db4.c_str()) == false) {
Debug(Debug::INFO) << "Tmp " << par.db4 << " folder does not exist or is not a directory.\n";

0 comments on commit 5d41e6b

Please sign in to comment.
You can’t perform that action at this time.