diff --git a/src/Makefile b/src/Makefile
index 105c9b3..7e75b26 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,20 +1,20 @@
-########################################################
+######################################################
# Makefile is generated by ./build_linux.py
-# Don't edit the Makefile -- update the generator script
-########################################################
+# Don't edit the Makefile -- update the python script
+######################################################
BINDIR := ../bin
OBJDIR := o
BINPATH := $(BINDIR)/reseek
CC = gcc
-CFLAGS := $(CFLAGS) -O3 -ffast-math -march=native
+CFLAGS := $(CFLAGS) -ffast-math -march=native --std=c++17 -O3 -DNDEBUG -fopenmp
CXX = g++
-CXXFLAGS := $(CFLAGS) -DNDEBUG -pthread -O3 -ffast-math -march=native --std=c++17
+CXXFLAGS := $(CFLAGS) -ffast-math -march=native --std=c++17 -O3 -DNDEBUG -fopenmp
UNAME_S := $(shell uname -s)
-LDFLAGS := $(LDFLAGS) -pthread -lpthread
+LDFLAGS := $(LDFLAGS) -ffast-math -march=native -O3 -fopenmp
ifeq ($(UNAME_S),Linux)
LDFLAGS += -static
endif
@@ -257,6 +257,3 @@ $(OBJDIR)/%.o : %.c $(HDRS)
$(OBJDIR)/%.o : %.cpp $(HDRS)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
-
-clean:
- rm -rf $(OBJDIR)/ $(BINPATH)
diff --git a/src/build_linux.bash b/src/build_linux.bash
new file mode 100644
index 0000000..31da6e5
--- /dev/null
+++ b/src/build_linux.bash
@@ -0,0 +1 @@
+./build_linux.py --openmp --std 17
diff --git a/src/build_linux.py b/src/build_linux.py
index f80704a..3876319 100644
--- a/src/build_linux.py
+++ b/src/build_linux.py
@@ -2,25 +2,31 @@
import os
import sys
+import argparse
-DebugBuild = len(sys.argv) > 1 and sys.argv[1] == "d"
+Usage = \
+(
+"Convert Visual Studio .vcxproj file in current directory to Makefile and run make."
+)
-rc = os.system('test -z $(git status --porcelain) 2> /dev/null')
-if rc != 0:
- sys.stderr.write("\n\nWARNING -- Uncommited changes\n\n")
- ## sys.exit(1)
+AP = argparse.ArgumentParser(description = Usage)
-rc = os.system(r'echo \"$(git log --oneline | head -n1 | cut "-d " -f1)\" | tee gitver.txt')
-if rc != 0:
- sys.stderr.write("\n\nERROR -- failed to generate gitver.txt\n\n")
- sys.exit(1)
+# Value opts
+AP.add_argument("--std", required=False, help="Don't strip symbols (default if --debug or --symbols)")
-OBJDIR = "o"
-BINDIR = "../bin"
+# Flag opts
+AP.add_argument("--debug", required=False, action='store_true', help="Debug build")
+AP.add_argument("--openmp", required=False, action='store_true', help="Requires OMP")
+AP.add_argument("--pthread", required=False, action='store_true', help="Requires pthread")
+AP.add_argument("--lrt", required=False, action='store_true', help="Requires lrt")
+AP.add_argument("--symbols", required=False, action='store_true', help="Debug symbols (default if --debug)")
+AP.add_argument("--nostrip", required=False, action='store_true', help="Don't strip symbols (default if --debug or --symbols)")
-LRT = False
-DEBUG = False
-SVNVER = False
+Args = AP.parse_args()
+debug = Args.debug
+std = Args.std
+nostrip = debug or Args.symbols
+symbols = debug or Args.symbols
ProjFileName = None
HdrNames = []
@@ -30,13 +36,62 @@
elif FileName.endswith(".h"):
HdrNames.append(FileName)
if ProjFileName is None:
- print("Project file not found in current directory", file=sys.stderr)
+ sys.stderr.write("\nProject file not found in current directory\n")
+ sys.exit(1)
+
+binary = ProjFileName.replace(".vcxproj", "")
+sys.stderr.write("binary=" + binary + "\n")
+
+compiler_opts = " -ffast-math -march=native"
+linker_opts = " -ffast-math -march=native"
+
+if std:
+ assert std == "11" or std == "17"
+ compiler_opts += " --std=c++" + std
+
+if debug:
+ compiler_opts += " -O0 -DDEBUG"
+ linker_opts += " -O0"
+else:
+ compiler_opts += " -O3 -DNDEBUG"
+ linker_opts += " -O3"
+
+if symbols:
+ compiler_opts += " -g3"
+ linker_opts += " -g3"
+
+if Args.openmp:
+ compiler_opts += " -fopenmp"
+ linker_opts += " -fopenmp"
+
+if Args.pthread:
+ compiler_opts += " -pthread"
+ linker_opts += " -lpthread"
+
+rc = os.system('test -z $(git status --porcelain) 2> /dev/null')
+if rc != 0:
+ sys.stderr.write("\n\nWarning -- Uncommited changes\n\n")
+
+rc = os.system(r'echo \"$(git log --oneline | head -n1 | cut "-d " -f1)\" | tee gitver.txt')
+if rc != 0:
+ sys.stderr.write("\n\nERROR -- failed to generate gitver.txt\n\n")
+ sys.exit(1)
+sys.stderr.write("gitver.txt done.\n")
+
+rc = os.system(r'rm -rf o/ ../bin/%s*' % binary)
+if rc != 0:
+ sys.stderr.write("\n\nERROR -- failed to clean\n\n")
+ sys.exit(1)
+sys.stderr.write("clean done.\n")
+
+OBJDIR = "o"
+BINDIR = "../bin"
Fields = ProjFileName.split("/")
n = len(Fields)
Name = Fields[n-1]
Fields = Name.split(".")
-progname = Fields[0]
+binary = Fields[0]
CXXNames = []
CNames = []
@@ -58,60 +113,37 @@
elif FileName.endswith(".c"):
FileName = FileName.replace(".c", "")
CNames.append(FileName)
- # usearch
- elif Line.startswith("", "")
- Line = Line.replace("", "")
- progname = Line
assert len(CXXNames) > 0 or len(CNames) > 0
-Makefile = "Makefile"
-if DebugBuild:
- Makefile = "Makefiled"
-with open(Makefile, "w") as f:
+with open("Makefile", "w") as f:
def Out(s):
print(s, file=f)
- if DebugBuild:
- BINPATH = "$(BINDIR)/%s" % (progname) + "d"
- else:
- BINPATH = "$(BINDIR)/%s" % (progname)
+ BINPATH = "$(BINDIR)/%s" % (binary)
- Out("########################################################")
- Out("# Makefile is generated by %s" % sys.argv[0])
- Out("# Don't edit the Makefile -- update the generator script")
- Out("########################################################")
+ Out("######################################################")
+ Out("# Makefile is generated by " + sys.argv[0])
+ Out("# Don't edit the Makefile -- update the python script")
+ Out("######################################################")
Out("")
Out("BINDIR := %s" % BINDIR)
Out("OBJDIR := %s" % OBJDIR)
Out("BINPATH := %s" % BINPATH)
- # Out("")
- # Out("CPPFLAGS := $(CPPFLAGS) -DNDEBUG -pthread")
-
if CNames:
Out("")
Out("CC = gcc")
- if DebugBuild:
- Out("CFLAGS := $(CFLAGS) -ffast-math -march=native")
- else:
- Out("CFLAGS := $(CFLAGS) -O3 -ffast-math -march=native")
+ Out("CFLAGS := $(CFLAGS) " + compiler_opts)
if CXXNames:
Out("")
Out("CXX = g++")
- if DebugBuild:
- Out("CXXFLAGS := $(CFLAGS) -DDEBUG -pthread -march=native --std=c++17")
- else:
- Out("CXXFLAGS := $(CFLAGS) -DNDEBUG -pthread -O3 -ffast-math -march=native --std=c++17")
+ Out("CXXFLAGS := $(CFLAGS) " + compiler_opts)
Out("")
Out("UNAME_S := $(shell uname -s)")
- if DebugBuild:
- Out("LDFLAGS := $(LDFLAGS) -O3 -pthread -lpthread")
- else:
- Out("LDFLAGS := $(LDFLAGS) -pthread -lpthread")
+ Out("LDFLAGS := $(LDFLAGS) " + linker_opts)
Out("ifeq ($(UNAME_S),Linux)")
Out(" LDFLAGS += -static")
Out("endif")
@@ -140,11 +172,11 @@ def Out(s):
else:
Cmd = "\t%(CC) $(LDFLAGS) $(OBJS) -o $(BINPATH)"
- if LRT:
+ if Args.lrt:
Cmd += " -lrt"
Out(Cmd)
- if not DebugBuild:
+ if not nostrip:
Out(" strip $(BINPATH)")
Out("")
@@ -165,17 +197,12 @@ def Out(s):
Out("$(OBJDIR)/%.o : %.cpp $(HDRS)")
Out(" $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<")
- Out("")
- Out("clean:")
- Out(" rm -rf $(OBJDIR)/ $(BINPATH)")
-
-if DebugBuild:
- rc = os.system("rm -f o/myutils.o ../bin/%sd" % progname)
-else:
- rc = os.system("rm -f o/myutils.o ../bin/%s" % progname)
+sys.stderr.write("Makefile done.\n")
-rc = os.system("make -f %s > make.stdout 2> make.stderr" % Makefile)
+rc = os.system("make 2> make.stderr | tee make.stdout")
if rc != 0:
os.system("tail make.stderr")
sys.stderr.write("\n\nERROR -- make failed, see make.stderr\n\n")
sys.exit(1)
+sys.stderr.write("make done.\n")
+os.system("ls -lh ../bin/" + binary + "\n")
diff --git a/src/daliscorer.cpp b/src/daliscorer.cpp
index b779eb1..ab4d3ea 100644
--- a/src/daliscorer.cpp
+++ b/src/daliscorer.cpp
@@ -95,6 +95,14 @@ void DALIScorer::LoadChains(const string &FN)
m_SeqToChainIdx[ptrChain->m_Seq] = Idx;
}
Progress("Reading chains done (%u)\n", SIZE(m_Chains));
+ {//@@
+ for (map::const_iterator iter = m_SeqToChainIdx.begin();
+ iter != m_SeqToChainIdx.end(); ++iter)
+ {
+ Log("[%u] %s\n", iter->second, iter->first);
+ }
+
+ }//@@
}
void DALIScorer::SetCore()
@@ -129,6 +137,8 @@ bool DALIScorer::SetSeqIdxToChainIdx(bool MissingSeqOk)
const string &Label = string(m_MSA->GetLabel(SeqIdx));
string Seq;
m_MSA->GetSeq_StripGaps(SeqIdx, Seq, true);
+ Log(">%s\n", Label.c_str());//@@
+ Log("%s\n", Seq.c_str());//@@
map::const_iterator iter = m_SeqToChainIdx.find(Seq);
if (iter == m_SeqToChainIdx.end())
{
diff --git a/src/prettyaln.cpp b/src/prettyaln.cpp
index 57c6eab..0f4dcb9 100644
--- a/src/prettyaln.cpp
+++ b/src/prettyaln.cpp
@@ -100,7 +100,7 @@ void PrettyAln(FILE *f, const PDBChain &A, const PDBChain &B,
if (ColHi == ColCount)
break;
asserta(ColHi < ColCount);
- ColLo = ColHi + 1;
+ ColLo = ColHi;
}
double PctId = GetPct(Ids, ColCount);
double PctGaps = GetPct(Gaps, ColCount);
diff --git a/src/usage.h b/src/usage.h
index 1b53f8f..cee2fe5 100644
--- a/src/usage.h
+++ b/src/usage.h
@@ -56,6 +56,9 @@ const char *usage_txt[] =
" -bca FILENAME # .bca format, binary .cal, recommended for DBs\n"
" -fasta FILENAME # FASTA format\n"
"\n"
+"Create input for Muscle-3D multiple structure alignment:\n"
+" reseek -pdb2mega STRUCTS -output structs.mega\n"
+"\n"
"STRUCTS argument is one of:\n"
" NAME.cif or NAME.mmcif # PDBx/mmCIF file\n"
" NAME.pdb # Legacy format PDB file\n"
diff --git a/test_scripts/_run_tests.bash b/test_scripts/_run_tests.bash
index aa36f11..44aeb46 100644
--- a/test_scripts/_run_tests.bash
+++ b/test_scripts/_run_tests.bash
@@ -1,6 +1,7 @@
#!/bin/bash -e
cd ../src
+rm -rf o/ ../bin/reseek*
chmod +x ./build_linux.py
python3 ./build_linux.py
cd ../test_scripts
@@ -23,13 +24,14 @@ echo STARTED `date` >> $log
./columns.bash
./search.bash
./scop40.bash
+./pdb2mega.bash
python3 ./check_logs.py >> $log
python3 ./check_convert.py >> $log
python3 ./check_columns.py >> $log
python3 ./check_scop40.py >> $log
-./update_success_list.py $ver $date
+python3 ./update_success_list.py $ver $date
echo COMPLETED $date >> $log
diff --git a/test_scripts/pdb2mega.bash b/test_scripts/pdb2mega.bash
new file mode 100644
index 0000000..7a19ca2
--- /dev/null
+++ b/test_scripts/pdb2mega.bash
@@ -0,0 +1,8 @@
+#!/bin/bash -e
+
+cd ../test_output
+
+../bin/reseek \
+ -pdb2mega ../test_structures/4v40.cif \
+ -output ../test_output/4v40.mega \
+ -log pdb2mega.log