Commit 8baf38ac authored by Andreas Tille's avatar Andreas Tille

Imported Upstream version 3.7+4565

parents
libMUSCLE is an adaptation of Robert C Edgar's MUSCLE 3.7.
libMUSCLE was written by Aaron Darling <darling@cs.wisc.edu> and Todd J Treangen <treangen@gmail.com>
It contains bugfixes and new features to the original 3.7 code.
This is a library refactorization of Robert Edgar's MUSCLE v3.7 program. It has been released into the public domain.
ACLOCAL_AMFLAGS = -I m4
include doxygen.am
MOSTLYCLEANFILES = $(DX_CLEANFILES)
EXTRA_DIST = \
projects/libMUSCLE.vcproj \
projects/muscle.vcproj \
projects/libmuscle.doxygen
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libMUSCLE-@GENERIC_API_VERSION@.pc
SUBDIRS = libMUSCLE
#!/bin/sh
mkdir -p config
autoreconf --force --install -I config -I m4
echo "Now run ./configure --prefix=$HOME && make install" && \
echo "Add --disable-shared to the configure line if building on Mac OS X"
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ([2.59])
AC_INIT(libMUSCLE/muscle.h)
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_MACRO_DIR([m4])
dnl -----------------------------------------------
dnl Package name and version number (user defined)
dnl -----------------------------------------------
GENERIC_LIBRARY_NAME=libMUSCLE
#release versioning
GENERIC_MAJOR_VERSION=1
GENERIC_MINOR_VERSION=0
GENERIC_MICRO_VERSION=0
#API version (often = GENERIC_MAJOR_VERSION.GENERIC_MINOR_VERSION)
GENERIC_API_VERSION=3.7
AC_SUBST(GENERIC_API_VERSION)
#shared library versioning
GENERIC_LIBRARY_VERSION=1:0:0
# | | |
# +------+ | +---+
# | | |
# current:revision:age
# | | |
# | | +- increment if interfaces have been added
# | | set to zero if interfaces have been removed
# or changed
# | +- increment if source code has changed
# | set to zero if current is incremented
# +- increment if interfaces have been added, removed or changed
dnl --------------------------------
dnl Package name and version number
dnl --------------------------------
AC_SUBST(GENERIC_LIBRARY_VERSION)
PACKAGE=$GENERIC_LIBRARY_NAME
AC_SUBST(GENERIC_LIBRARY_NAME)
GENERIC_VERSION=$GENERIC_MAJOR_VERSION.$GENERIC_MINOR_VERSION.$GENERIC_MICRO_VERSION
GENERIC_RELEASE=$GENERIC_MAJOR_VERSION.$GENERIC_MINOR_VERSION
AC_SUBST(GENERIC_RELEASE)
AC_SUBST(GENERIC_VERSION)
VERSION=$GENERIC_VERSION
AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
dnl Override default O2
CFLAGS=${CFLAGS-""}
CXXFLAGS=${CXXFLAGS-""}
AC_PREFIX_DEFAULT(/usr/local)
dnl Checks for programs.
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_LN_S
AM_PROG_LIBTOOL
dnl Check what compiler we're using
AM_CONDITIONAL(ICC, test x$CC = xicc )
dnl Checks for header files.
AC_HEADER_STDC
dnl Allow debugging compilation
AC_ARG_ENABLE(debug,
[ --enable-debug Turn on debugging],
[case "${enableval}" in
yes) debug=true ;;
no) debug=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
esac],[debug=false])
AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
dnl Mac OS X won't allow static compilation...
STATIC_FLAG="-static"
if ( test "x$target_vendor" = "xapple") then
STATIC_FLAG=""
fi
AC_SUBST(STATIC_FLAG)
dnl Check for OpenMP
#AX_OPENMP()
AC_SUBST(OPENMP_CFLAGS)
dnl OpenMP checker only defines for C when compiling both C and C++
OPENMP_CXXFLAGS=$OPENMP_CFLAGS
AC_SUBST(OPENMP_CXXFLAGS)
dnl Make doxygen docs
DX_INIT_DOXYGEN( "libMUSCLE", "projects/libmuscle.doxygen", "doc" )
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
dnl AC_C_BIGENDIAN
AC_HEADER_TIME
dnl Checks for library functions.
AC_PROG_GCC_TRADITIONAL
dnl SAVE_LIBRARY_VERSION
AC_SUBST(LIBTOOL_VERSION_INFO)
AC_OUTPUT(Makefile libMUSCLE/Makefile libMUSCLE-3.7.pc )
## --------------------------------- ##
## Format-independent Doxygen rules. ##
## --------------------------------- ##
if DX_COND_doc
## ------------------------------- ##
## Rules specific for HTML output. ##
## ------------------------------- ##
if DX_COND_html
DX_CLEAN_HTML = @DX_DOCDIR@/html
endif DX_COND_html
## ------------------------------ ##
## Rules specific for CHM output. ##
## ------------------------------ ##
if DX_COND_chm
DX_CLEAN_CHM = @DX_DOCDIR@/chm
if DX_COND_chi
DX_CLEAN_CHI = @DX_DOCDIR@/@PACKAGE@.chi
endif DX_COND_chi
endif DX_COND_chm
## ------------------------------ ##
## Rules specific for MAN output. ##
## ------------------------------ ##
if DX_COND_man
DX_CLEAN_MAN = @DX_DOCDIR@/man
endif DX_COND_man
## ------------------------------ ##
## Rules specific for RTF output. ##
## ------------------------------ ##
if DX_COND_rtf
DX_CLEAN_RTF = @DX_DOCDIR@/rtf
endif DX_COND_rtf
## ------------------------------ ##
## Rules specific for XML output. ##
## ------------------------------ ##
if DX_COND_xml
DX_CLEAN_XML = @DX_DOCDIR@/xml
endif DX_COND_xml
## ----------------------------- ##
## Rules specific for PS output. ##
## ----------------------------- ##
if DX_COND_ps
DX_CLEAN_PS = @DX_DOCDIR@/@PACKAGE@.ps
DX_PS_GOAL = doxygen-ps
doxygen-ps: @DX_DOCDIR@/@PACKAGE@.ps
@DX_DOCDIR@/@PACKAGE@.ps: @DX_DOCDIR@/@PACKAGE@.tag
cd @DX_DOCDIR@/latex; \
rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
$(DX_LATEX) refman.tex; \
$(MAKEINDEX_PATH) refman.idx; \
$(DX_LATEX) refman.tex; \
countdown=5; \
while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
refman.log > /dev/null 2>&1 \
&& test $$countdown -gt 0; do \
$(DX_LATEX) refman.tex; \
countdown=`expr $$countdown - 1`; \
done; \
$(DX_DVIPS) -o ../@PACKAGE@.ps refman.dvi
endif DX_COND_ps
## ------------------------------ ##
## Rules specific for PDF output. ##
## ------------------------------ ##
if DX_COND_pdf
DX_CLEAN_PDF = @DX_DOCDIR@/@PACKAGE@.pdf
DX_PDF_GOAL = doxygen-pdf
doxygen-pdf: @DX_DOCDIR@/@PACKAGE@.pdf
@DX_DOCDIR@/@PACKAGE@.pdf: @DX_DOCDIR@/@PACKAGE@.tag
cd @DX_DOCDIR@/latex; \
rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
$(DX_PDFLATEX) refman.tex; \
$(DX_MAKEINDEX) refman.idx; \
$(DX_PDFLATEX) refman.tex; \
countdown=5; \
while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
refman.log > /dev/null 2>&1 \
&& test $$countdown -gt 0; do \
$(DX_PDFLATEX) refman.tex; \
countdown=`expr $$countdown - 1`; \
done; \
mv refman.pdf ../@PACKAGE@.pdf
endif DX_COND_pdf
## ------------------------------------------------- ##
## Rules specific for LaTeX (shared for PS and PDF). ##
## ------------------------------------------------- ##
if DX_COND_latex
DX_CLEAN_LATEX = @DX_DOCDIR@/latex
endif DX_COND_latex
.PHONY: doxygen-run doxygen-doc $(DX_PS_GOAL) $(DX_PDF_GOAL)
.INTERMEDIATE: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
doxygen-run: @DX_DOCDIR@/@PACKAGE@.tag
doxygen-doc: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
@DX_DOCDIR@/@PACKAGE@.tag: $(DX_CONFIG) $(pkginclude_HEADERS)
rm -rf @DX_DOCDIR@
$(DX_ENV) $(DX_DOXYGEN) $(srcdir)/$(DX_CONFIG)
DX_CLEANFILES = \
@DX_DOCDIR@/@PACKAGE@.tag \
-r \
$(DX_CLEAN_HTML) \
$(DX_CLEAN_CHM) \
$(DX_CLEAN_CHI) \
$(DX_CLEAN_MAN) \
$(DX_CLEAN_RTF) \
$(DX_CLEAN_XML) \
$(DX_CLEAN_PS) \
$(DX_CLEAN_PDF) \
$(DX_CLEAN_LATEX)
endif DX_COND_doc
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: libMUSCLE
Description: The MUSCLE multiple sequence alignment code turned into a library
Version: @VERSION@
Libs: -L${libdir} -lMUSCLE-@GENERIC_API_VERSION@ @OPENMP_CXXFLAGS@
Cflags: -I${includedir}/@GENERIC_LIBRARY_NAME@-@GENERIC_API_VERSION@ @OPENMP_CXXFLAGS@
OPTIMIZATION = -O2 -funroll-loops -fomit-frame-pointer -ftree-vectorize
AM_CXXFLAGS = $(OPTIMIZATION) -DNDEBUG=1 @OPENMP_CXXFLAGS@
AM_LDFLAGS = $(OPTIMIZATION)
LIBMUSCLE_H = \
alpha.h cluster.h clust.h clustsetdf.h clustset.h clustsetmsa.h diaglist.h distcalc.h distfunc.h dpregionlist.h dpreglist.h edgelist.h enumopts.h enums.h estring.h gapscoredimer.h gonnet.h intmath.h msadist.h msa.h muscle.h objscore.h params.h profile.h pwpath.h refine.h scorehistory.h seq.h seqvect.h textfile.h timing.h tree.h types.h unixio.h threadstorage.h
LIBMUSCLE_SRC = \
aligngivenpath.cpp aligngivenpathsw.cpp aligntwomsas.cpp aligntwoprofs.cpp \
aln.cpp alpha.cpp anchoredpp.cpp anchors.cpp bittraceback.cpp blosumla.cpp \
clust.cpp cluster.cpp clwwt.cpp color.cpp cons.cpp diaglist.cpp \
diffobjscore.cpp diffpaths.cpp difftrees.cpp difftreese.cpp distcalc.cpp \
distfunc.cpp distpwkimura.cpp domuscle.cpp dosp.cpp dpreglist.cpp drawtree.cpp \
edgelist.cpp enumopts.cpp enumtostr.cpp estring.cpp fasta2.cpp fasta.cpp \
fastclust.cpp fastdist.cpp fastdistjones.cpp fastdistkbit.cpp fastdistkmer.cpp \
fastdistmafft.cpp fastdistnuc.cpp fastscorepath2.cpp finddiags.cpp \
finddiagsn.cpp glbalign352.cpp glbalign.cpp glbaligndiag.cpp glbalignle.cpp \
glbalignsimple.cpp glbalignsp.cpp glbalignspn.cpp glbalignss.cpp \
glbalndimer.cpp globals.cpp globalslinux.cpp globalswin32.cpp gonnet.cpp \
gotowt.cpp henikoffweight.cpp henikoffweightpb.cpp html.cpp hydro.cpp \
intmath.cpp local.cpp makerootmsab.cpp makerootmsa.cpp mhack.cpp mpam200.cpp \
msa2.cpp msa.cpp msadistkimura.cpp msf.cpp muscle.cpp muscleout.cpp nucmx.cpp nwdasimple2.cpp nwdasimple.cpp nwdasmall.cpp nwrec.cpp nwsmall.cpp objscore2.cpp objscore.cpp objscoreda.cpp onexception.cpp options.cpp outweights.cpp pam200mafft.cpp params.cpp phy2.cpp phy3.cpp phy4.cpp phy.cpp phyfromclust.cpp phyfromfile.cpp physeq.cpp phytofile.cpp posgap.cpp ppscore.cpp profdb.cpp profile.cpp profilefrommsa.cpp progalign.cpp progress.cpp progressivealign.cpp pwpath.cpp readmx.cpp realigndiffs.cpp realigndiffse.cpp refine.cpp refinehoriz.cpp refinesubfams.cpp refinetree.cpp refinetreee.cpp refinevert.cpp refinew.cpp savebest.cpp scoregaps.cpp scorehistory.cpp scorepp.cpp seq.cpp seqvect.cpp setblosumweights.cpp setgscweights.cpp setnewhandler.cpp spfast.cpp sptest.cpp stabilize.cpp subfam.cpp subfams.cpp sw.cpp termgaps.cpp textfile.cpp threewaywt.cpp traceback.cpp tracebackopt.cpp tracebacksw.cpp treefrommsa.cpp typetostr.cpp upgma2.cpp usage.cpp validateids.cpp vtml2.cpp writescorefile.cpp \
blosum62.cpp globalsother.cpp maketree.cpp scoredist.cpp tomhydro.cpp
library_includedir=$(includedir)/$(GENERIC_LIBRARY_NAME)-$(GENERIC_API_VERSION)/$(GENERIC_LIBRARY_NAME)
library_include_HEADERS = $(LIBMUSCLE_H)
INCLUDES = -I$(top_srcdir)
lib_LTLIBRARIES = libMUSCLE-3.7.la
libMUSCLE_3_7_la_SOURCES = $(LIBMUSCLE_SRC)
libMUSCLE_3_7_la_LDFLAGS= -version-info $(GENERIC_LIBRARY_VERSION)
libMUSCLE_3_7_la_CXXFLAGS= -D_LIB $(AM_CXXFLAGS)
bin_PROGRAMS = muscle
muscle_SOURCES = main.cpp
muscle_LDADD = $(top_builddir)/libMUSCLE/libMUSCLE-3.7.la
# Porting notes:
# For Solaris and other platforms where the logf function
# is missing from the math library, add the following line
# to the end of muscle.h:
# #define logf(x) ((float) log(x))
# Using -static increases the executable size and thus gives a very
# small increase in start time, but is more portable (the binding
# to dynamic libraries often breaks when a new library is released).
# On OSX, using -static gives the error "ld: can't locate file for: -lcrt0.o",
# this is fixed by deleting "-static" from the LDLIBS line.
CFLAGS = -O3 -funroll-loops -Winline -DNDEBUG=1
LDLIBS = -lm -static
# LDLIBS = -lm
OBJ = .o
EXE =
RM = rm -f
CP = cp
GPP = g++
LD = $(GPP) $(CFLAGS)
CPP = $(GPP) -c $(CFLAGS)
all: muscle
CPPSRC = $(sort $(wildcard *.cpp))
CPPOBJ = $(subst .cpp,.o,$(CPPSRC))
$(CPPOBJ): %.o: %.cpp
$(CPP) $< -o $@
muscle: $(CPPOBJ)
$(LD) -o muscle $(CPPOBJ) $(LDLIBS)
strip muscle
This diff is collapsed.
#include "libMUSCLE/muscle.h"
#include "libMUSCLE/msa.h"
#include "libMUSCLE/pwpath.h"
#include "libMUSCLE/profile.h"
namespace muscle {
#define TRACE 0
static void AppendDelete(const MSA &msaA, unsigned &uColIndexA,
unsigned uSeqCountA, unsigned uSeqCountB, MSA &msaCombined,
unsigned &uColIndexCombined)
{
#if TRACE
Log("AppendDelete ColIxA=%u ColIxCmb=%u\n",
uColIndexA, uColIndexCombined);
#endif
for (unsigned uSeqIndexA = 0; uSeqIndexA < uSeqCountA; ++uSeqIndexA)
{
char c = msaA.GetChar(uSeqIndexA, uColIndexA);
msaCombined.SetChar(uSeqIndexA, uColIndexCombined, c);
}
for (unsigned uSeqIndexB = 0; uSeqIndexB < uSeqCountB; ++uSeqIndexB)
msaCombined.SetChar(uSeqCountA + uSeqIndexB, uColIndexCombined, '-');
++uColIndexCombined;
++uColIndexA;
}
static void AppendInsert(const MSA &msaB, unsigned &uColIndexB,
unsigned uSeqCountA, unsigned uSeqCountB, MSA &msaCombined,
unsigned &uColIndexCombined)
{
#if TRACE
Log("AppendInsert ColIxB=%u ColIxCmb=%u\n",
uColIndexB, uColIndexCombined);
#endif
for (unsigned uSeqIndexA = 0; uSeqIndexA < uSeqCountA; ++uSeqIndexA)
msaCombined.SetChar(uSeqIndexA, uColIndexCombined, '-');
for (unsigned uSeqIndexB = 0; uSeqIndexB < uSeqCountB; ++uSeqIndexB)
{
char c = msaB.GetChar(uSeqIndexB, uColIndexB);
msaCombined.SetChar(uSeqCountA + uSeqIndexB, uColIndexCombined, c);
}
++uColIndexCombined;
++uColIndexB;
}
static void AppendUnalignedTerminals(const MSA &msaA, unsigned &uColIndexA, unsigned uColCountA,
const MSA &msaB, unsigned &uColIndexB, unsigned uColCountB, unsigned uSeqCountA,
unsigned uSeqCountB, MSA &msaCombined, unsigned &uColIndexCombined)
{
#if TRACE
Log("AppendUnalignedTerminals ColIxA=%u ColIxB=%u ColIxCmb=%u\n",
uColIndexA, uColIndexB, uColIndexCombined);
#endif
const unsigned uLengthA = msaA.GetColCount();
const unsigned uLengthB = msaB.GetColCount();
unsigned uNewColCount = uColCountA;
if (uColCountB > uNewColCount)
uNewColCount = uColCountB;
for (unsigned n = 0; n < uColCountA; ++n)
{
for (unsigned uSeqIndexA = 0; uSeqIndexA < uSeqCountA; ++uSeqIndexA)
{
char c = msaA.GetChar(uSeqIndexA, uColIndexA + n);
c = UnalignChar(c);
msaCombined.SetChar(uSeqIndexA, uColIndexCombined + n, c);
}
}
for (unsigned n = uColCountA; n < uNewColCount; ++n)
{
for (unsigned uSeqIndexA = 0; uSeqIndexA < uSeqCountA; ++uSeqIndexA)
msaCombined.SetChar(uSeqIndexA, uColIndexCombined + n, '.');
}
for (unsigned n = 0; n < uColCountB; ++n)
{
for (unsigned uSeqIndexB = 0; uSeqIndexB < uSeqCountB; ++uSeqIndexB)
{
char c = msaB.GetChar(uSeqIndexB, uColIndexB + n);
c = UnalignChar(c);
msaCombined.SetChar(uSeqCountA + uSeqIndexB, uColIndexCombined + n, c);
}
}
for (unsigned n = uColCountB; n < uNewColCount; ++n)
{
for (unsigned uSeqIndexB = 0; uSeqIndexB < uSeqCountB; ++uSeqIndexB)
msaCombined.SetChar(uSeqCountA + uSeqIndexB, uColIndexCombined + n, '.');
}
uColIndexCombined += uNewColCount;
uColIndexA += uColCountA;
uColIndexB += uColCountB;
}
static void AppendMatch(const MSA &msaA, unsigned &uColIndexA, const MSA &msaB,
unsigned &uColIndexB, unsigned uSeqCountA, unsigned uSeqCountB,
MSA &msaCombined, unsigned &uColIndexCombined)
{
#if TRACE
Log("AppendMatch ColIxA=%u ColIxB=%u ColIxCmb=%u\n",
uColIndexA, uColIndexB, uColIndexCombined);
#endif
for (unsigned uSeqIndexA = 0; uSeqIndexA < uSeqCountA; ++uSeqIndexA)
{
char c = msaA.GetChar(uSeqIndexA, uColIndexA);
msaCombined.SetChar(uSeqIndexA, uColIndexCombined, c);
}
for (unsigned uSeqIndexB = 0; uSeqIndexB < uSeqCountB; ++uSeqIndexB)
{
char c = msaB.GetChar(uSeqIndexB, uColIndexB);
msaCombined.SetChar(uSeqCountA + uSeqIndexB, uColIndexCombined, c);
}
++uColIndexA;
++uColIndexB;
++uColIndexCombined;
}
void AlignTwoMSAsGivenPathSW(const PWPath &Path, const MSA &msaA, const MSA &msaB,
MSA &msaCombined)
{
msaCombined.Clear();
#if TRACE
Log("AlignTwoMSAsGivenPathSW\n");
Log("Template A:\n");
msaA.LogMe();
Log("Template B:\n");
msaB.LogMe();
#endif
const unsigned uColCountA = msaA.GetColCount();
const unsigned uColCountB = msaB.GetColCount();
const unsigned uSeqCountA = msaA.GetSeqCount();
const unsigned uSeqCountB = msaB.GetSeqCount();
msaCombined.SetSeqCount(uSeqCountA + uSeqCountB);
// Copy sequence names into combined MSA
for (unsigned uSeqIndexA = 0; uSeqIndexA < uSeqCountA; ++uSeqIndexA)
{
msaCombined.SetSeqName(uSeqIndexA, msaA.GetSeqName(uSeqIndexA));
msaCombined.SetSeqId(uSeqIndexA, msaA.GetSeqId(uSeqIndexA));
}
for (unsigned uSeqIndexB = 0; uSeqIndexB < uSeqCountB; ++uSeqIndexB)
{
msaCombined.SetSeqName(uSeqCountA + uSeqIndexB, msaB.GetSeqName(uSeqIndexB));
msaCombined.SetSeqId(uSeqCountA + uSeqIndexB, msaB.GetSeqId(uSeqIndexB));
}
unsigned uColIndexA = 0;
unsigned uColIndexB = 0;
unsigned uColIndexCombined = 0;
const unsigned uEdgeCount = Path.GetEdgeCount();
for (unsigned uEdgeIndex = 0; uEdgeIndex < uEdgeCount; ++uEdgeIndex)
{
const PWEdge &Edge = Path.GetEdge(uEdgeIndex);
#if TRACE
Log("\nEdge %u %c%u.%u\n",
uEdgeIndex,
Edge.cType,
Edge.uPrefixLengthA,
Edge.uPrefixLengthB);
#endif
const char cType = Edge.cType;
const unsigned uPrefixLengthA = Edge.uPrefixLengthA;
unsigned uColCountA = 0;
if (uPrefixLengthA > 0)
{
const unsigned uNodeIndexA = uPrefixLengthA - 1;
const unsigned uTplColIndexA = uNodeIndexA;
if (uTplColIndexA > uColIndexA)
uColCountA = uTplColIndexA - uColIndexA;
}
const unsigned uPrefixLengthB = Edge.uPrefixLengthB;
unsigned uColCountB = 0;
if (uPrefixLengthB > 0)
{
const unsigned uNodeIndexB = uPrefixLengthB - 1;
const unsigned uTplColIndexB = uNodeIndexB;
if (uTplColIndexB > uColIndexB)
uColCountB = uTplColIndexB - uColIndexB;
}
AppendUnalignedTerminals(msaA, uColIndexA, uColCountA, msaB, uColIndexB, uColCountB,
uSeqCountA, uSeqCountB, msaCombined, uColIndexCombined);
switch (cType)
{
case 'M':
{
assert(uPrefixLengthA > 0);
assert(uPrefixLengthB > 0);
const unsigned uColA = uPrefixLengthA - 1;
const unsigned uColB = uPrefixLengthB - 1;
assert(uColIndexA == uColA);
assert(uColIndexB == uColB);
AppendMatch(msaA, uColIndexA, msaB, uColIndexB, uSeqCountA, uSeqCountB,
msaCombined, uColIndexCombined);
break;
}
case 'D':
{
assert(uPrefixLengthA > 0);
const unsigned uColA = uPrefixLengthA - 1;
assert(uColIndexA == uColA);
AppendDelete(msaA, uColIndexA, uSeqCountA, uSeqCountB, msaCombined, uColIndexCombined);
break;
}
case 'I':
{
assert(uPrefixLengthB > 0);
const unsigned uColB = uPrefixLengthB - 1;
assert(uColIndexB == uColB);
AppendInsert(msaB, uColIndexB, uSeqCountA, uSeqCountB, msaCombined, uColIndexCombined);
break;
}
default:
assert(false);
}
}
unsigned uInsertColCountA = uColCountA - uColIndexA;
unsigned uInsertColCountB = uColCountB - uColIndexB;
AppendUnalignedTerminals(msaA, uColIndexA, uInsertColCountA, msaB, uColIndexB,
uInsertColCountB, uSeqCountA, uSeqCountB, msaCombined, uColIndexCombined);
}
}
#include "libMUSCLE/muscle.h"
#include "libMUSCLE/msa.h"
#include "libMUSCLE/profile.h"
#include "libMUSCLE/pwpath.h"
#include "libMUSCLE/textfile.h"
#include "libMUSCLE/timing.h"
namespace muscle {
SCORE AlignTwoMSAs(const MSA &msa1, const MSA &msa2, MSA &msaOut, PWPath &Path,
bool bLockLeft, bool bLockRight)
{
const unsigned uLengthA = msa1.GetColCount();
const unsigned uLengthB = msa2.GetColCount();
ProfPos *PA = ProfileFromMSA(msa1);
ProfPos *PB = ProfileFromMSA(msa2);
if (bLockLeft)
{
PA[0].m_scoreGapOpen = MINUS_INFINITY;
PB[0].m_scoreGapOpen = MINUS_INFINITY;
}
if (bLockRight)
{
PA[uLengthA-1].m_scoreGapClose = MINUS_INFINITY;
PB[uLengthB-1].m_scoreGapClose = MINUS_INFINITY;
}