[med-svn] [fsa] 03/07: Imported Upstream version 1.15.9+dfsg
Andreas Tille
tille at debian.org
Tue May 31 08:35:54 UTC 2016
This is an automated email from the git hooks/post-receive script.
tille pushed a commit to branch master
in repository fsa.
commit 37acf09ea692099976237410f9bb8d747e1e646b
Author: Andreas Tille <tille at debian.org>
Date: Tue May 31 10:05:42 2016 +0200
Imported Upstream version 1.15.9+dfsg
---
display/Makefile.am | 78 ----
display/Makefile.in | 503 ---------------------
display/classnoinst.stamp | 1 -
display/mad/AlignDAG.java | 641 --------------------------
display/mad/Alignment.java | 328 --------------
display/mad/AlignmentPanel.java | 337 --------------
display/mad/Alignments.java | 364 ---------------
display/mad/BatchDocument.java | 87 ----
display/mad/JpegImagesToMovie.java | 530 ----------------------
display/mad/MAD.java | 67 ---
display/mad/MadApplet.java | 37 --
display/mad/MadPanel.java | 792 ---------------------------------
display/mad/Node.java | 618 -------------------------
display/mad/ProbabilityMatrices.java | 169 -------
display/mad/PropertyChangeHandler.java | 37 --
display/mad/PropertyChangeIDs.java | 11 -
display/mad/SaveAsFastaAction.java | 59 ---
display/mad/SaveAsMovAction.java | 31 --
display/mad/SaveAsTiffAction.java | 53 ---
display/mad/SparseMatrix.java | 257 -----------
display/mad/legend.jpg | Bin 2289 -> 0 bytes
display/mad/manifest.mf | 4 -
display/mad/manifest.mf.in | 4 -
23 files changed, 5008 deletions(-)
diff --git a/display/Makefile.am b/display/Makefile.am
deleted file mode 100644
index 4c936b4..0000000
--- a/display/Makefile.am
+++ /dev/null
@@ -1,78 +0,0 @@
-all: mad.jar
-
-JAVA_SOURCES = \
- mad/AlignDAG.java \
- mad/Alignment.java \
- mad/AlignmentPanel.java \
- mad/Alignments.java \
- mad/BatchDocument.java \
- mad/JpegImagesToMovie.java \
- mad/MAD.java \
- mad/MadApplet.java \
- mad/MadPanel.java \
- mad/Node.java \
- mad/ProbabilityMatrices.java \
- mad/PropertyChangeHandler.java \
- mad/PropertyChangeIDs.java \
- mad/SaveAsFastaAction.java \
- mad/SaveAsTiffAction.java \
- mad/SaveAsMovAction.java \
- mad/SparseMatrix.java
-
-# Root directory for class files (to be passed as -d option to javac)
-JAVAROOT = .
-
-# JMF directory
-JMF_DIR = JMF-2.1.1e
-
-# JAE directory
-JAI_DIR = jai-1_1_3
-
-# Options to pass to javac
-AM_JAVACFLAGS = -extdirs $(srcdir)/$(JMF_DIR)/lib:$(srcdir)/$(JAI_DIR)/lib \
- -source 1.5
-
-# Other files that should go into distribution package
-EXTRA_DIST = \
- mad \
- classnoinst.stamp \
- mad.jar \
- mad/legend.jpg \
- $(JMF_DIR)/lib/customizer.jar \
- $(JMF_DIR)/lib/jmf.jar \
- $(JMF_DIR)/lib/jmf.properties \
- $(JMF_DIR)/lib/mediaplayer.jar \
- $(JMF_DIR)/lib/multiplayer.jar \
- $(JMF_DIR)/readme.html \
- $(JAI_DIR)/COPYRIGHT-jai.txt \
- $(JAI_DIR)/LICENSE-jai.txt \
- $(JAI_DIR)/DISTRIBUTIONREADME-jai.txt \
- $(JAI_DIR)/THIRDPARTYLICENSEREADME-jai.txt \
- $(JAI_DIR)/lib/jai_core.jar \
- $(JAI_DIR)/lib/jai_codec.jar
-
-# Only specify rules for building MAD if javac is available
-if HAVE_JAVAC
-dist_noinst_JAVA = $(JAVA_SOURCES)
-
-mad.jar: mad/manifest.mf \
- $(JMF_DIR)/lib/jmf.jar \
- $(JAI_DIR)/lib/jai_core.jar \
- $(JAI_DIR)/lib/jai_codec.jar \
- classnoinst.stamp
- jar cmf $< $@ \
- -C $(srcdir) mad \
- -C $(srcdir) $(JMF_DIR)/lib/jmf.jar \
- -C $(srcdir) $(JAI_DIR)/lib/jai_core.jar \
- -C $(srcdir) $(JAI_DIR)/lib/jai_codec.jar
- jar uf $@ mad
-
-# Jar files should be cleaned as well
-CLEANFILES = mad.jar
-else
-EXTRA_DIST += $(JAVA_SOURCES)
-endif #HAVE_JAVAC
-
-# Custom clean hook to remove class files
-clean-local:
- -find . -name "*.class" -exec rm {} \;
diff --git a/display/Makefile.in b/display/Makefile.in
deleted file mode 100644
index 775fe80..0000000
--- a/display/Makefile.in
+++ /dev/null
@@ -1,503 +0,0 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
-
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
- at SET_MAKE@
-VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
-am__make_running_with_option = \
- case $${target_option-} in \
- ?) ;; \
- *) echo "am__make_running_with_option: internal error: invalid" \
- "target option '$${target_option-}' specified" >&2; \
- exit 1;; \
- esac; \
- has_opt=no; \
- sane_makeflags=$$MAKEFLAGS; \
- if $(am__is_gnu_make); then \
- sane_makeflags=$$MFLAGS; \
- else \
- case $$MAKEFLAGS in \
- *\\[\ \ ]*) \
- bs=\\; \
- sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
- | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
- esac; \
- fi; \
- skip_next=no; \
- strip_trailopt () \
- { \
- flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
- }; \
- for flg in $$sane_makeflags; do \
- test $$skip_next = yes && { skip_next=no; continue; }; \
- case $$flg in \
- *=*|--*) continue;; \
- -*I) strip_trailopt 'I'; skip_next=yes;; \
- -*I?*) strip_trailopt 'I';; \
- -*O) strip_trailopt 'O'; skip_next=yes;; \
- -*O?*) strip_trailopt 'O';; \
- -*l) strip_trailopt 'l'; skip_next=yes;; \
- -*l?*) strip_trailopt 'l';; \
- -[dEDm]) skip_next=yes;; \
- -[JT]) skip_next=yes;; \
- esac; \
- case $$flg in \
- *$$target_option*) has_opt=yes; break;; \
- esac; \
- done; \
- test $$has_opt = yes
-am__make_dryrun = (target_option=n; $(am__make_running_with_option))
-am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
- at HAVE_JAVAC_FALSE@am__append_1 = $(JAVA_SOURCES)
-subdir = display
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
- $(am__dist_noinst_JAVA_DIST)
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/version.m4 $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
- $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-AM_V_P = $(am__v_P_ at AM_V@)
-am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
-am__v_P_0 = false
-am__v_P_1 = :
-AM_V_GEN = $(am__v_GEN_ at AM_V@)
-am__v_GEN_ = $(am__v_GEN_ at AM_DEFAULT_V@)
-am__v_GEN_0 = @echo " GEN " $@;
-am__v_GEN_1 =
-AM_V_at = $(am__v_at_ at AM_V@)
-am__v_at_ = $(am__v_at_ at AM_DEFAULT_V@)
-am__v_at_0 = @
-am__v_at_1 =
-SOURCES =
-DIST_SOURCES =
-am__can_run_installinfo = \
- case $$AM_UPDATE_INFO_DIR in \
- n|no|NO) false;; \
- *) (install-info --version) >/dev/null 2>&1;; \
- esac
-am__dist_noinst_JAVA_DIST = mad/AlignDAG.java mad/Alignment.java \
- mad/AlignmentPanel.java mad/Alignments.java \
- mad/BatchDocument.java mad/JpegImagesToMovie.java mad/MAD.java \
- mad/MadApplet.java mad/MadPanel.java mad/Node.java \
- mad/ProbabilityMatrices.java mad/PropertyChangeHandler.java \
- mad/PropertyChangeIDs.java mad/SaveAsFastaAction.java \
- mad/SaveAsTiffAction.java mad/SaveAsMovAction.java \
- mad/SparseMatrix.java
-JAVAC = javac
-CLASSPATH_ENV = CLASSPATH=$(JAVAROOT):$(srcdir)/$(JAVAROOT)$${CLASSPATH:+":$$CLASSPATH"}
-am__java_sources = $(dist_noinst_JAVA)
-am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPPFLAGS = @CPPFLAGS@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-EXONERATE_EXEC = @EXONERATE_EXEC@
-GREP = @GREP@
-HAVE_CONDOR = @HAVE_CONDOR@
-HAVE_CONDOR_COMPILE = @HAVE_CONDOR_COMPILE@
-HAVE_JAVAC = @HAVE_JAVAC@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LDFLAGS = @LDFLAGS@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LTLIBOBJS = @LTLIBOBJS@
-MAD_MAIN_CLASS = @MAD_MAIN_CLASS@
-MAKEINFO = @MAKEINFO@
-MKDIR_P = @MKDIR_P@
-MUMMER_EXEC = @MUMMER_EXEC@
-OBJEXT = @OBJEXT@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-RANLIB = @RANLIB@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-VERSION = @VERSION@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-subdirs = @subdirs@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-JAVA_SOURCES = \
- mad/AlignDAG.java \
- mad/Alignment.java \
- mad/AlignmentPanel.java \
- mad/Alignments.java \
- mad/BatchDocument.java \
- mad/JpegImagesToMovie.java \
- mad/MAD.java \
- mad/MadApplet.java \
- mad/MadPanel.java \
- mad/Node.java \
- mad/ProbabilityMatrices.java \
- mad/PropertyChangeHandler.java \
- mad/PropertyChangeIDs.java \
- mad/SaveAsFastaAction.java \
- mad/SaveAsTiffAction.java \
- mad/SaveAsMovAction.java \
- mad/SparseMatrix.java
-
-
-# Root directory for class files (to be passed as -d option to javac)
-JAVAROOT = .
-
-# JMF directory
-JMF_DIR = JMF-2.1.1e
-
-# JAE directory
-JAI_DIR = jai-1_1_3
-
-# Options to pass to javac
-AM_JAVACFLAGS = -extdirs $(srcdir)/$(JMF_DIR)/lib:$(srcdir)/$(JAI_DIR)/lib \
- -source 1.5
-
-
-# Other files that should go into distribution package
-EXTRA_DIST = mad classnoinst.stamp mad.jar mad/legend.jpg \
- $(JMF_DIR)/lib/customizer.jar $(JMF_DIR)/lib/jmf.jar \
- $(JMF_DIR)/lib/jmf.properties $(JMF_DIR)/lib/mediaplayer.jar \
- $(JMF_DIR)/lib/multiplayer.jar $(JMF_DIR)/readme.html \
- $(JAI_DIR)/COPYRIGHT-jai.txt $(JAI_DIR)/LICENSE-jai.txt \
- $(JAI_DIR)/DISTRIBUTIONREADME-jai.txt \
- $(JAI_DIR)/THIRDPARTYLICENSEREADME-jai.txt \
- $(JAI_DIR)/lib/jai_core.jar $(JAI_DIR)/lib/jai_codec.jar \
- $(am__append_1)
-
-# Only specify rules for building MAD if javac is available
- at HAVE_JAVAC_TRUE@dist_noinst_JAVA = $(JAVA_SOURCES)
-
-# Jar files should be cleaned as well
- at HAVE_JAVAC_TRUE@CLEANFILES = mad.jar
-all: all-am
-
-.SUFFIXES:
-$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
- @for dep in $?; do \
- case '$(am__configure_deps)' in \
- *$$dep*) \
- ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
- exit 1;; \
- esac; \
- done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign display/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign display/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- @case '$?' in \
- *config.status*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
- *) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
- esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure: $(am__configure_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): $(am__aclocal_m4_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-
-classnoinst.stamp: $(am__java_sources)
- @list1='$?'; list2=; if test -n "$$list1"; then \
- for p in $$list1; do \
- if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
- list2="$$list2 $$d$$p"; \
- done; \
- echo '$(CLASSPATH_ENV) $(JAVAC) -d $(JAVAROOT) $(AM_JAVACFLAGS) $(JAVACFLAGS) '"$$list2"; \
- $(CLASSPATH_ENV) $(JAVAC) -d $(JAVAROOT) $(AM_JAVACFLAGS) $(JAVACFLAGS) $$list2; \
- else :; fi
- echo timestamp > $@
-
-clean-noinstJAVA:
- -rm -f *.class classnoinst.stamp
-tags TAGS:
-
-ctags CTAGS:
-
-cscope cscopelist:
-
-
-distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
- cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
- else \
- test -f "$(distdir)/$$file" \
- || cp -p $$d/$$file "$(distdir)/$$file" \
- || exit 1; \
- fi; \
- done
-check-am: all-am
-check: check-am
-all-am: Makefile classnoinst.stamp
-installdirs:
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
- if test -z '$(STRIP)'; then \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- install; \
- else \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
- fi
-mostlyclean-generic:
-
-clean-generic:
- -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
-
-distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-
-maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-local clean-noinstJAVA mostlyclean-am
-
-distclean: distclean-am
- -rm -f Makefile
-distclean-am: clean-am distclean-generic
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-html-am:
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-html-am:
-
-install-info: install-info-am
-
-install-info-am:
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
- -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-generic
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am:
-
-.MAKE: install-am install-strip
-
-.PHONY: all all-am check check-am clean clean-generic clean-local \
- clean-noinstJAVA cscopelist-am ctags-am distclean \
- distclean-generic distdir dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
- install-html-am install-info install-info-am install-man \
- install-pdf install-pdf-am install-ps install-ps-am \
- install-strip installcheck installcheck-am installdirs \
- maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-generic pdf pdf-am ps ps-am tags-am uninstall \
- uninstall-am
-
-all: mad.jar
-
- at HAVE_JAVAC_TRUE@mad.jar: mad/manifest.mf \
- at HAVE_JAVAC_TRUE@ $(JMF_DIR)/lib/jmf.jar \
- at HAVE_JAVAC_TRUE@ $(JAI_DIR)/lib/jai_core.jar \
- at HAVE_JAVAC_TRUE@ $(JAI_DIR)/lib/jai_codec.jar \
- at HAVE_JAVAC_TRUE@ classnoinst.stamp
- at HAVE_JAVAC_TRUE@ jar cmf $< $@ \
- at HAVE_JAVAC_TRUE@ -C $(srcdir) mad \
- at HAVE_JAVAC_TRUE@ -C $(srcdir) $(JMF_DIR)/lib/jmf.jar \
- at HAVE_JAVAC_TRUE@ -C $(srcdir) $(JAI_DIR)/lib/jai_core.jar \
- at HAVE_JAVAC_TRUE@ -C $(srcdir) $(JAI_DIR)/lib/jai_codec.jar
- at HAVE_JAVAC_TRUE@ jar uf $@ mad
-
-# Custom clean hook to remove class files
-clean-local:
- -find . -name "*.class" -exec rm {} \;
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/display/classnoinst.stamp b/display/classnoinst.stamp
deleted file mode 100644
index 9788f70..0000000
--- a/display/classnoinst.stamp
+++ /dev/null
@@ -1 +0,0 @@
-timestamp
diff --git a/display/mad/AlignDAG.java b/display/mad/AlignDAG.java
deleted file mode 100644
index 35fe9a7..0000000
--- a/display/mad/AlignDAG.java
+++ /dev/null
@@ -1,641 +0,0 @@
-
-/*
- * This file is part of FSA, a sequence alignment algorithm.
- * Source code in this file was written by Adam Roberts.
- * Code for different accuracy measures was written by Robert Bradley.
- */
-
-
-package mad;
-
-import java.util.*;
-//import it.unimi.dsi.fastutil.objects.*;
-
-public class AlignDAG{
-
- private Node[] V; // Vertices in our order.
- private Node[] oV; // Vertices in AMAP's order.
- private Node[] startV; // Vertices that begin each sequence
- private HashMap<Node, Node> mergeDict;
-
- private double acc;
- private double sps;
- private double ppv;
- private double cert;
- private double cons;
-
- private double accDenom;
- private double spsDenom;
- private double ppvDenom;
- private double certDenom;
- private double consDenom;
-
- private double deltaAccNorm;
- private double deltaSPSNorm;
- private double deltaPPVNorm;
- private double deltaCertNorm;
- private double deltaConsNorm;
-
- private double gapFactorCurrent; /// the current gap factor
-
- private int colorScheme;
- private int mergeOrder;
-
- private Set<Node> activeNodes;
- private int numSeqs;
-
- public AlignDAG (List<String> keys, String[] sequences, HashMap<String, Integer> initDAG, ProbabilityMatrices pm) {
- this.mergeDict = new HashMap<Node, Node>();
- this.numSeqs = sequences.length;
-
- this.colorScheme = 0;
- this.mergeOrder = 0;
-
- buildDagFromInit(keys, sequences, initDAG, pm);
- }
-
- public AlignDAG (List<String> keys, String[] sequences, String[] alignedSeqs, ProbabilityMatrices pm){
- this.mergeDict = new HashMap<Node, Node>();
- this.numSeqs = sequences.length;
-
- this.colorScheme = 0;
- this.mergeOrder = 0;
-
- buildDagFromAlign(keys, sequences, alignedSeqs, pm);
- }
-
- /// Update color scheme for all active nodes.
- /*
- * Forces re-coloring of all columns according to the new scheme.
- */
- public void setColorScheme(int scheme) {
- this.colorScheme = scheme;
- Iterator iter = activeNodes.iterator();
- while (iter.hasNext()) {
- ((Node)iter.next()).setColorScheme(scheme);
- }
- }
-
- private void buildDagFromAlign(List<String> keys, String[] sequences, String[] alignedSeqs, ProbabilityMatrices pm){
-
- acc = 0;
- sps = 0;
- ppv = 0;
- cert = 0;
- cons = 0;
-
- accDenom = 0;
- spsDenom = 0;
- ppvDenom = 0;
- certDenom = 0;
- consDenom = 0;
-
- deltaAccNorm = 0;
- deltaSPSNorm = 0;
- deltaPPVNorm = 0;
- deltaCertNorm = 0;
- deltaConsNorm = 0;
-
- gapFactorCurrent = -1;
-
- //Find total length of all sequences and initialize nextIndex array
- int[] nextIndex = new int[numSeqs];
-
- for(int i = 0; i < numSeqs; i++)
- nextIndex[i] = 0;
-
- Node lastV = null;
-
- int alignLength = alignedSeqs[0].length();
- this.V = new Node[alignLength];
- this.activeNodes = new HashSet<Node>();
-
- //Ensure rows are flush.
- for(int i = 0; i < numSeqs; i++){
- if (alignedSeqs[i].length() != alignLength){
- System.err.println("ERROR: Alternate alignment rows are not flush.");
- System.exit(-1);
- }
- }
-
- //Ensure sequences match.
- for (int i = 0; i < alignLength; i++){
- int[] seqIndices = new int[numSeqs];
- int presentSeqs = 0;
- int seqI = -1;
-
- for(int j = 0; j < numSeqs; j++){
- char c = alignedSeqs[j].charAt(i);
- if (c == '-'){
- seqIndices[j] = -1;
- }
- else if (sequences[j].length() > nextIndex[j] && c == sequences[j].charAt(nextIndex[j])){
- seqIndices[j] = nextIndex[j]++;
- presentSeqs++;
- seqI = j;
- }
- else{
- System.err.println("ERROR: Sequences in alternate alignment do not match; offending sequence is '" + keys.get(j) + "'.");
- System.exit(-1);
- }
- }
-
- Node v = new Node(seqIndices, seqI, pm);
- v.isMerge = (presentSeqs > 1);
- v.setColorScheme (colorScheme);
- this.V[i] = v;
- this.mergeDict.put(v,v);
-
- this.acc += v.getAcc();
- this.sps += v.getSPS();
- this.ppv += v.getPPV();
- this.cert += v.getCert();
- this.cons += v.getCons();
-
- this.accDenom += v.getAccDenom();
- this.spsDenom += v.getSPSDenom();
- this.ppvDenom += v.getPPVDenom();
- this.certDenom += v.getCertDenom();
- this.consDenom += v.getConsDenom();
-
- this.activeNodes.add(v);
-
- if (lastV != null)
- lastV.fwdEdge = v;
- lastV = v;
-
- }
-
- //Ensure we've reached the end of the original sequence.
- for (int i = 0; i < numSeqs; i++){
- if (nextIndex[i] != sequences[i].length()){
- System.err.println("ERROR: Sequences in alternate alignment do not match; offending sequence is '" + keys.get(i) + "'.");
- System.exit(-1);
- }
- }
-
- this.startV = V;
-
- }
-
- private void buildDagFromInit(List<String> keys, String[] sequences, HashMap<String, Integer> initDAG, ProbabilityMatrices pm){
- Node lastV;
- String seq;
-
- acc = 0;
- sps = 0;
- ppv = 0;
- cert = 0;
- cons = 0;
-
- accDenom = 0;
- spsDenom = 0;
- ppvDenom = 0;
- certDenom = 0;
- consDenom = 0;
-
- deltaAccNorm = 0;
- deltaSPSNorm = 0;
- deltaPPVNorm = 0;
- deltaCertNorm = 0;
- deltaConsNorm = 0;
-
- gapFactorCurrent = -1;
-
- //Find total length of all sequences
- int totalLength = 0;
- for (int i = 0; i < this.numSeqs; i++){
- totalLength += sequences[i].length();
- }
-
- this.V = new Node[totalLength];
- this.oV = new Node[totalLength];
- this.startV = new Node[numSeqs];
- this.activeNodes = new HashSet<Node>();
-
- int k = 0;
- for (int i = 0; i < this.numSeqs; i++){ // iterate through array of sequences
- lastV = null;
- seq = sequences[i];
-
- for (int j = 0; j < seq.length(); j++){ // iterate through sequence
-
- // Initialize empty column and indices arrays
- Node v = new Node(i, j, pm);
- v.setColorScheme (colorScheme);
- this.V[k] = v;
- // this.oV[initDAG.get(i + "." + (j+1))] = v; //j+1 because index starts at 1
- this.oV[initDAG.get(i + "." + j)] = v; // j because index starts at 0
- this.mergeDict.put(v,v);
-
- this.acc += v.getAcc();
- this.sps += v.getSPS();
- this.ppv += v.getPPV();
- this.cert += v.getCert();
- this.cons += v.getCons();
-
- this.accDenom += v.getAccDenom();
- this.spsDenom += v.getSPSDenom();
- this.ppvDenom += v.getPPVDenom();
- this.certDenom += v.getCertDenom();
- this.consDenom += v.getConsDenom();
-
- this.activeNodes.add(v);
- if (lastV != null)
- lastV.fwdEdge = v;
- else
- startV[i] = v;
- lastV = v;
- k++;
- }
- }
- }
-
- /// Get normalized accuracy for alignment.
- /*
- * \return accuracy, or -1 if undefined
- * Performs bounds-checking.
- */
- public double getAlignAccNorm(){
- if (accDenom == 0.)
- return -1;
- return SparseMatrix.saneProb (acc / accDenom);
- }
-
- /// Get normalized SPS for alignment.
- /*
- * \return SPS, or -1 if undefined
- */
- public double getAlignSPSNorm(){
- if (spsDenom == 0.)
- return -1;
- return SparseMatrix.saneProb (sps / spsDenom);
- }
-
- /// Get normalized PPV for alignment.
- /*
- * \return PPV, or -1 if undefined
- */
- public double getAlignPPVNorm(){
- if (ppvDenom == 0.)
- return -1;
- return SparseMatrix.saneProb (ppv / ppvDenom);
- }
-
- /// Get normalized certainty for alignment.
- /*
- * \return certainty, or -1 if undefined
- */
- public double getAlignCertNorm(){
- if (certDenom == 0.)
- return -1;
- return SparseMatrix.saneProb (Node.normalizedCertainty (cert / certDenom));
- }
-
- /// Get normalized consistency for alignment.
- /*
- * \return consistency, or -1 if undefined
- */
- public double getAlignConsNorm(){
- if (consDenom == 0.)
- return -1;
- return SparseMatrix.saneProb (cons / consDenom);
- }
-
- /// Get the change in normalized accuracy.
- public double getDeltaAccNorm(){
- return deltaAccNorm;
- }
-
- /// Get the change in normalized SPS.
- public double getDeltaSPSNorm(){
- return deltaSPSNorm;
- }
-
- /// Get the change in normalized PPV.
- public double getDeltaPPVNorm(){
- return deltaPPVNorm;
- }
-
- /// Get the change in normalized certainty.
- public double getDeltaCertNorm(){
- return deltaCertNorm;
- }
-
- /// Get the change in normalized consistency.
- public double getDeltaConsNorm(){
- return deltaConsNorm;
- }
-
- /// Get the implicit current gap factor.
- /*
- * -1 if Infinity, implicit current gap factor otherwise
- */
- public double getGapFactor(){
- return gapFactorCurrent;
- }
-
- /// Merge two nodes.
- /*
- * @param i index of source node in oV
- * @param j index of dest node in oV
- */
- public void merge(int i, int j){
-
- Node n1 = this.mergeDict.get(this.oV[i]);
- Node n2 = this.mergeDict.get(this.oV[j]);
-
- Node m = new Node(n1, n2, mergeOrder++);
- m.setColorScheme (colorScheme);
-
- // now update accuracies after the merge
- // note that the calculation must be done on the unnormalized accuracies
- deltaAccNorm = m.getAcc() - (n1.getAcc() + n2.getAcc());
- deltaAccNorm /= (1.0 * m.getAccDenom());
-
- deltaSPSNorm = m.getSPS() - (n1.getSPS() + n2.getSPS());
- deltaSPSNorm /= (1.0 * m.getSPSDenom());
-
- deltaPPVNorm = m.getPPV() - (n1.getPPV() + n2.getPPV());
- deltaPPVNorm /= (1.0 * m.getPPVDenom());
-
- deltaCertNorm = m.getCert() - (n1.getCert() + n2.getCert());
- deltaCertNorm /= (1.0 * m.getCertDenom());
-
- deltaConsNorm = m.getCons() - (n1.getCons() + n2.getCons());
- deltaConsNorm /= (1.0 * m.getConsDenom());
-
- gapFactorCurrent = m.getWeightTgf();
-
-// System.err.println ("m.getSPS() = " + m.getSPS()
-// + "m.getSPSDenom() = " + m.getSPSDenom()
-// + "; n1.getSPS() = " + n1.getSPS() + "; n2.getSPS() = " + n2.getSPS()
-// + "; n1.getSPSDenom() = " + n1.getSPSDenom() + "; n2.getSPSDenom() = " + n2.getSPSDenom());
-
- acc += m.getAcc() - (n1.getAcc() + n2.getAcc());
- sps += m.getSPS() - (n1.getSPS() + n2.getSPS());
- ppv += m.getPPV() - (n1.getPPV() + n2.getPPV());
- cert += m.getCert() - (n1.getCert() + n2.getCert());
- cons += m.getCons() - (n1.getCons() + n2.getCons());
-
- accDenom += m.getAccDenom() - (n1.getAccDenom() + n2.getAccDenom());
- spsDenom += m.getSPSDenom() - (n1.getSPSDenom() + n2.getSPSDenom());
- ppvDenom += m.getPPVDenom() - (n1.getPPVDenom() + n2.getPPVDenom());
- certDenom += m.getCertDenom() - (n1.getCertDenom() + n2.getCertDenom());
- consDenom += m.getConsDenom() - (n1.getConsDenom() + n2.getConsDenom());
-
- activeNodes.remove(n1);
- activeNodes.remove(n2);
- activeNodes.add(m);
- updateMergeDict(m, m);
- }
-
- /// Demerge a nodes.
- /*
- * @param i index of node to demerge in oV
- * @param k index of node in oV
- *
- * The index k is necessary in order to update the gap factor
- * after demerging a node.
- */
- public void demerge(int i, int k){
-
- --mergeOrder;
-
- Node m = this.mergeDict.get(this.oV[i]);
- Node n1 = m.n1;
- Node n2 = m.n2;
-
- n1.setColorScheme (colorScheme);
- n2.setColorScheme (colorScheme);
-
- // this calculation must be done on the unnormalized accuracies
- deltaAccNorm = (n1.getAcc() + n2.getAcc()) - m.getAcc();
- deltaAccNorm /= (1.0 * m.getAccDenom());
-
- deltaSPSNorm = (n1.getSPS() + n2.getSPS()) - m.getSPS();
- deltaSPSNorm /= (1.0 * m.getSPSDenom());
-
- deltaPPVNorm = (n1.getPPV() + n2.getPPV()) - m.getPPV();
- deltaPPVNorm /= (1.0 * m.getPPVDenom());
-
- deltaCertNorm = (n1.getCert() + n2.getCert()) - m.getCert();
- deltaCertNorm /= (1.0 * m.getCertDenom());
-
- deltaConsNorm = (n1.getCons() + n2.getCons()) - m.getCons();
- deltaConsNorm /= (1.0 * m.getConsDenom());
-
- // decrement the gap factor: look up the gap factor for the previous merge
- if (k >= 0)
- gapFactorCurrent = (this.mergeDict.get(this.oV[k])).getWeightTgf();
- else // if no previous merge, set to dummy value
- gapFactorCurrent = -1;
-
- acc += (n1.getAcc() + n2.getAcc()) - m.getAcc();
- sps += (n1.getSPS() + n2.getSPS()) - m.getSPS();
- ppv += (n1.getPPV() + n2.getPPV()) - m.getPPV();
- cert += (n1.getCert() + n2.getCert()) - m.getCert();
- cons += (n1.getCons() + n2.getCons()) - m.getCons();
-
- accDenom += (n1.getAccDenom() + n2.getAccDenom()) - m.getAccDenom();
- spsDenom += (n1.getSPSDenom() + n2.getSPSDenom()) - m.getSPSDenom();
- ppvDenom += (n1.getPPVDenom() + n2.getPPVDenom()) - m.getPPVDenom();
- certDenom += (n1.getCertDenom() + n2.getCertDenom()) - m.getCertDenom();
- consDenom += (n1.getConsDenom() + n2.getConsDenom()) - m.getConsDenom();
-
- if (mergeDict.containsKey(m)){
- System.out.println("found it!");
- }
-
- activeNodes.remove(m);
- activeNodes.add(n1);
- activeNodes.add(n2);
- updateMergeDict(n1, n1);
- updateMergeDict(n2, n2);
- }
-
- private void updateMergeDict(Node n, Node m){
- if (n.isMerge){
- Node n1 = n.n1;
- Node n2 = n.n2;
-
- updateMergeDict(n1, m);
- updateMergeDict(n2, m);
- }
- else
- this.mergeDict.put(n, m);
- }
-
- public Node[] topoSort(){
- Stack<Node> toVisit = new Stack<Node>();
- Node u, v, w;
- Comparator<Node> byRevFinishTime = new NodeFinishTimeComparator();
- int time = 0;
-
- Iterator<Node> iter = activeNodes.iterator();
- while (iter.hasNext()) {
- v = iter.next();
- v.visited = false;
- v.finishTime = -1;
- }
-
- for (int i = 0; i < numSeqs; i++){
- u = mergeDict.get(startV[i]);
-
-// System.out.print ("outer loop: ");
-// u.output();
-
- if (!u.visited){
- toVisit.push(u);
-// System.out.print (" pushed: ");
-// u.output();
- }
-
- while (!toVisit.empty()){
- v = toVisit.pop();
-// System.out.print (" popped: ");
-// v.output();
- if (v.visited){
- if (v.finishTime < 0) // if not finished
- v.finishTime = time++;
- }
- else{
- v.visited = true;
- toVisit.push(v);
-// System.out.print (" pushed: ");
-// v.output();
-
- Node[] edges = processEdges(v.getFwdEdges());
- for(int j = 0; j < edges.length; j++) {
- w = edges[j];
-
- if (!w.visited){
- toVisit.push(w);
-// System.out.print (" pushed ");
-// w.output();
- }
- }
- }
- }
- }
-
- iter = activeNodes.iterator();
-
- Node[] L = activeNodes.toArray(new Node[0]);
- Arrays.sort(L, byRevFinishTime);
- return L;
- }
-
- // Maps edges to their merged version and sorts array
- private Node[] processEdges(Collection<Node> edges){
- Node[] edgeArray = new Node[edges.size()];
- Iterator<Node> iter = edges.iterator();
-
- int i = 0;
- while (iter.hasNext())
- edgeArray[i++] = mergeDict.get(iter.next());
-
- if (edgeArray.length > 1){
- Comparator<Node> byNodeSequence = new NodeSequenceComparator();
- Arrays.sort(edgeArray, byNodeSequence);
- MySorter sorter = new MySorter();
- edgeArray = sorter.sort(edgeArray);
- }
- return edgeArray;
- }
-
-
-
- private void checkSort(mad.Node[] nArray){
- int[] maxArray = new int[numSeqs];
- Node v;
-
- for(int i = 0; i < numSeqs; i++){
- maxArray[i] = -1;
- }
- for(int i = 0; i < nArray.length; i++){
- v = nArray[i];
- int[] seqIndices = v.getSeqIndices();
- for(int j = 0; j < numSeqs; j++){
- if (seqIndices[j] != -1 && maxArray[j] > seqIndices[j]){
- System.err.println("Sanity check failed!");
- System.exit(-1);
- }
- else if (seqIndices[j] != -1)
- maxArray[j] = seqIndices[j];
- }
- }
- }
-}
-
-class MySorter{
-
-
- public MySorter(){}
-
- public Node[] sort(Node[] nArray){
- boolean isSorted = false;
- int[] maxArray;
- int numSeqs = nArray[0].pm.numSeqs;
- Node v;
-
- while (!isSorted){
- isSorted = true;
- maxArray = new int[numSeqs];
- for(int i = 0; i < numSeqs; i++){
- maxArray[i] = -1;
- }
- for(int i = 0; i < nArray.length; i++){
- v = nArray[i];
- boolean switched = false;
- int[] seqIndices = v.getSeqIndices();
- for(int j = 0; j < numSeqs; j++){
- if (seqIndices[j] != -1 && maxArray[j] > seqIndices[j]){
- if (!switched){
- switchNodes(nArray, i-1, i);
- switched = true;
- isSorted = false;
- }
- }
- else if (seqIndices[j] != -1)
- maxArray[j] = seqIndices[j];
- }
- }
- }
- return nArray;
- }
-
-
- private Node[] switchNodes(Node[] nArray, int i, int j){
- Node temp = nArray[i];
- nArray[i] = nArray[j];
- nArray[j] = temp;
- return nArray;
- }
-}
-
-class NodeFinishTimeComparator implements Comparator<Node> {
-
- public int compare(Node n1, Node n2){
- if (n1.finishTime > n2.finishTime)
- return -1;
- return 1;
- }
-}
-
-class NodeSequenceComparator implements Comparator<Node>{
-
- public int compare(Node n1, Node n2){
- int[] seq1Indices = n1.getSeqIndices();
- int[] seq2Indices = n2.getSeqIndices();
- for (int i = 0; i < seq1Indices.length; i++){
-
- if (seq1Indices[i] != -1 && seq2Indices[i] != -1)
- if (seq1Indices[i] < seq2Indices[i])
- return -1;
- else
- return 1;
- }
- return 0;
- }
-}
diff --git a/display/mad/Alignment.java b/display/mad/Alignment.java
deleted file mode 100644
index fd37cbf..0000000
--- a/display/mad/Alignment.java
+++ /dev/null
@@ -1,328 +0,0 @@
-
-/*
- * This file is part of FSA, a sequence alignment algorithm.
- * Source code in this file was written by Adam Roberts.
- * Code for different accuracy measures was written by Robert Bradley.
- */
-
-package mad;
-
-import java.util.*;
-
-public class Alignment {
-
- Node[] L; // nodes in topologically sorted order
- String[] seqs;
- String[] cols;
- List<String> keys;
- AlignDAG aDag;
- String[] fullSequences;
- boolean gapsSuppressed;
- int colorScheme;
-
- public Alignment(List<String> keys, String[] fullSequences, AlignDAG aDag, boolean suppressGaps, int colorScheme) {
- this.keys = keys;
- this.fullSequences = fullSequences;
- this.aDag = aDag;
- this.colorScheme = colorScheme;
- buildSeqsAndCols(suppressGaps, colorScheme);
- }
-
-
- public void buildSeqsAndCols(boolean suppressGaps, int scheme){
-
- // update color scheme
- this.colorScheme = scheme;
-
- int N = keys.size();
-
- // Initialize empty StringBuffer array and sanity check
- StringBuffer[] cols = new StringBuffer[N];
- StringBuffer[] seqs = new StringBuffer[N];
- int[] sanityCheck = new int[N];
- for (int i = 0; i < N; i++){
- seqs[i] = new StringBuffer();
- cols[i] = new StringBuffer();
- sanityCheck[i] = 0;
- }
-
- StringBuffer color = new StringBuffer();
- char[] colors;
- int[] seqIndices;
- Node v;
-
- // update color scheme
- aDag.setColorScheme (colorScheme);
- L = aDag.topoSort();
-
- //Gap suppression variables
- int [] gapCounts = new int[1];
- int gapCountDown = 0;
- int lastGapCount = 0;
- int[] colorSum = new int[N];
- if (suppressGaps)
- gapCounts = getGapCounts(L);
-
-
- // Hide consecutive graps of length greater than 3.
- for(int i = 0; i < L.length; i++){
-
- v = L[i];
-
- int[] sI = v.getSeqIndices();
- for (int z = 0; z<N; z++){
- if (sI[z] != -1){
- if (sI[z] != sanityCheck[z])
- System.err.println("ERROR: " + z + " " + sI[z] + " " + sanityCheck[z]);
- sanityCheck[z] ++;
- }
- }
-
- //Handle gap suppression...
- if (!suppressGaps){}
-
- else if (gapCountDown-- == 1){
- colorSum = sumArrays(colorSum, v.getColors());
- String[][] gapFill = getGapFill(lastGapCount, colorSum, v.seqI);
- for (int j = 0; j < N; j++){
- seqs[j].append(gapFill[j][0]);
- cols[j].append(gapFill[j][1]);
- }
- continue;
- }
-
- else if (gapCountDown+1 > 0){ // Adding 1 because we already decremented
- colorSum = sumArrays(colorSum, v.getColors());
- continue;
- }
-
- else if ((lastGapCount = gapCounts[i]) > 3){
- gapCountDown = lastGapCount - 1;
- colorSum = new int[N];
- for (int x = 0; x < N; x++)
- colorSum[x] = 0;
- colorSum = sumArrays(colorSum, v.getColors());
- continue;
- }
- //...done handling gap suppression.
-
-
- colors = v.getColors();
- seqIndices = v.getSeqIndices();
-
- for (int j = 0; j < N; j++){
- if (seqIndices[j] == -1)
- seqs[j].append('-');
- else
- seqs[j].append(fullSequences[j].charAt(seqIndices[j]));
- cols[j].append(colors[j]);
- }
- }
-
- // Convert StringBuffers to Strings
- this.cols = new String[N];
- this.seqs = new String[N];
-
- for (int i = 0; i < N; i++){
- this.cols[i] = cols[i].toString();
- this.seqs[i] = seqs[i].toString();
- }
-
- this.gapsSuppressed = suppressGaps;
-
- }
-
- // Creates an array specifying how many consecutive gaps follow at each starting point (i).
- public int[] getGapCounts(Node[] L){
-
- int[] gapCounts = new int[L.length];
- int lastCount = 0;
- int lastSeqI = -1;
- Node u;
-
- for (int i = L.length-1; i>=0; i--){
- u = L[i];
-
- if (u.isMerge){
- lastCount = 0;
- gapCounts[i] = 0;
- }
- else{
- if (lastSeqI != u.seqI)
- lastCount = 0;
- gapCounts[i] = ++lastCount;
- lastSeqI = u.seqI;
- }
- }
-
- return gapCounts;
- }
-
- private int[] sumArrays(int[] a1, char[] a2){
- for (int i = 0; i < a1.length; i ++){
- int c = (int)a2[i];
- if (c > 256) // Remove highlighting
- c -= 256;
- a1[i] += c;
-
- }
- return a1;
- }
-
- // Returns a sequences to suppress a gap of size nGaps.
- private String[][] getGapFill(int nGaps, int[] colorSum, int seqI){
- //String nonGapSeq = "\u25B6" + nGaps + "\u25C0";
- String nonGapSeq = ">" + nGaps + "<";
- StringBuffer col;
- StringBuffer seq;
-
- int N = keys.size();
-
- String[][] results = new String[N][2];
-
- char avgColor;
-
- for (int i = 0; i < N; i ++){
- seq = new StringBuffer("");
- col = new StringBuffer("");
- avgColor = (char)Math.rint(colorSum[i]/nGaps);
- for (int j = 0; j < nonGapSeq.length(); j++){
- seq.append('-');
- col.append(avgColor);
- }
- results[i][0] = seq.toString();
- results[i][1] = col.toString();
- }
-
- results[seqI][0] = nonGapSeq;
-
- return results;
- }
-
-
- public List<String> getOrderedKeys() {
- return keys;
- }
-
- public String[] getSequences() {
- return seqs;
- }
-
- public String[] getColors() {
- return cols;
- }
-
- /// Get normalized accuracy for alignment.
- /*
- * \return accuracy, or -1 if undefined
- */
- public double getAccNorm() {
- return aDag.getAlignAccNorm();
- }
-
- /// Get normalized SPS for alignment.
- /*
- * \return SPS, or -1 if undefined
- */
- public double getSPSNorm() {
- return aDag.getAlignSPSNorm();
- }
-
- /// Get normalized PPV for alignment.
- /*
- * \return PPV, or -1 if undefined
- */
- public double getPPVNorm() {
- return aDag.getAlignPPVNorm();
- }
-
- /// Get normalized certainty for alignment.
- /*
- * \return certainty, or -1 if undefined
- */
- public double getCertNorm() {
- return aDag.getAlignCertNorm();
- }
-
- /// Get normalized consistency for alignment.
- /*
- * \return consistency, or -1 if undefined
- */
- public double getConsNorm() {
- return aDag.getAlignConsNorm();
- }
-
- /// Get the change in normalized accuracy.
- public double getDeltaAccNorm(){
- return aDag.getDeltaAccNorm();
- }
-
- /// Get the change in normalized SPS.
- public double getDeltaSPSNorm(){
- return aDag.getDeltaSPSNorm();
- }
-
- /// Get the change in normalized PPV.
- public double getDeltaPPVNorm(){
- return aDag.getDeltaPPVNorm();
- }
-
- /// Get the change in normalized certainty.
- public double getDeltaCertNorm(){
- return aDag.getDeltaCertNorm();
- }
-
- /// Get the change in normalized consistency.
- public double getDeltaConsNorm(){
- return aDag.getDeltaConsNorm();
- }
-
- /// Get the implicit gap factor.
- /*
- * \return -1 if Infinity, implicit current gap factor otherwise
- */
- public double getGapFactor(){
- return aDag.getGapFactor();
- }
-
- public String toString() {
- StringBuffer sb = new StringBuffer();
- sb.append("Weight = ");
- sb.append((new Double(getAccNorm())).toString());
- sb.append("\n");
- int i = 0;
- for ( String key : keys ) {
- sb.append(key);
- sb.append("\t");
- sb.append(seqs[i]);
- sb.append("\n");
- i++;
- }
- sb.append("\n");
- sb.append("\n");
-
- return sb.toString();
- }
-
- public String toMultiFasta() {
- if (gapsSuppressed) // This is so that the sequences will be saved without gaps suppression
- buildSeqsAndCols(false, 0); // throwaway color scheme
-
- StringBuffer sb = new StringBuffer();
- int i = 0;
-
- for ( String key : keys ) {
- sb.append(">");
- sb.append(key);
- sb.append("\n");
- sb.append(seqs[i]);
- sb.append("\n");
- i++;
- }
-
- if (gapsSuppressed)
- buildSeqsAndCols(true, 0); // throwaway color scheme
-
- return sb.toString();
- }
-}
diff --git a/display/mad/AlignmentPanel.java b/display/mad/AlignmentPanel.java
deleted file mode 100644
index 42f780a..0000000
--- a/display/mad/AlignmentPanel.java
+++ /dev/null
@@ -1,337 +0,0 @@
-
-/*
- * This file is part of FSA, a sequence alignment algorithm.
- * Source code in this file was written by Michael Smoot and Adam Roberts.
- */
-
-
-package mad;
-
-
-import javax.swing.*;
-import javax.swing.text.*;
-import java.util.*;
-import java.awt.event.*;
-import java.awt.Dimension;
-import java.awt.Color;
-import java.awt.Font;
-import java.awt.FontMetrics;
-import java.awt.Graphics;
-import java.awt.font.FontRenderContext;
-
-import java.io.*;
-import java.awt.*;
-import java.awt.image.*;
-import com.sun.image.codec.jpeg.*;
-import javax.media.jai.*;
-import com.sun.media.jai.codec.*;
-
-public class AlignmentPanel extends JTextPane implements ComponentListener, MouseListener {
-
- Alignments aligns;
- String[] orderedKeys;
- HashMap<Integer, Integer> caretToNode;
- int index;
- int numCharsAcross;
- int nameWidth;
- int glyphWidth;
- int glyphHeight;
- int len;
- Font defaultFont;
- int height;
- int width;
- int os;
- int currPaintIndex;
-
- boolean colored;
-
- public AlignmentPanel(Alignments aligns, int initWidth, boolean colored) {
- super();
- this.addMouseListener(this);
- this.aligns = aligns;
- this.width = initWidth;
- this.colored = colored;
- String[] seqs = aligns.get(0).getSequences();
-
- nameWidth = 0;
- for (String key : aligns.keys)
- nameWidth = Math.max(nameWidth, key.length());
- nameWidth += 2;
-
-
- orderedKeys = new String[aligns.keys.size()];
- int i = 0;
- for (String key : aligns.keys){
- StringBuffer blanks = new StringBuffer("");
- for (int j = 0; j < nameWidth-key.length(); j++)
- blanks.append(" ");
- orderedKeys[i++] = " " + key + blanks;
- }
-
-
- defaultFont = new Font("Courier",Font.BOLD,12);
- glyphWidth=10;
- glyphHeight=10;
-
- index = 0;
- currPaintIndex = -2;
-
- // Aaaaargh
- if ( System.getProperty("os.name").matches(".*[Mm][Aa][Cc].*") )
- os = -1;
- else
- os = 1;
-
- this.setEditable(false);
-
- sizeScreen( new Dimension(initWidth,0) );
- }
-
-
- private void sizeScreen(Dimension d) {
- width = (int)(d.getWidth());
-
- // find the width of the sequence name
- FontMetrics fm = getFontMetrics(defaultFont);
-
- glyphWidth = fm.charWidth('W');
- glyphHeight = fm.getHeight();
-
-
- // figure out how many multiple alignment rows there will be
- int seqAllowedWidth = width - 20 - 2*glyphWidth - nameWidth*glyphWidth - 2*glyphWidth - 20;
- numCharsAcross = seqAllowedWidth/glyphWidth;
-
- if (numCharsAcross > 0){
- currPaintIndex = -2;
- paint();
- }
-
- revalidate();
- }
-
-
- public void setIndex(int i) {
- if ( i >= -1 && i < aligns.size() ){
- index = i;
- paint();
- }
- else
- System.out.println("invalid index: " + i);
- }
-
- // The primitive type 'char' in Java acts as an unsigned int taking
- // values from 0 to 2^16 (65,536).
-
- public void paint() {
-
- if (index == currPaintIndex)
- return;
-
- caretToNode = new HashMap<Integer, Integer>();
- //System.out.println("Starting paint: " + index );
- String[] seqs = aligns.get(index).getSequences();
- String[] cols = aligns.get(index).getColors();
-
-
- BatchDocument doc = new BatchDocument();
- Style style = (Style) doc.getStyle(StyleContext.DEFAULT_STYLE);
- StyleConstants.setFontFamily(style, "Courier");
- StyleConstants.setBold(style, true);
- StyleConstants.setFontSize(style, defaultFont.getSize());
-
- int pos = 0;
- int caretPos = 0;
-
- while (pos < seqs[0].length()){
-
- for (int i = 0; i < orderedKeys.length; i++ ) {
- String name = orderedKeys[i];
- String seq = seqs[i];
- String colString = cols[i];
-
- if ( seq == null )
- continue;
-
- StyleConstants.setForeground(style, Color.black);
- StyleConstants.setBackground(style, Color.white);
- doc.appendBatchString(name, style);
- caretPos += name.length();
- StyleConstants.setForeground(style, Color.white);
-
- for(int j = pos; j < pos+numCharsAcross && j < seq.length() ; j++){
-
- // get color code
- // see Node::getColors() for a description of the encoding used
- int colCode = new Integer(colString.charAt(j));
-
- if (colored) {
- // if highlighted
- if (colCode == 65535) {
- StyleConstants.setBackground(style, Color.black);
- }
- // if undefined
- else if (colCode == 256) {
- StyleConstants.setBackground(style, Color.lightGray);
- }
- // else regular coloration based on accuracy measure
- else{
- StyleConstants.setBackground(style, getColorFromCode(colCode));
- }
- }
-
- else {
- StyleConstants.setForeground(style, Color.black);
- StyleConstants.setBackground(style, Color.lightGray);
-
- // StyleConstants.setBackground(style, Color.lightGray);
- }
-
-
- doc.appendBatchString(seq.substring(j,j+1), style);
-
- caretToNode.put(caretPos++, j);
- }
- doc.appendBatchLineFeed(style);
- caretPos++;
- }
- pos += numCharsAcross;
- doc.appendBatchLineFeed(style);
- caretPos++;
- }
-
- try{ doc.processBatchUpdates(0);}
- catch (BadLocationException badLocationException) {System.err.println("Oops");}
- //System.out.println("Setting document: " + index);
- this.setStyledDocument(doc);
- //System.out.println("Finished paint: " + index + "\n");
-
- currPaintIndex = index;
- }
-
- public void setColored(boolean colored){
- this.colored = colored;
- }
-
- public Color getColorFromCode(int colCode){
- if (colCode >= 256){ //Highlighted
- return Color.black;
- }
- int r = (int)Math.max(Math.round(-0.015564*(colCode-127)*(colCode-382)),0);
- int g = (int)Math.max(Math.round(-0.015564*(colCode)*(colCode-255)),0);
- int b = (int)Math.max(Math.round(-0.015564*(colCode+127)*(colCode-127)),0);
-
- return new Color(r,g,b);
- }
-
- /// Save the alignment as TIFF.
- public void saveAsTiff(String filename){
-
- try {
-
- // get the iamge
- BufferedImage saveImage = new BufferedImage (this.getWidth(), this.getHeight(), BufferedImage.TYPE_INT_RGB);
- // paint it
- Graphics gc = saveImage.getGraphics();
- paint(gc);
-
- // Store the image in the TIFF format.
- TIFFEncodeParam encodeParam = new TIFFEncodeParam();
- // encodeParam.setCompression(TIFFEncodeParam.COMPRESSION_DEFLATE);
-
-// TIFFField[] extras = new TIFFField[3];
-// extras[0] = new TIFFField(282,TIFFField.TIFF_RATIONAL, 1, (Object)new long[][] {{300,(long)1},{(long)0 ,(long)0}});
-// extras[1] = new TIFFField(283,TIFFField.TIFF_RATIONAL, 1, (Object)new long[][] {{300,(long)1},{(long)0 ,(long)0}}); // x
-// extras[2] = new TIFFField(296, TIFFField.TIFF_SHORT, 1, (Object) new char[] {2}); //2 for inches //y //set resolution unit to inches
-// encodeParam.setExtraFields(extras);
-
-// final int XRES_TAG = 282;
-// final int YRES_TAG = 283;
-//
-// int[] resolution = { 300, 1};
-// TIFFField xRes = new TIFFField(XRES_TAG, TIFFField.TIFF_RATIONAL, 1, new int[][] { resolution });
-// TIFFField yRes = new TIFFField(YRES_TAG, TIFFField.TIFF_RATIONAL, 1, new int[][] { resolution });
-// encodeParam.setExtraFields(new TIFFField[] { xRes, yRes});
-
-// above are failed attempts to increase the resolution of the resulting image
-// -- RKB 10/15/08
-
- RenderedOp op = JAI.create("filestore", saveImage, filename, "tiff", encodeParam);
-
- } catch (Exception e) {
- System.out.print (e.toString());
- }
-
- }
-
- /// Save the alignment as JPEG.
- public void saveAsJPEG(String filename){
-
- File save_file;
-
- // For encoder
- BufferedImage saveImage;
-
-
- try{
- FileOutputStream file_out = new FileOutputStream(filename);
-
- // get the image
- saveImage = new BufferedImage(this.getWidth(), this.getHeight(),
- BufferedImage.TYPE_INT_RGB);
- // paint it
- Graphics gc = saveImage.getGraphics();
- paint(gc);
-
- float quality = 0.25f;
- com.sun.image.codec.jpeg.JPEGEncodeParam encodeParam = JPEGCodec.getDefaultJPEGEncodeParam(saveImage);
- encodeParam.setQuality(quality,false);
-
- JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(file_out, encodeParam);
- encoder.encode(saveImage);
- System.out.println("Saved frame: " + filename);
- file_out.close();
- }
- catch(Exception ex)
- {System.out.print(ex.toString());}
- }
-
-
-
- public void iResized(){
- sizeScreen(this.getSize());
- }
-
- public void mouseClicked(MouseEvent e) {
-
- Alignment align = aligns.currAlign;
- int caretPos = this.getCaret().getMark();
-
- if (align.gapsSuppressed || !caretToNode.containsKey(caretPos))
- return;
-
- int nodeI = caretToNode.get(caretPos);
-
- Node v = align.L[nodeI];
- v.setHighlight(!v.highlighted);
- aligns.currAlign.buildSeqsAndCols(aligns.currAlign.gapsSuppressed, aligns.currAlign.colorScheme);
- currPaintIndex = -2;
- paint();
- }
-
- public void mousePressed(MouseEvent e) {}
- public void mouseReleased(MouseEvent e) {}
- public void mouseEntered(MouseEvent e) {}
- public void mouseExited(MouseEvent e) {}
-
-
-
-
- public void componentResized(ComponentEvent e) {
- sizeScreen( e.getComponent().getSize() );
- }
-
- public void componentShown(ComponentEvent e) {};
- public void componentHidden(ComponentEvent e) {};
- public void componentMoved(ComponentEvent e) {};
-}
diff --git a/display/mad/Alignments.java b/display/mad/Alignments.java
deleted file mode 100644
index 4bcafc6..0000000
--- a/display/mad/Alignments.java
+++ /dev/null
@@ -1,364 +0,0 @@
-
-/*
- * This file is part of FSA, a sequence alignment algorithm.
- * Source code in this file was written by Adam Roberts.
- * Code for different accuracy measures was written by Robert Bradley.
- */
-
-
-package mad;
-
-import java.util.Scanner;
-import java.util.*;
-import java.util.regex.*;
-import java.io.*;
-import java.net.*;
-
-/**
- * Class Name: Alignments
- *
- * Description: Acts as a wrapper for the DAG to communicate with viewer as if it held a list
- * of the different alignments. Also parses and stores data from the log file.
- **/
-
-public class Alignments{
-
- AlignDAG aDag;
- Alignment currAlign;
- Alignment altAlign = null;
- ProbabilityMatrices probMatrices;
- int index;
- int size;
- int[] seqLengths;
- String[] sequences;
-
- public Double[] alignAccs;
- public Double[] alignSPSs;
- public Double[] alignPPVs;
- public Double[] alignCerts;
- public Double[] alignConss;
-
- public Double[] alignGFs;
-
- LinkedList<String> keys;
- int[][] merges; // Merge is indexed so that the current merge will take you to the next alignment.
- boolean suppressGaps;
- int colorScheme;
-
- public Alignments(String seqPath, String guiPath, String probPath){
- suppressGaps = true;
- colorScheme = 0;
- loadData(seqPath, guiPath, probPath);
- makeAccArrays();
- }
-
- public Alignments(String seqPath, String guiPath, String probPath, String altAlignPath){
- this(seqPath, guiPath, probPath);
- loadAltAlign(altAlignPath);
- }
-
- public int size(){
- return this.size;
- }
-
- private void loadAltAlign(String altAlignPath){
- String[] altSeqs = new String[keys.size()];
- String line;
- BufferedReader br;
-
- try{
- if (altAlignPath.startsWith("http://")){
- br = new BufferedReader( new InputStreamReader( (new URL(altAlignPath)).openStream() ));
- }
- else{
- br = new BufferedReader( new FileReader(altAlignPath) );
- }
- line = br.readLine();
- while (line != null && line.length() > 0){
- String key = line.substring(1);
- int i = keys.indexOf(key);
-
- if (i == -1){
- System.err.println("FATAL ERROR: Alternate alignment key '"+ key +"' does not match FSA alignment.");
- System.exit(-1);
- }
-
- StringBuffer seq = new StringBuffer("");
- while ((line = br.readLine()) != null && line.length() > 0 && line.charAt(0) != '>')
- seq.append(line);
- altSeqs[i] = seq.toString();
- }
- } catch (IOException ioe){
- ioe.printStackTrace();
- System.exit(-1);
- }
-
- AlignDAG altDag = new AlignDAG(keys, sequences, altSeqs, probMatrices);
- this.altAlign = new Alignment(keys, sequences, altDag, suppressGaps, colorScheme);
- }
-
- private String firstWord(String s) {
- int space_pos = s.indexOf(' ');
- if (space_pos == -1) {
- return s;
- } else {
- return s.substring(0, space_pos);
- }
- }
-
- private void loadData(String seqPath, String guiPath, String probPath){
-
- keys = new LinkedList<String>();
- LinkedList<String> seqs = new LinkedList<String>();
- LinkedList<int[]> merges = new LinkedList<int[]>();
- HashMap<String, Integer> initDAG = new HashMap<String, Integer>();
- String line;
- BufferedReader br;
- Scanner scan;
-
-
- String x;
- String y;
-
- int i=0;
-
- try{
- if (seqPath.startsWith("http://")){
- System.out.println("WEB");
- br = new BufferedReader( new InputStreamReader( (new URL(seqPath)).openStream() ));
- }
- else{
- br = new BufferedReader( new FileReader(seqPath) );
- }
- String key = null;
- StringBuffer seq = new StringBuffer("");
- while (true) {
- line = br.readLine();
-
- // Check for end of previous sequence
- if ((line == null || line.startsWith(">")) && key != null) {
- // Only use the first word of title line as key
- keys.add(firstWord(key.trim()));
- String sequence = seq.toString();
- sequence = sequence.replaceAll("\\s", ""); // remove whitespace
- sequence = sequence.replaceAll("[-_.]", ""); // remove gaps
- seqs.add(sequence);
- }
-
- // Process next line
- if (line == null) {
- // end of file
- break;
- } else if (line.startsWith(">")) {
- // start a new sequence
- key = line.substring(1);
- seq.setLength(0);
- } else {
- // add to current sequence
- seq.append(line);
- }
- }
-
- } catch (IOException ioe){
- ioe.printStackTrace();
- System.exit(-1);
- }
-
-
- try{
- if (guiPath.startsWith("http://")){
- br = new BufferedReader( new InputStreamReader( (new URL(guiPath)).openStream() ));
- }
- else{
- br = new BufferedReader( new FileReader(guiPath) );
- }
-
- // Skip blank lines and comments.
- while ((line = br.readLine()).length() == 0 || line.charAt(0) == ';')
- continue;
-
- // Read nodes.
- while(line.length() > 0 ){
- if (line.charAt(0) == ';'){ // Skip comments
- line = br.readLine();
- continue;
- }
-
- scan = new Scanner(line);
- // scan.findInLine("(\\d+):\\s[(](\\d+),\\s(\\d+)[)]\\s=>\\s(\\d+.\\d+|\\d+)");
- scan.findInLine("(\\d+):\\s[(](\\d+),\\s(\\d+)[)]");
-
-
- MatchResult result = scan.match();
- i = new Integer(result.group(1));
- x = result.group(2);
- y = result.group(3);
- initDAG.put(x + "." + y, i); // preserve 0-based indexing
- line = br.readLine();
-
- }
-
-
- //Skip blank lines and comments
- while ((line = br.readLine()).length() == 0 || line.charAt(0) == ';')
- continue;
-
- // Read merges
- while (line != null){
- scan = new Scanner(line);
- scan.findInLine("(\\d+)\\s->\\s(\\d+)");
- MatchResult result = scan.match();
- int[] merge = {new Integer(result.group(1)), new Integer(result.group(2))};
- merges.add(merge);
- line = br.readLine();
- }
-
- } catch (IOException ioe){
- ioe.printStackTrace();
- System.exit(-1);
- }
-
- // Read probabilities and set up matrix
-
- seqLengths = new int[seqs.size()];
- Iterator<String> iter = seqs.iterator();
- i=0;
- while(iter.hasNext())
- seqLengths[i++] = iter.next().length();
-
- probMatrices = new ProbabilityMatrices(seqLengths);
-
- int seq1, seq2;
- int i1, i2;
- double prob;
-
-
- try{
- if (probPath.startsWith("http://")){
- br = new BufferedReader( new InputStreamReader( (new URL(probPath)).openStream() ));
- }
- else{
- br = new BufferedReader( new FileReader(probPath) );
- }
- while ((line = br.readLine()) != null){
- if ( line.length() == 0 || line.charAt(0) == ';') // Skip comments and blanks
- continue;
- scan = new Scanner(line);
- // cover case of scientific notation
- scan.findInLine("[(](\\d+|-\\d+),\\s(\\d+|-\\d+)[)]\\s~\\s[(](\\d+|-\\d+),\\s(\\d+|-\\d+)[)]\\s=>\\s(\\d.\\d+|\\d+)\\*?[e|E]?(-\\d+)?");
- MatchResult result = scan.match();
-
- seq1 = new Integer(result.group(1)).intValue();
- i1 = new Integer(result.group(2)).intValue();
- seq2 = new Integer(result.group(3)).intValue();
- i2 = new Integer(result.group(4)).intValue();
- prob = new Double(result.group(5)).doubleValue();
- if (result.group(6) != null) {
- Integer exponent = new Integer((String) result.group(6));
- prob *= Math.pow(10, (double) exponent);
- }
- probMatrices.addElement(seq1, seq2, i1, i2, prob); // preserve 0-based indexing
-
- //double testProb = probMatrices.getElement(seq1, seq2, i1, i2);
- //if (testProb != prob){
- // System.err.println("(" + seq1 + ", " + i1 + ") ~ (" + seq2 + ", " + i2 + ") => " + prob + "/" + testProb);
- // System.exit(-1);
- //}
- }
- } catch (IOException ioe){
- ioe.printStackTrace();
- System.exit(-1);
- }
-
- this.index = 0;
- this.merges = merges.toArray(new int[0][0]);
- this.size = this.merges.length+1;
- this.sequences = seqs.toArray(new String[0]);
- this.aDag = new AlignDAG(keys, sequences, initDAG, probMatrices);
- }
-
-
- /// Calculate and store Accuracy, SPS, PPV, Certainty and Consistency for all alignments.
- private void makeAccArrays(){
- alignAccs = new Double[merges.length + 1];
- alignSPSs = new Double[merges.length + 1];
- alignPPVs = new Double[merges.length + 1];
- alignCerts = new Double[merges.length + 1];
- alignConss = new Double[merges.length + 1];
- alignGFs = new Double[merges.length + 1];
-
- alignAccs[0] = (Double) aDag.getAlignAccNorm();
- alignSPSs[0] = (Double) aDag.getAlignSPSNorm();
- alignPPVs[0] = (Double) aDag.getAlignPPVNorm();
- alignCerts[0] = (Double) aDag.getAlignCertNorm();
- alignConss[0] = (Double) aDag.getAlignConsNorm();
- alignGFs[0] = (Double) aDag.getGapFactor();
-
- for (int i = 0; i < merges.length; i ++){
- next();
- alignAccs[i+1] = (Double) aDag.getAlignAccNorm();
- alignSPSs[i+1] = (Double) aDag.getAlignSPSNorm();
- alignPPVs[i+1] = (Double) aDag.getAlignPPVNorm();
- alignCerts[i+1] = (Double) aDag.getAlignCertNorm();
- alignConss[i+1] = (Double) aDag.getAlignConsNorm();
- alignGFs[i+1] = (Double) aDag.getGapFactor();
- // System.err.println ("i = " + i + "; acc = " + alignAccs[i+1] + "; sps = " + alignSPSs[i+1] + "; ppv = " + alignPPVs[i+1] + "; cert = " + alignCerts[i+1]);
- }
- }
-
- public Alignment get(int index){
-
- if (index == -1){ // -1 should only be request when an alternate alignment is available
- // otherwise the button is disabled
- return this.altAlign;
- }
-
- if (this.index == index && currAlign != null)
- return this.currAlign;
-
- while (this.index < index)
- next();
-
- while (this.index > index)
- previous();
-
- currAlign = new Alignment(keys, sequences, aDag, suppressGaps, colorScheme);
- System.gc();
- return currAlign;
- }
-
- // Merges with the current index and then increments it.
- private void next(){
- aDag.merge(merges[index][0], merges[index][1]);
- index++;
- }
-
- // Decrements the index and uses the last merge as a demerge.
- // Tell AlignDAG::demerge about the next-to-last merge as well to lookup the previous gap factor.
- private void previous(){
- index --;
- if (index > 0)
- aDag.demerge(merges[index][0], merges[index-1][0]);
- else
- aDag.demerge(merges[index][0], -1);
- }
-
- public void setGapSuppress(boolean val){
- suppressGaps = val;
- currAlign = null;
- if (altAlign != null && altAlign.gapsSuppressed != suppressGaps)
- altAlign.buildSeqsAndCols(suppressGaps, colorScheme);
- }
-
- /// Set color scheme.
- public void setColorScheme(int scheme){
-
- aDag.setColorScheme (scheme);
-
- this.colorScheme = scheme;
- currAlign = null;
- if (altAlign != null && altAlign.colorScheme != scheme)
- altAlign.buildSeqsAndCols(suppressGaps, scheme);
- }
-
-}
diff --git a/display/mad/BatchDocument.java b/display/mad/BatchDocument.java
deleted file mode 100644
index 622be58..0000000
--- a/display/mad/BatchDocument.java
+++ /dev/null
@@ -1,87 +0,0 @@
-
-/*
- * Source code in this file is from
- * http://javatechniques.com/blog/faster-jtextpane-text-insertion-part-ii/
- * Copyright 2003-2007 - Philip Isenhour.
- */
-
-
-package mad;
-
-import java.util.ArrayList;
-import javax.swing.text.Element;
-import javax.swing.text.AttributeSet;
-import javax.swing.text.BadLocationException;
-import javax.swing.text.DefaultStyledDocument;
-
-/**
- * DefaultDocument subclass that supports batching inserts.
- */
-public class BatchDocument extends DefaultStyledDocument {
- /**
- * EOL tag that we re-use when creating ElementSpecs
- */
- private static final char[] EOL_ARRAY = { '\n' };
-
- /**
- * Batched ElementSpecs
- */
- private ArrayList<ElementSpec> batch = null;
-
- public BatchDocument() {
- batch = new ArrayList<ElementSpec>();
- }
-
- /**
- * Adds a String (assumed to not contain linefeeds) for
- * later batch insertion.
- */
- public void appendBatchString(String str,
- AttributeSet a) {
- // We could synchronize this if multiple threads
- // would be in here. Since we're trying to boost speed,
- // we'll leave it off for now.
-
- // Make a copy of the attributes, since we will hang onto
- // them indefinitely and the caller might change them
- // before they are processed.
- a = a.copyAttributes();
- char[] chars = str.toCharArray();
- batch.add(new ElementSpec(
- a, ElementSpec.ContentType, chars, 0, str.length()));
- }
-
- /**
- * Adds a linefeed for later batch processing
- */
- public void appendBatchLineFeed(AttributeSet a) {
- // See sync notes above. In the interest of speed, this
- // isn't synchronized.
-
- // Add a spec with the linefeed characters
- batch.add(new ElementSpec(
- a, ElementSpec.ContentType, EOL_ARRAY, 0, 1));
-
- // Then add attributes for element start/end tags. Ideally
- // we'd get the attributes for the current position, but we
- // don't know what those are yet if we have unprocessed
- // batch inserts. Alternatives would be to get the last
- // paragraph element (instead of the first), or to process
- // any batch changes when a linefeed is inserted.
- Element paragraph = getParagraphElement(0);
- AttributeSet pattr = paragraph.getAttributes();
- batch.add(new ElementSpec(null, ElementSpec.EndTagType));
- batch.add(new ElementSpec(pattr, ElementSpec.StartTagType));
- }
-
- public void processBatchUpdates(int offs) throws
- BadLocationException {
- // As with insertBatchString, this could be synchronized if
- // there was a chance multiple threads would be in here.
- ElementSpec[] inserts = new ElementSpec[batch.size()];
- batch.toArray(inserts);
-
- // Process all of the inserts in bulk
- super.insert(offs, inserts);
- }
-}
diff --git a/display/mad/JpegImagesToMovie.java b/display/mad/JpegImagesToMovie.java
deleted file mode 100644
index e751d0b..0000000
--- a/display/mad/JpegImagesToMovie.java
+++ /dev/null
@@ -1,530 +0,0 @@
-/*
- * @(#)JpegImagesToMovie.java 1.3 01/03/13
- *
- * Copyright (c) 1999-2001 Sun Microsystems, Inc. All Rights Reserved.
- *
- * Sun grants you ("Licensee") a non-exclusive, royalty free, license to use,
- * modify and redistribute this software in source and binary code form,
- * provided that i) this copyright notice and license appear on all copies of
- * the software; and ii) Licensee does not utilize the software in a manner
- * which is disparaging to Sun.
- *
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
- * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
- * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE
- * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
- * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS
- * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
- * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
- * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
- * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGES.
- *
- * This software is not designed or intended for use in on-line control of
- * aircraft, air traffic, aircraft navigation or aircraft communications; or in
- * the design, construction, operation or maintenance of any nuclear
- * facility. Licensee represents and warrants that it will not use or
- * redistribute the Software for such purposes.
- */
-
-
-package mad;
-
-import java.io.*;
-import java.util.*;
-import java.awt.Dimension;
-
-import javax.media.*;
-import javax.media.control.*;
-import javax.media.protocol.*;
-import javax.media.protocol.DataSource;
-import javax.media.datasink.*;
-import javax.media.format.VideoFormat;
-
-
-/**
- * This program takes a list of JPEG image files and convert them into
- * a QuickTime movie.
- */
-public class JpegImagesToMovie implements ControllerListener, DataSinkListener {
-
- public boolean doIt2(int width, int height, int frameRate, Vector inFiles, String outFile){
- MediaLocator outML = createMediaLocator(outFile);
- return doIt(width, height, frameRate, inFiles, outML);
- }
-
- public boolean doIt(int width, int height, int frameRate, Vector inFiles, MediaLocator outML) {
- ImageDataSource ids = new ImageDataSource(width, height, frameRate, inFiles);
-
- Processor p;
-
- try {
- System.err.println("- create processor for the image datasource ...");
- p = Manager.createProcessor(ids);
- } catch (Exception e) {
- System.err.println("Yikes! Cannot create a processor from the data source.");
- return false;
- }
-
- p.addControllerListener(this);
-
- // Put the Processor into configured state so we can set
- // some processing options on the processor.
- p.configure();
- if (!waitForState(p, p.Configured)) {
- System.err.println("Failed to configure the processor.");
- return false;
- }
-
- // Set the output content descriptor to QuickTime.
- p.setContentDescriptor(new ContentDescriptor(FileTypeDescriptor.QUICKTIME));
-
- // Query for the processor for supported formats.
- // Then set it on the processor.
- TrackControl tcs[] = p.getTrackControls();
- Format f[] = tcs[0].getSupportedFormats();
- if (f == null || f.length <= 0) {
- System.err.println("The mux does not support the input format: " + tcs[0].getFormat());
- return false;
- }
-
- tcs[0].setFormat(f[0]);
-
- System.err.println("Setting the track format to: " + f[0]);
-
- // We are done with programming the processor. Let's just
- // realize it.
- p.realize();
- if (!waitForState(p, p.Realized)) {
- System.err.println("Failed to realize the processor.");
- return false;
- }
-
- // Now, we'll need to create a DataSink.
- DataSink dsink;
- if ((dsink = createDataSink(p, outML)) == null) {
- System.err.println("Failed to create a DataSink for the given output MediaLocator: " + outML);
- return false;
- }
-
- dsink.addDataSinkListener(this);
- fileDone = false;
-
- System.err.println("start processing...");
-
- // OK, we can now start the actual transcoding.
- try {
- p.start();
- dsink.start();
- } catch (IOException e) {
- System.err.println("IO error during processing");
- return false;
- }
-
- // Wait for EndOfStream event.
- waitForFileDone();
-
- // Cleanup.
- try {
- dsink.close();
- } catch (Exception e) {}
- p.removeControllerListener(this);
-
- System.err.println("...done processing.");
-
- return true;
- }
-
-
- /**
- * Create the DataSink.
- */
- DataSink createDataSink(Processor p, MediaLocator outML) {
-
- DataSource ds;
-
- if ((ds = p.getDataOutput()) == null) {
- System.err.println("Something is really wrong: the processor does not have an output DataSource");
- return null;
- }
-
- DataSink dsink;
-
- try {
- System.err.println("- create DataSink for: " + outML);
- dsink = Manager.createDataSink(ds, outML);
- dsink.open();
- } catch (Exception e) {
- System.err.println("Cannot create the DataSink: " + e);
- return null;
- }
-
- return dsink;
- }
-
-
- Object waitSync = new Object();
- boolean stateTransitionOK = true;
-
- /**
- * Block until the processor has transitioned to the given state.
- * Return false if the transition failed.
- */
- boolean waitForState(Processor p, int state) {
- synchronized (waitSync) {
- try {
- while (p.getState() < state && stateTransitionOK)
- waitSync.wait();
- } catch (Exception e) {}
- }
- return stateTransitionOK;
- }
-
-
- /**
- * Controller Listener.
- */
- public void controllerUpdate(ControllerEvent evt) {
-
- if (evt instanceof ConfigureCompleteEvent ||
- evt instanceof RealizeCompleteEvent ||
- evt instanceof PrefetchCompleteEvent) {
- synchronized (waitSync) {
- stateTransitionOK = true;
- waitSync.notifyAll();
- }
- } else if (evt instanceof ResourceUnavailableEvent) {
- synchronized (waitSync) {
- stateTransitionOK = false;
- waitSync.notifyAll();
- }
- } else if (evt instanceof EndOfMediaEvent) {
- evt.getSourceController().stop();
- evt.getSourceController().close();
- }
- }
-
-
- Object waitFileSync = new Object();
- boolean fileDone = false;
- boolean fileSuccess = true;
-
- /**
- * Block until file writing is done.
- */
- boolean waitForFileDone() {
- synchronized (waitFileSync) {
- try {
- while (!fileDone)
- waitFileSync.wait();
- } catch (Exception e) {}
- }
- return fileSuccess;
- }
-
-
- /**
- * Event handler for the file writer.
- */
- public void dataSinkUpdate(DataSinkEvent evt) {
-
- if (evt instanceof EndOfStreamEvent) {
- synchronized (waitFileSync) {
- fileDone = true;
- waitFileSync.notifyAll();
- }
- } else if (evt instanceof DataSinkErrorEvent) {
- synchronized (waitFileSync) {
- fileDone = true;
- fileSuccess = false;
- waitFileSync.notifyAll();
- }
- }
- }
-
-
- public static void main(String args[]) {
-
- if (args.length == 0)
- prUsage();
-
- // Parse the arguments.
- int i = 0;
- int width = -1, height = -1, frameRate = 1;
- Vector<String> inputFiles = new Vector<String>();
- String outputURL = null;
-
- while (i < args.length) {
-
- if (args[i].equals("-w")) {
- i++;
- if (i >= args.length)
- prUsage();
- width = new Integer(args[i]).intValue();
- } else if (args[i].equals("-h")) {
- i++;
- if (i >= args.length)
- prUsage();
- height = new Integer(args[i]).intValue();
- } else if (args[i].equals("-f")) {
- i++;
- if (i >= args.length)
- prUsage();
- frameRate = new Integer(args[i]).intValue();
- } else if (args[i].equals("-o")) {
- i++;
- if (i >= args.length)
- prUsage();
- outputURL = args[i];
- } else {
- inputFiles.addElement(args[i]);
- }
- i++;
- }
-
- if (outputURL == null || inputFiles.size() == 0)
- prUsage();
-
- // Check for output file extension.
- if (!outputURL.endsWith(".mov") && !outputURL.endsWith(".MOV")) {
- System.err.println("The output file extension should end with a .mov extension");
- prUsage();
- }
-
- if (width < 0 || height < 0) {
- System.err.println("Please specify the correct image size.");
- prUsage();
- }
-
- // Check the frame rate.
- if (frameRate < 1)
- frameRate = 1;
-
- // Generate the output media locators.
- MediaLocator oml;
-
- if ((oml = createMediaLocator(outputURL)) == null) {
- System.err.println("Cannot build media locator from: " + outputURL);
- System.exit(0);
- }
-
- JpegImagesToMovie imageToMovie = new JpegImagesToMovie();
- imageToMovie.doIt(width, height, frameRate, inputFiles, oml);
-
- System.exit(0);
- }
-
- static void prUsage() {
- System.err.println("Usage: java JpegImagesToMovie -w <width> -h <height> -f <frame rate> -o <output URL> <input JPEG file 1> <input JPEG file 2> ...");
- System.exit(-1);
- }
-
- /**
- * Create a media locator from the given string.
- */
- static MediaLocator createMediaLocator(String url) {
-
- MediaLocator ml;
-
- if (url.indexOf(":") > 0 && (ml = new MediaLocator(url)) != null)
- return ml;
-
- if (url.startsWith(File.separator)) {
- if ((ml = new MediaLocator("file:" + url)) != null)
- return ml;
- } else {
- String file = "file:" + System.getProperty("user.dir") + File.separator + url;
- if ((ml = new MediaLocator(file)) != null)
- return ml;
- }
-
- return null;
- }
-
-
- ///////////////////////////////////////////////
- //
- // Inner classes.
- ///////////////////////////////////////////////
-
-
- /**
- * A DataSource to read from a list of JPEG image files and
- * turn that into a stream of JMF buffers.
- * The DataSource is not seekable or positionable.
- */
- class ImageDataSource extends PullBufferDataSource {
-
- ImageSourceStream streams[];
-
- ImageDataSource(int width, int height, int frameRate, Vector images) {
- streams = new ImageSourceStream[1];
- streams[0] = new ImageSourceStream(width, height, frameRate, images);
- }
-
- public void setLocator(MediaLocator source) {
- }
-
- public MediaLocator getLocator() {
- return null;
- }
-
- /**
- * Content type is of RAW since we are sending buffers of video
- * frames without a container format.
- */
- public String getContentType() {
- return ContentDescriptor.RAW;
- }
-
- public void connect() {
- }
-
- public void disconnect() {
- }
-
- public void start() {
- }
-
- public void stop() {
- }
-
- /**
- * Return the ImageSourceStreams.
- */
- public PullBufferStream[] getStreams() {
- return streams;
- }
-
- /**
- * We could have derived the duration from the number of
- * frames and frame rate. But for the purpose of this program,
- * it's not necessary.
- */
- public Time getDuration() {
- return DURATION_UNKNOWN;
- }
-
- public Object[] getControls() {
- return new Object[0];
- }
-
- public Object getControl(String type) {
- return null;
- }
- }
-
-
- /**
- * The source stream to go along with ImageDataSource.
- */
- class ImageSourceStream implements PullBufferStream {
-
- Vector images;
- int width, height;
- VideoFormat format;
-
- int nextImage = 0; // index of the next image to be read.
- boolean ended = false;
-
- public ImageSourceStream(int width, int height, int frameRate, Vector images) {
- this.width = width;
- this.height = height;
- this.images = images;
-
- format = new VideoFormat(VideoFormat.JPEG,
- new Dimension(width, height),
- Format.NOT_SPECIFIED,
- Format.byteArray,
- (float)frameRate);
- }
-
- /**
- * We should never need to block assuming data are read from files.
- */
- public boolean willReadBlock() {
- return false;
- }
-
- /**
- * This is called from the Processor to read a frame worth
- * of video data.
- */
- public void read(Buffer buf) throws IOException {
-
- // Check if we've finished all the frames.
- if (nextImage >= images.size()) {
- // We are done. Set EndOfMedia.
- System.err.println("Done reading all images.");
- buf.setEOM(true);
- buf.setOffset(0);
- buf.setLength(0);
- ended = true;
- return;
- }
-
- String imageFile = (String)images.elementAt(nextImage);
- nextImage++;
-
- System.err.println(" - reading image file: " + imageFile);
-
- // Open a random access file for the next image.
- RandomAccessFile raFile;
- raFile = new RandomAccessFile(imageFile, "r");
-
- byte data[] = null;
-
- // Check the input buffer type & size.
-
- if (buf.getData() instanceof byte[])
- data = (byte[])buf.getData();
-
- // Check to see the given buffer is big enough for the frame.
- if (data == null || data.length < raFile.length()) {
- data = new byte[(int)raFile.length()];
- buf.setData(data);
- }
-
- // Read the entire JPEG image from the file.
- raFile.readFully(data, 0, (int)raFile.length());
-
- System.err.println(" read " + raFile.length() + " bytes.");
-
- buf.setOffset(0);
- buf.setLength((int)raFile.length());
- buf.setFormat(format);
- buf.setFlags(buf.getFlags() | buf.FLAG_KEY_FRAME);
-
- // Close the random access file.
- raFile.close();
- }
-
- /**
- * Return the format of each video frame. That will be JPEG.
- */
- public Format getFormat() {
- return format;
- }
-
- public ContentDescriptor getContentDescriptor() {
- return new ContentDescriptor(ContentDescriptor.RAW);
- }
-
- public long getContentLength() {
- return 0;
- }
-
- public boolean endOfStream() {
- return ended;
- }
-
- public Object[] getControls() {
- return new Object[0];
- }
-
- public Object getControl(String type) {
- return null;
- }
- }
-}
diff --git a/display/mad/MAD.java b/display/mad/MAD.java
deleted file mode 100644
index 86ec5f8..0000000
--- a/display/mad/MAD.java
+++ /dev/null
@@ -1,67 +0,0 @@
-
-/*
- * This file is part of FSA, a sequence alignment algorithm.
- * Source code in this file was written by Michael Smoot and Adam Roberts.
- */
-
-package mad;
-
-import java.io.*;
-import java.util.*;
-import javax.swing.*;
-import java.awt.Dimension;
-
-public class MAD{
-
- public static void main(String[] args){
-
- System.out.print("Reading data and building structures...");
- try {
- Alignments aligns = null;
- String fsaFile = "";
- String altFile = "";
- if (args.length == 1){
- fsaFile = args[0];
- aligns = new Alignments(fsaFile, fsaFile + ".gui", fsaFile + ".probs");
-
- } else if (args.length == 2){
- fsaFile = args[0];
- altFile = args[1];
- aligns = new Alignments(fsaFile, fsaFile + ".gui", fsaFile + ".probs", altFile);
- } else{
- System.out.println("USAGE: java -jar MAD.jar sequencefile [alternatealignfile]");
- System.exit(1);
- }
-
- System.out.println("done");
-
- final JFrame frame = new JFrame("Multiple Alignment Display: " + args[0] + " (FSA alignment)");
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-
- MadPanel panel = new MadPanel(frame, aligns, fsaFile, altFile);
- panel.setPreferredSize( new Dimension(900,700) );
-
- JMenuBar menuBar = new JMenuBar();
- JMenu fileMenu = new JMenu("File");
- menuBar.add(fileMenu);
- JMenuItem saveAsFasta = new JMenuItem( new SaveAsFastaAction(panel) );
- JMenuItem saveAsTiff = new JMenuItem( new SaveAsTiffAction(panel) );
- JMenuItem saveAsMov = new JMenuItem(new SaveAsMovAction(panel) );
- fileMenu.add(saveAsFasta);
- fileMenu.add(saveAsTiff);
- fileMenu.add(saveAsMov);
- frame.setJMenuBar(menuBar);
-
-
- //Display the window.
- frame.setContentPane(panel);
- frame.pack();
- frame.setVisible(true);
-
-
- } catch (Exception ioe) {
- ioe.printStackTrace();
- }
-
- }
-}
diff --git a/display/mad/MadApplet.java b/display/mad/MadApplet.java
deleted file mode 100644
index 5ae8f9b..0000000
--- a/display/mad/MadApplet.java
+++ /dev/null
@@ -1,37 +0,0 @@
-
-/*
- * This file is part of FSA, a sequence alignment algorithm.
- * Source code in this file was written by Adam Roberts.
- */
-
-package mad;
-
-import java.io.*;
-import java.util.*;
-import javax.swing.*;
-import java.applet.*;
-import java.awt.Dimension;
-
-public class MadApplet extends JApplet{
- public void init() {
- System.out.println("Applet initializing");
- String fsaFile = getParameter("fsaFile");
- Alignments aligns = new Alignments(fsaFile, fsaFile + ".gui", fsaFile + ".probs");
- MadPanel panel = new MadPanel(aligns, fsaFile, "");
- panel.setPreferredSize( new Dimension(900,700) );
- getContentPane().add(panel);
- }
-
- public void start() {
- System.out.println("Applet starting");
- }
- public void stop() {
- System.out.println("Applet stopping");
- }
-
- public void destroy() {
- System.out.println("Applet destroyed");
- }
-
-
-}
diff --git a/display/mad/MadPanel.java b/display/mad/MadPanel.java
deleted file mode 100644
index 0d97ceb..0000000
--- a/display/mad/MadPanel.java
+++ /dev/null
@@ -1,792 +0,0 @@
-
-/*
- * This file is part of FSA, a sequence alignment algorithm.
- * Source code in this file was written by Michael Smoot and Adam Roberts.
- * Code for different accuracy measures was written by Robert Bradley.
- */
-
-// to do:
-
-
-package mad;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-import javax.swing.event.*;
-import javax.swing.text.NumberFormatter;
-import java.beans.*;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Vector;
-import java.util.Iterator;
-
-
-import java.io.File;
-import java.text.DecimalFormat;
-import java.text.NumberFormat;
-
-import java.net.URL;
-
-
-public class MadPanel extends JPanel
- implements ChangeListener, PropertyChangeListener, ActionListener, ItemListener {
-
- AlignmentPanel alignPanel;
- JFormattedTextField indexField;
- JLabel legLabel;
- JFormattedTextField accField;
-
- JLabel accLabel;
- JLabel dAccLabel;
-
- JLabel gfLabel;
- JFormattedTextField gfField;
-
- JSlider alignSlider;
- JSlider zoomSlider;
- Alignments aligns;
- JButton nextButton;
- JButton prevButton;
- JButton startStopButton;
- JButton altAlignButton;
- JCheckBox gapSuppressCheck;
- JFrame parent = null;
-
- JCheckBox coloredCheck;
- JComboBox colorSchemes;
- String[] colorSchemesList;
- String[] colorSchemesLabels;
-
- String fsaPath, altPath;
-
- int maxSliderVal;
- Map<Component,Boolean> ok2update;
- Timer timer;
- boolean frozen = true;
- int delay = 100;
-
- boolean inAlt = false;
-
-
- public MadPanel(JFrame parent, Alignments aligns, String fsaPath, String altPath){
- this(aligns, fsaPath, altPath);
- this.parent = parent;
-
- }
- public MadPanel(Alignments aligns, String fsaPath, String altPath) {
-
- this.aligns = aligns;
- this.fsaPath = fsaPath;
- this.altPath = altPath;
-
- maxSliderVal = aligns.size()-1;
-
- ok2update = new HashMap<Component,Boolean>();
-
- setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
-
- // set up animation timer
- timer = new Timer(delay,this);
- timer.setCoalesce(true);
-
- //Create the label.
- JLabel sliderLabel = new JLabel("Alignment: ", JLabel.CENTER);
- sliderLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
-
- //Create the alignment number field
- java.text.NumberFormat intFormat = java.text.NumberFormat.getIntegerInstance();
- NumberFormatter intFormatter = new NumberFormatter(intFormat);
- intFormatter.setMinimum(new Integer(0));
- intFormatter.setMaximum(new Integer(maxSliderVal));
- indexField = new JFormattedTextField(intFormatter);
- indexField.setColumns(4); //get some space
- indexField.addPropertyChangeListener( this );
- handleEnterKeyStroke( indexField );
- ok2update.put(indexField,false);
-
- accLabel = new JLabel("Accuracy: ", JLabel.CENTER);
- dAccLabel = new JLabel("\u0394 Accuracy: ", JLabel.CENTER);
- gfLabel = new JLabel("Gap Factor: ", JLabel.CENTER);
-
- //Create the alignment acc field
- java.text.NumberFormat numFormat = java.text.NumberFormat.getNumberInstance();
- NumberFormatter numFormatter = new NumberFormatter(numFormat);
- numFormatter.setMinimum(new Float(0f));
- numFormatter.setMaximum(new Float(Float.MAX_VALUE));
- accField = new JFormattedTextField(numFormatter);
- accField.setColumns(4); //get some space
- accField.addPropertyChangeListener( this );
- handleEnterKeyStroke( accField );
- ok2update.put(accField,false);
-
- //Create the alignment acc field
- java.text.NumberFormat numFormat2 = java.text.NumberFormat.getNumberInstance();
- NumberFormatter numFormatter2 = new NumberFormatter(numFormat);
- numFormatter2.setMinimum(new Float(0f));
- numFormatter2.setMaximum(new Float(Float.MAX_VALUE));
- gfField = new JFormattedTextField(numFormatter2);
- gfField.setColumns(4); //get some space
- gfField.addPropertyChangeListener( this );
- handleEnterKeyStroke( gfField );
- ok2update.put(gfField,false);
-
- // create next button
- nextButton = new JButton("Next");
- nextButton.addActionListener(this);
-
- startStopButton = new JButton("Start Animation");
- startStopButton.addActionListener(this);
-
- // create prev button
- prevButton = new JButton("Prev");
- prevButton.addActionListener(this);
-
- // create alternate alignment button
- altAlignButton = new JButton("Alt Alignment");
- altAlignButton.addActionListener(this);
- altAlignButton.setEnabled(aligns.altAlign != null);
-
- //Create the sliders.
- alignSlider = new JSlider(JSlider.HORIZONTAL, 0, maxSliderVal, 0);
- alignSlider.addChangeListener(this);
- zoomSlider = new JSlider(JSlider.VERTICAL, 0, 20, 10);
- zoomSlider.addChangeListener(this);
-
- //Turn on labels at major tick marks.
- alignSlider.setMajorTickSpacing(calcTickSpacing(maxSliderVal));
- alignSlider.setPaintTicks(true);
- alignSlider.setPaintLabels(true);
-
- //Create gap suppression checkbox
- gapSuppressCheck = new JCheckBox("Gap Suppression", true);
- gapSuppressCheck.addItemListener(this);
-
- //Create the panel that displays the animation.
- alignPanel = new AlignmentPanel(aligns,450,true);
- alignPanel.setBorder(BorderFactory.createCompoundBorder(
- BorderFactory.createLoweredBevelBorder(),
- BorderFactory.createEmptyBorder(10,10,10,10)));
-
- // set up scrolling
- JScrollPane alignScroll = new JScrollPane(alignPanel);
- alignScroll.setPreferredSize(new Dimension(500,800));
- alignScroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
- alignScroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- alignScroll.addComponentListener(alignPanel);
-
- // Set up zoompanel
- JLabel plusLabel = new JLabel("+", JLabel.CENTER);
- plusLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
- JLabel minusLabel = new JLabel("-", JLabel.CENTER);
- minusLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
- JPanel zoomPanel = new JPanel();
- zoomPanel.setLayout(new BoxLayout(zoomPanel, BoxLayout.Y_AXIS));
- zoomPanel.add(plusLabel);
- zoomPanel.add(zoomSlider);
- zoomPanel.add(minusLabel);
-
- JPanel alignAndZoom = new JPanel(new BorderLayout());
- alignAndZoom.add(zoomPanel,BorderLayout.LINE_START);
- alignAndZoom.add(alignScroll,BorderLayout.CENTER);
-
- // create colorin checkbox
- coloredCheck = new JCheckBox("Coloring", true);
- coloredCheck.addItemListener(this);
-
- // set up color schemes
- colorSchemesList = new String[5];
- colorSchemesList[0] = "Accuracy";
- colorSchemesList[1] = "Sensitivity";
- colorSchemesList[2] = "Specificity";
- colorSchemesList[3] = "Certainty";
- colorSchemesList[4] = "Consistency";
-
- colorSchemesLabels = new String[5];
- colorSchemesLabels[0] = "Low Accuracy High Accuracy";
- colorSchemesLabels[1] = "Low Sensitivity High Sensitivity";
- colorSchemesLabels[2] = "Low Specificity High Specificity";
- colorSchemesLabels[3] = "Low Certainty High Certainty";
- colorSchemesLabels[4] = "Low Consistency High Consistency";
-
- colorSchemes = new JComboBox(colorSchemesList);
- colorSchemes.setSelectedIndex(0);
- colorSchemes.addActionListener(this);
-
- //Create legend
- URL imgURL = getClass().getResource("legend.jpg");
- ImageIcon legIcon = new ImageIcon(imgURL);
- legLabel = new JLabel("Low Accuracy High Accuracy", legIcon, JLabel.CENTER);
- legLabel.setVerticalTextPosition(JLabel.BOTTOM);
- legLabel.setHorizontalTextPosition(JLabel.CENTER);
- legLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
-
- // Create a subpanel for the label and text field.
- JPanel labelAndTextField = new JPanel(); //use FlowLayout
- labelAndTextField.add(colorSchemes);
- labelAndTextField.add(Box.createRigidArea(new Dimension(20,0)));
- labelAndTextField.add(legLabel);
- labelAndTextField.add(Box.createRigidArea(new Dimension(20,0)));
- labelAndTextField.add(accLabel);
- labelAndTextField.add(accField);
- labelAndTextField.add(Box.createRigidArea(new Dimension(10,0)));
- labelAndTextField.add(dAccLabel);
- labelAndTextField.add(Box.createRigidArea(new Dimension(20,0)));
- labelAndTextField.add(gfLabel);
- labelAndTextField.add(gfField);
- labelAndTextField.add(Box.createRigidArea(new Dimension(20,0)));
- labelAndTextField.add(sliderLabel);
- labelAndTextField.add(indexField);
-
- JPanel controlPane = new JPanel();
- controlPane.add(prevButton);
- controlPane.add(startStopButton);
- controlPane.add(nextButton);
- controlPane.add(altAlignButton);
- controlPane.add(coloredCheck);
- controlPane.add(gapSuppressCheck);
-
- // Put everything together.
- // The order in which these are added CANNOT be changed without
- // also changing the indexing in actionPerformed().
- add(alignAndZoom);
- add(Box.createRigidArea(new Dimension(0, 10)));
- add(labelAndTextField);
- add(alignSlider);
- add(controlPane);
- setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
-
- update(maxSliderVal);
- }
-
- // Catch changes to sliders
- public void stateChanged(ChangeEvent e) {
-
- JSlider source = (JSlider)e.getSource();
- if ( source == alignSlider && (boolean) ok2update.get(alignSlider)){
- update((int)alignSlider.getValue());
- }
- else if (source == zoomSlider){
- alignPanel.defaultFont = alignPanel.defaultFont.deriveFont(1 + (float)zoomSlider.getValue());
- alignPanel.iResized();
- //repaint();
- }
- }
-
- // Changes the alignment frame
- private void update(int index) {
- Alignment align = aligns.get(index);
- updatePicture(index);
- ok2update.put(alignSlider, false);
- alignSlider.setValue(index);
- ok2update.put(alignSlider, true);
- indexField.setText(Integer.toString(index));
-
- // update accuracy field
- accField.setText(getAccFieldString(align));
-
- // update delta accuracy field
- dAccLabel.setText(getDeltaAccFieldString(align, index));
-
- // update gap factor field
- gfField.setText(getGapFactorFieldString(align, index));
- }
-
- /// Get value for the accuracy field (varies based on color scheme).
- private String getAccFieldString(Alignment align){
-
- // displayed value depends on the chosen color scheme
- double accFieldValue = 0;
- switch (align.colorScheme) {
- case 0: // Accuracy
- accFieldValue = align.getAccNorm();
- break;
- case 1: // SPS
- accFieldValue = align.getSPSNorm();
- break;
- case 2: // PPV
- accFieldValue = align.getPPVNorm();
- break;
- case 3: // Certainty
- accFieldValue = align.getCertNorm();
- break;
- case 4: // Consistency
- accFieldValue = align.getConsNorm();
- break;
- default:
- System.exit(1);
- }
-
- // test for undefined value
- // (-1 is returned if undefined)
- if (accFieldValue < 0)
- return "Undefined";
- else {
- accFieldValue = Math.rint(accFieldValue*10000)/10000;
- return Double.toString(accFieldValue);
- }
-
- }
-
- /// Get value for the delta accuracy field (varies based on color scheme).
- /*
- * @param index index of the alignment
- * \return 0 if first alignment, N/A if alternate alignment and delta accuracy otherwise
- */
- private String getDeltaAccFieldString(Alignment align, int index){
-
- // displayed value depends on the chosen color scheme
- double delta = 0;
- switch (align.colorScheme) {
- case 0: // Accuracy
- delta = align.getDeltaAccNorm();
- break;
- case 1: // SPS
- delta = align.getDeltaSPSNorm();
- break;
- case 2: // PPV
- delta = align.getDeltaPPVNorm();
- break;
- case 3: // Certainty
- delta = align.getDeltaCertNorm();
- break;
- case 4: // Consistency
- delta = align.getDeltaConsNorm();
- break;
- default:
- System.exit(1);
- }
-
- // handle case of first alignment
- if (index == 0)
- delta = 0;
-
- // now format nicely
- NumberFormat formatter;
- if (delta < 0)
- formatter = new DecimalFormat("#0.0000");
- else
- formatter = new DecimalFormat(" #0.0000");
-
- String entry = "\u0394 Column " + colorSchemesList[align.colorScheme] + ": " + formatter.format(delta);
-
- // handle case of alternate alignment
- if (index == -1)
- entry = "\u0394 Column " + colorSchemesList[align.colorScheme] + ": N/A ";
-
- return entry;
- }
-
- /// Get value for the gap factor field.
- /*
- * @param index index of the alignment
- * \return Infinity if first alignment, N/A if alternate alignment and implicit gap factor otherwise
- */
- private String getGapFactorFieldString(Alignment align, int index){
-
- double gf = align.getGapFactor();
- gf = Math.rint(gf * 10)/10;
-
- String entry;
- // handle case of alternate alignment
- if (index == -1)
- return "N/A";
- // handle case of big gap factor
- else if (gf > 100 || gf < 0)
- return ">100";
- else
- return Double.toString(gf);
-
- }
-
- // Switch between alternate alignment and FSA alignment
- private void toggleAltAlign(boolean toAlt){
- if (toAlt){
- inAlt = true;
-
- Alignment align = aligns.get(-1);
- indexField.setText("ALT");
- updatePicture(-1);
-
- // update accuracy field
- accField.setText(getAccFieldString(align));
-
- // update delta accuracy field
- dAccLabel.setText(getDeltaAccFieldString(align, -1));
-
- // update gap factor field
- gfField.setText(getGapFactorFieldString(align, -1));
-
- altAlignButton.setText("FSA Alignment");
- if (parent != null)
- parent.setTitle("Multiple Alignment Display: " + altPath + " (Alternate alignment)");
- } else{
- inAlt = false;
-
- update((int)alignSlider.getValue());
- altAlignButton.setText("Alt Alignment");
- if (parent != null)
- parent.setTitle("Multiple Alignment Display: " + fsaPath + " (FSA alignment)");
- }
-
- prevButton.setEnabled(!toAlt);
- nextButton.setEnabled(!toAlt);
- startStopButton.setEnabled(!toAlt);
- accField.setEnabled(!toAlt);
- gfField.setEnabled(!toAlt);
- indexField.setEnabled(!toAlt);
- alignSlider.setEnabled(!toAlt);
-
- }
-
- // Catch changes to text boxes
- public void propertyChange(PropertyChangeEvent e) {
- if (!"value".equals(e.getPropertyName()))
- return;
-
- // alignment index field
- if ( e.getSource() == indexField && ok2update.get(indexField) ) {
- Number value = (Number)e.getNewValue();
- if (value != null) {
- update(value.intValue());
- ok2update.put(indexField,false);
- }
- }
-
- // accuracy field
- else if ( e.getSource() == accField && ok2update.get(accField) ) {
- // Float acc = (Float) e.getNewValue();
- int index = -1;
- int scheme = colorSchemes.getSelectedIndex();
- switch (scheme) {
- case 0:
- index = getIndexFromAcc ((Float)e.getNewValue());
- break;
- case 1:
- index = getIndexFromSPS ((Float)e.getNewValue());
- break;
- case 2:
- index = getIndexFromPPV ((Float)e.getNewValue());
- break;
- case 3:
- index = getIndexFromCert ((Float)e.getNewValue());
- break;
- case 4:
- index = getIndexFromCons ((Float)e.getNewValue());
- break;
- default:
- System.exit(1);
- }
-
- // if runs off the left, go to first alignment
- if (index < 0) {
- update(0);
- ok2update.put(accField, false);
- }
- // else go to the requested alignment
- else if (index >= 0 && index <= maxSliderVal) {
- update(index);
- ok2update.put(accField ,false);
- }
- }
-
- // gap factor field
- else if ( e.getSource() == gfField && (boolean) ok2update.get(gfField) ) {
-
- int index = getIndexFromGF ((Float)e.getNewValue());
-
- // if runs off the left, go to first alignment
- if (index < 0) {
- update(0);
- ok2update.put(gfField, false);
- }
- // else go to the requested alignment
- else if (index >= 0 && index <= maxSliderVal) {
- update(index);
- ok2update.put(gfField ,false);
- }
- }
-
- }
-
- // Catch button clicks and timer
- public void actionPerformed(ActionEvent e) {
-
- int curr = !inAlt ? (int)alignSlider.getValue() : -1;
-
- // next alignment
- if ( e.getSource() == nextButton) {
- if ( curr == maxSliderVal )
- update(0);
- else
- update(curr+1);
- }
-
- // timer
- else if (e.getSource() == timer){
- if (curr == maxSliderVal ){
- timer.stop();
- frozen = true;
- startStopButton.setText("Start Animation");
- }
- else
- update(curr+1);
- }
- // previous alignment
- else if ( e.getSource() == prevButton ) {
- if ( curr == 0 )
- update(maxSliderVal);
- else
- update(curr-1);
- }
- // start/stop animation
- else if ( e.getSource() == startStopButton ) {
- if ( frozen ) {
- if (curr == maxSliderVal)
- update(0);
- timer.start();
- startStopButton.setText("Stop Animation");
- altAlignButton.setEnabled(false);
- } else {
- timer.stop();
- startStopButton.setText("Start Animation");
- if (aligns.altAlign != null)
- altAlignButton.setEnabled(true);
- }
- frozen = !frozen;
- }
- // alternate alignment
- else if ( e.getSource() == altAlignButton ) {
- toggleAltAlign(altAlignButton.getText() == "Alt Alignment");
- }
- // color schemes
- else if ( e.getSource() == colorSchemes ){
-
- JComboBox cb = (JComboBox)e.getSource();
-
- // get the integer index of the color scheme
- int scheme = cb.getSelectedIndex();
-
- // update the color scheme
- aligns.setColorScheme(scheme);
-
- // update the legend label
- legLabel.setText(colorSchemesLabels[scheme]);
-
- // update the accuracy field label
- accLabel.setText(colorSchemesList[scheme] + ": ");
-
- // to do: this needs to check whether in the alternate alignment;
- // currently uses curr, which is always the FSA alignment
- // (not updated properly for alternate alignment)
-
- // update accuracy field value
- // NB aligns.get(curr) returns the current Alignment object
- accField.setText(getAccFieldString(aligns.get(curr)));
-
- // update the delta accuracy label
- dAccLabel.setText(getDeltaAccFieldString(aligns.get(curr), curr));
-
- // update the gap factor label
- gfField.setText(getGapFactorFieldString(aligns.get(curr), curr));
-
- // redraw the panel
- alignPanel.iResized();
- }
-
- }
-
- // Catch check box change
- public void itemStateChanged(ItemEvent e) {
-
- Object source = e.getItemSelectable();
-
- // colored
- if (source == coloredCheck){
- if (e.getStateChange() == ItemEvent.DESELECTED)
- alignPanel.setColored(false);
- else
- alignPanel.setColored(true);
- alignPanel.iResized();
- }
-
- // gap suppression
- else if (source == gapSuppressCheck){
- if (e.getStateChange() == ItemEvent.DESELECTED)
- aligns.setGapSuppress(false);
- else
- aligns.setGapSuppress(true);
- alignPanel.iResized();
- //repaint();
- }
-
- }
-
-
- public void alignmentToMov(){
-
- // Get save path for movie file.
- FileDialog chooseFile = new FileDialog(new Frame(), "Export as Quicktime Movie", FileDialog.SAVE);
- chooseFile.setVisible(true);
- String movFile = chooseFile.getFile();
- if (movFile == null)
- return;
- if (!movFile.endsWith(".mov"))
- movFile = movFile.concat(".mov");
- String dirPath = chooseFile.getDirectory();
- String movPath = dirPath + movFile;
-
- Vector<String> files = new Vector<String>();
- String fName;
-
-
- // Ceate JPEGs
- for (int i = 0; i < aligns.size(); i++){
- update(i);
- fName = String.format(dirPath + "/%08d.jpg",i);
- files.add(fName);
- alignPanel.saveAsJPEG(fName);
- }
-
- // Create movie
- JpegImagesToMovie imageToMovie = new JpegImagesToMovie();
- imageToMovie.doIt2(alignPanel.getWidth(), alignPanel.getHeight(), 5, files, movPath);
-
- // Delete temporary JPEGs
- Iterator iter = files.iterator();
- while (iter.hasNext()){
- fName = (String) iter.next();
- (new File(fName)).delete();
- }
- }
-
- protected void updatePicture(int frameNum) {
- alignPanel.setIndex(frameNum);
- }
-
- protected int calcTickSpacing(int val) {
- return ((val/10) - (val%10));
- }
-
- /// Get index for the alignment with specified accuracy.
- private int getIndexFromAcc(Float a) {
- int index = -1;
- double minDiff = (double) Double.MAX_VALUE;
- double diff;
-
- for (int i = 0; i < aligns.alignAccs.length; i++){
- diff = Math.abs(aligns.alignAccs[i].doubleValue() - a);
- if (diff < minDiff){
- minDiff = diff;
- index = i;
- }
- }
-
- return index;
- }
-
- /// Get index for the alignment with specified SPS.
- private int getIndexFromSPS(Float a) {
- int index = -1;
- double minDiff = Double.MAX_VALUE;
- double diff;
-
- for (int i = 0; i < aligns.alignSPSs.length; i++){
- diff = Math.abs(aligns.alignSPSs[i].doubleValue() - a);
- if (diff < minDiff){
- minDiff = diff;
- index = i;
- }
- }
-
- return index;
- }
-
- /// Get index for the alignment with specified PPV.
- private int getIndexFromPPV(Float a) {
- int index = -1;
- double minDiff = Double.MAX_VALUE;
- double diff;
-
- for (int i = 0; i < aligns.alignPPVs.length; i++){
- diff = Math.abs(aligns.alignPPVs[i].doubleValue() - a);
- if (diff < minDiff){
- minDiff = diff;
- index = i;
- }
- }
-
- return index;
- }
-
- /// Get index for the alignment with specified Certainty.
- private int getIndexFromCert(Float a) {
- int index = -1;
- double minDiff = Double.MAX_VALUE;
- double diff;
-
- for (int i = 0; i < aligns.alignCerts.length; i++){
- diff = Math.abs(aligns.alignCerts[i].doubleValue() - a);
- if (diff < minDiff){
- minDiff = diff;
- index = i;
- }
- }
-
- return index;
- }
-
- /// Get index for the alignment with specified Consistency.
- private int getIndexFromCons(Float a) {
- int index = -1;
- double minDiff = Double.MAX_VALUE;
- double diff;
-
- for (int i = 0; i < aligns.alignConss.length; i++){
- diff = Math.abs(aligns.alignConss[i].doubleValue() - a);
- if (diff < minDiff){
- minDiff = diff;
- index = i;
- }
- }
-
- return index;
- }
-
- /// Get index for the alignment with specified gap factor.
- private int getIndexFromGF(Float a) {
- int index = -1;
- double minDiff = Double.MAX_VALUE;
- double diff;
-
- for (int i = 0; i < aligns.alignGFs.length; i++){
- diff = Math.abs(aligns.alignGFs[i].doubleValue() - a);
- if (diff < minDiff){
- minDiff = diff;
- index = i;
- }
- }
-
- return index;
- }
-
-
- //React when the user presses Enter.
- private void handleEnterKeyStroke( final JFormattedTextField field ) {
- field.getInputMap().put(KeyStroke.getKeyStroke( KeyEvent.VK_ENTER, 0), "check");
- field.getActionMap().put("check", new AbstractAction() {
- public void actionPerformed(ActionEvent e) {
- //The text is invalid.
- if (!field.isEditValid()) {
- Toolkit.getDefaultToolkit().beep();
- field.selectAll();
- //The text is valid, so use it.
- } else try {
- ok2update.put(field,true);
- field.commitEdit();
- } catch (java.text.ParseException exc) { }
- }
- });
- }
-}
-
diff --git a/display/mad/Node.java b/display/mad/Node.java
deleted file mode 100644
index 4879953..0000000
--- a/display/mad/Node.java
+++ /dev/null
@@ -1,618 +0,0 @@
-
-/*
- * This file is part of FSA, a sequence alignment algorithm.
- * Source code in this file was written by Adam Roberts.
- * Code for different accuracy measures was written by Robert Bradley.
- */
-
-
-// to do:
-
-
-package mad;
-
-import java.util.*;
-
-//import it.unimi.dsi.fastutil.objects.*;
-
-public class Node{
-
- private int[] seqVals;// Indices of position in each sequence contained in node
- private char[] colors;
- public int seqI; // If an initial node, what sequence I contain (useful for gap fills).
- public int seqVal;
- public int numSeqs;
-
- public double acc;
- public double sps;
- public double ppv;
- public double cert;
- public double cons;
-
- public double accDenom;
- public double spsDenom;
- public double ppvDenom;
- public double certDenom;
- public double consDenom;
-
- public double weightTgf;
-
- public Node fwdEdge;
- public boolean highlighted = false;
-
- public int mergeOrder;
-
- /*
- * 0 = Accuracy
- * 1 = Sensitivity
- * 2 = Specificity
- * 3 = Certainty
- * 4 = Consistency
- */
- public int colorScheme;
-
- // Used for a merged node
- public boolean isMerge;
- public Node n1;
- public Node n2;
-
- // Used for topological sort (DFS)
- public int finishTime;
- public boolean visited;
-
- public ProbabilityMatrices pm; // allows access to probabilities to calculate accurcy
-
- public Node(int seqI, int seqVal, ProbabilityMatrices pm){
- this.seqVal = seqVal;
- this.seqI = seqI;
- this.pm = pm;
- this.isMerge = false;
-
- this.acc = -1;
- this.sps = -1;
- this.ppv = -1;
- this.cert = -1;
- this.cons = -1;
-
- this.accDenom = -1;
- this.spsDenom = -1;
- this.ppvDenom = -1;
- this.certDenom = -1;
- this.consDenom = -1;
-
- this.weightTgf = -1;
- this.mergeOrder = -1;
-
- }
-
- public Node(int[] seqVals, int seqI, ProbabilityMatrices pm){
- this.seqVals = seqVals;
- this.seqI = seqI;
- this.pm = pm;
- this.isMerge = false;
-
- this.acc = -1;
- this.sps = -1;
- this.ppv = -1;
- this.cert = -1;
- this.cons = -1;
-
- this.accDenom = -1;
- this.spsDenom = -1;
- this.ppvDenom = -1;
- this.certDenom = -1;
- this.consDenom = -1;
-
- this.weightTgf = -1;
- this.mergeOrder = -1;
-
- }
-
- public Node(Node n1, Node n2, int mergeOrder){
-
- this.n1 = n1;
- this.n2 = n2;
- this.pm = n1.pm;
- this.isMerge = true;
-
- this.acc = -1;
- this.sps = -1;
- this.ppv = -1;
- this.cert = -1;
- this.cons = -1;
-
- this.accDenom = -1;
- this.spsDenom = -1;
- this.ppvDenom = -1;
- this.certDenom = -1;
- this.consDenom = -1;
-
- this.weightTgf = calcWeightTgf (n1, n2);
- this.mergeOrder = mergeOrder;
-
- mergeNodes();
- }
-
-
- private void mergeNodes(){
-// int[] s1 = n1.seqIndices;
-// int[] s2 = n2.seqIndices;
-//
-// seqIndices = new int[s1.length];
-//
-// //Merge columns.
-// for (int i = 0; i < s1.length; i++) {
-// if (s1[i] != -1 && s2[i] != -1)
-// System.out.println("Sanity Check Failed: Sequence has been overwritten.");
-//
-// if (s1[i] != -1)
-// seqIndices[i] = s1[i];
-// else if (s2[i] != -1)
-// seqIndices[i] = s2[i];
-// else
-// seqIndices[i] = -1;
-// }
-
-
- //Merge highlighting
- this.highlighted = (n1.highlighted || n2.highlighted);
-
- //Merge edges
- //this.fEdges = new HashSet<Node>();
- //this.fEdges.addAll(n1.getFwdEdges());
- //this.fEdges.addAll(n2.getFwdEdges());
- }
-
- public void setHighlight(boolean val){
- if (val == highlighted)
- return;
-
- if (isMerge){
- n1.setHighlight(val);
- n2.setHighlight(val);
- }
-
- highlighted = val;
- calcColorAccuracy();
- }
-
- /// Calculate (updated) tgf weight for the merged column.
- private double calcWeightTgf(Node n1, Node n2){
-
- // initialize
- weightTgf = -1;
-
- int x,y;
- double prob;
-
- double pMatch = 0.;
- double pGap = 0.;
-
- int[] n1SeqIndices = n1.getSeqIndices();
- int[] n2SeqIndices = n2.getSeqIndices();
-
- for(int seq1=0; seq1 < pm.numSeqs; seq1++){
-
- x = n1SeqIndices[seq1];
-
- for (int seq2 = 0; seq2 < pm.numSeqs; seq2++){
-
- // if we don't have probability information for the sequence pair seq1, seq2 then skip it
- if ((seq1 == seq2) || !pm.matrixExists(seq1, seq2))
- continue;
-
- y = n2SeqIndices[seq2];
-
- // only look at pairs of characters
- if (x == -1 || y == -1)
- continue;
-
- // increment pMatch
- pMatch += pm.getElement(seq1,seq2,x,y);
- // increment pGap
- pGap += pm.getElement(seq1,seq2,x,-1);
- pGap += pm.getElement(seq1,seq2,-1,y);
-
- }
-
- }
-
-// System.err.print ("n1: "); n1.output();
-// System.err.print ("n2: "); n2.output();
-// System.err.println (" => pMatch = " + pMatch + "; pGap = " + pGap);
-
- return 2 * pMatch / pGap;
-
- }
-
- /// Calculate accuracy metrics for the column and store desired coloration.
- /*
- * Coloration is encoded as an array of chars.
- * \see getColors()
- */
- private void calcColorAccuracy(){
-
- // initialize
- acc = 0;
- sps = 0;
- ppv = 0;
- cert = 0;
- cons = 0;
-
- accDenom = 0;
- spsDenom = 0;
- ppvDenom = 0;
- certDenom = 0;
- consDenom = 0;
-
- // coloration for each character or gap in column
- // color scheme chosen based on this.colorScheme
- Double[] colorAccs = new Double[pm.numSeqs];
-
- double num; // per-character numerator
- double denom; // per-character denominator (must be a double b/c takes non-integer values for SPS, Certainty and Consistency)
-
- int x, y; // sequence positions
- double prob; // probability (match or gap)
-
- boolean hasMatch; // are there at least two characters in the column?
-
- int[] seqIndices = getSeqIndices(); // map from sequences to sequence positions in column
- for(int seq1=0; seq1 < pm.numSeqs; seq1++){
-
- // initialize values
- num = 0;
- denom = 0;
- colorAccs[seq1] = (Double) 0.0;
- hasMatch = false;
-
- x = seqIndices[seq1];
-
- for (int seq2 = 0; seq2 < pm.numSeqs; seq2++){
-
- // if we don't have probability information for the sequence pair seq1, seq2 then skip it
- if ((seq1 == seq2) || !pm.matrixExists(seq1, seq2))
- continue;
-
- y = seqIndices[seq2];
-
- int multiplier = 0;
- if (x != -1 && y != -1) { // neither are gaps
- multiplier = 2;
- hasMatch = true;
- }
- else if (x != -1 || y != -1) { // exactly 1 is a gap
- multiplier = 1;
- }
- else {
- continue;
- }
-
- prob = pm.getElement(seq1,seq2,x,y);
-
- // everything contributes to accuracy
- acc += multiplier * prob;
- accDenom += multiplier;
- if (colorScheme == 0) { // Accuracy
- num += multiplier * prob;
- denom += multiplier;
- }
-
- // certainty is colored for both character and gaps,
- // but we only add to the full certainty calculation if
- // the currect position isn't a gap (otherwise we overcount the gap information)
- if (colorScheme == 3) { // Certainty
- num += multiplier * prob;
- if (x != -1) // if x is not a gap, then use altmax_y P(x ~ y)
- denom += multiplier * pm.getAltMaxProb(seq1,seq2,x,y);
- else // if x is a gap, then use altmax_x P(x ~ y)
- denom += multiplier * pm.getAltMaxProb(seq2,seq1,y,x);
- }
-
- // and for consistency
- cons += multiplier * prob;
- if (x != -1) // if x is not a gap, then use max_y P(x ~ y)
- consDenom += multiplier * pm.getMaxProb(seq1,seq2,x);
- else // if x is a gap, then use max_x P(x ~ y)
- consDenom += multiplier * pm.getMaxProb(seq2,seq1,y);
- if (colorScheme == 4) { // Consistency
- num += multiplier * prob;
- if (x != -1) // if x is not a gap, then use max_y P(x ~ y)
- denom += multiplier * pm.getMaxProb(seq1,seq2,x);
- else // if x is a gap, then use max_x P(x ~ y)
- denom += multiplier * pm.getMaxProb(seq2,seq1,y);
- }
-
- // in contrast, SPS and PPV aren't defined for gaps
- if (x != -1) {
-
- // the numerator for SPS increases only if we're looking at aligned characters (y not a gap);
- // the denominator increases regardless
- // (this is guaranteed by the (multiplier - 1) factor)
- sps += (multiplier - 1) * prob;
- spsDenom += pm.getSumProb(seq1,seq2,x);
- if (colorScheme == 1) { // SPS
- num += (multiplier - 1) * prob;
- denom += pm.getSumProb(seq1,seq2,x);
- }
-
- // only pairs of aligned characters contribute to PPV
- // (both x and y ungapped)
- if (y != -1) {
- ppv += multiplier * prob;
- ppvDenom += multiplier;
- if (colorScheme == 2) { // PPV
- num += multiplier * prob;
- denom += multiplier;
- }
- }
-
- // certainty
- cert += multiplier * prob;
- if (x != -1) // if x is not a gap, then use altmax_y P(x ~ y)
- certDenom += multiplier * pm.getAltMaxProb(seq1,seq2,x,y);
- else // if x is a gap, then use altmax_x P(x ~ y)
- certDenom += multiplier * pm.getAltMaxProb(seq2,seq1,y,x);
-
- }
-
- }
-
- // store value for this character or gap if it exists
- // (if the denominator is defined)
- if (denom > 0.0001) {
-
- // sps and ppv are only defined if there is at least 1 match
- if (colorScheme == 1 || colorScheme == 2) {
- if (hasMatch)
- colorAccs[seq1] = (Double) SparseMatrix.saneProb (num / denom);
- else
- colorAccs[seq1] = (Double) (-1.); // store (temporary) negative value
- }
-
- // certainty takes values in interval [0, 1/0.01], so it needs to be mapped to [0,1]
- else if (colorScheme == 3)
- colorAccs[seq1] = (Double) SparseMatrix.saneProb (Node.normalizedCertainty (num / denom));
-
- // otherwise just store the normalized value
- else
- colorAccs[seq1] = (Double) SparseMatrix.saneProb (num / denom);
-
- }
- // if undefined, then store (temporary) negative value
- else {
- colorAccs[seq1] = (Double) (-1.);
- }
-
- }//Outer loop
-
- // Generate color code array
- colors = new char[seqIndices.length];
- for (int i = 0; i < colors.length; i++){
-
- double c;
-
- // if highlighted
- if (highlighted) {
- c = 65535.;
- }
- // if undefined
- else if (colorAccs[i].doubleValue() < 0.) {
- c = 256.;
- }
- // else encode as integer in interval 0...255
- else {
- c = Math.rint(colorAccs[i].doubleValue()*255);
- }
-
- // now store the value as a char
- // remember that 'char' acts as an unsigned short
- colors[i] = (char)c;
- }
-
- }
-
- /// Get unnormalized accuracy for column.
- /*
- * Re-calculate if necessary.
- */
- public double getAcc(){
- if (acc < 0)
- calcColorAccuracy();
- return acc;
- }
-
- /// Get normalization for accuracy for column.
- /*
- * Re-calculate if necessary.
- */
- public double getAccDenom(){
- if (accDenom < 0)
- calcColorAccuracy();
- return accDenom;
- }
-
- /// Get unnormalized SPS for column.
- /*
- * Re-calculate if necessary.
- */
- public double getSPS(){
- if (sps < 0)
- calcColorAccuracy();
- return sps;
- }
-
- /// Get normalization for SPS for column.
- /*
- * Re-calculate if necessary.
- */
- public double getSPSDenom(){
- if (spsDenom < 0)
- calcColorAccuracy();
- return spsDenom;
- }
-
- /// Get unnormalized PPV for column.
- /*
- * Re-calculate if necessary.
- */
- public double getPPV(){
- if (ppv < 0)
- calcColorAccuracy();
- return ppv;
- }
-
- /// Get normalization for PPV for column.
- /*
- * Re-calculate if necessary.
- */
- public double getPPVDenom(){
- if (ppvDenom < 0)
- calcColorAccuracy();
- return ppvDenom;
- }
-
- /// Get unnormalized certainty for column.
- /*
- * Re-calculate if necessary.
- */
- public double getCert(){
- if (cert < 0)
- calcColorAccuracy();
- return cert;
- }
-
- /// Get normalization for certainty for column.
- /*
- * Re-calculate if necessary.
- */
- public double getCertDenom(){
- if (certDenom < 0)
- calcColorAccuracy();
- return certDenom;
- }
-
- /// Get unnormalized consistency for column.
- /*
- * Re-calculate if necessary.
- */
- public double getCons(){
- if (cons < 0)
- calcColorAccuracy();
- return cons;
- }
-
- /// Get normalization for consistency for column.
- /*
- * Re-calculate if necessary.
- */
- public double getConsDenom(){
- if (consDenom < 0)
- calcColorAccuracy();
- return consDenom;
- }
-
- /// Get the tgf weight of the column.
- public double getWeightTgf(){
- if (weightTgf < 0)
- calcColorAccuracy();
- return weightTgf;
- }
-
- public int[] getSeqIndices(){
- if (seqVals != null)
- return seqVals;
- int[] seqIndices = new int[pm.numSeqs];
- Arrays.fill(seqIndices, -1);
- return addSeqIndices(seqIndices);
- }
-
- // Recursive method that adds all of the children's sequence indices to the array.
- public int[] addSeqIndices(int[] seqIndices){
- if (!isMerge){
- seqIndices[seqI] = seqVal;
- return seqIndices;
- }
-
- seqIndices = n1.addSeqIndices(seqIndices);
- seqIndices = n2.addSeqIndices(seqIndices);
-
- return seqIndices;
- }
-
-
- /// Update color scheme for node.
- /*
- * Updates coloration.
- * It is the responsibility of the parent object
- * to call this function whenever the color scheme is updated globally.
- */
- public void setColorScheme(int scheme){
- this.colorScheme = scheme;
- calcColorAccuracy();
- }
-
- /// Return an array of chars, each char representing a color.
- /*
- * Chars act as unsigned shorts, taking values from 0 to 2^16.
- * Colors are encoded as:
- * 0...255 coloration for accuracy (=> 256 possible colors in total)
- * 256 indicates highlighting
- * 65,535 indicates undefined
- * (this value is 2^16 - 1)
- */
- public char[] getColors(){
- if (colors == null)
- calcColorAccuracy();
- return colors;
- }
-
- public Set<Node> getFwdEdges(){
- Set<Node> fwdEdges = new HashSet<Node>();
- return addFwdEdges(fwdEdges);
- }
-
- // Recursive method that adds all of the children's edges to the set.
- public Set<Node> addFwdEdges(Set<Node> fwdEdges){
-
- if (isMerge && n1 != null){ // Alternate alignments have merges that w/o any child nodes
- n1.addFwdEdges(fwdEdges);
- n2.addFwdEdges(fwdEdges);
- }
- else if (fwdEdge != null){
- fwdEdges.add(fwdEdge);
- }
-
- return fwdEdges;
- }
-
- public void output(){
- StringBuffer s = new StringBuffer("");
- s.append(finishTime + ": ");
- int[] seqIndices = getSeqIndices();
- for (int i = 0; i < seqIndices.length; i++)
- s.append("(" + i + ", " + seqIndices[i] + ") ~ ");
-
- System.out.println(s);
- }
-
- /// Normalize a certainty value to interval [0,1].
- /*
- * @param c certainty in range [0, 1 / 0.01]
- * Uses a logarithmic transform.
- */
- static double normalizedCertainty (double c) {
-
- // if there was a better alternative, then return 0
- if (c < 1.0)
- return 0;
- // if it was 10 times better than the best alternative, then return 1
- else if (c >= 5.0)
- return 1;
- // else perform a logarithmic transform
- else
- return Math.log (c) / Math.log (5.0);
-
- }
-
-}
diff --git a/display/mad/ProbabilityMatrices.java b/display/mad/ProbabilityMatrices.java
deleted file mode 100644
index a3895f7..0000000
--- a/display/mad/ProbabilityMatrices.java
+++ /dev/null
@@ -1,169 +0,0 @@
-
-/*
- * This file is part of FSA, a sequence alignment algorithm.
- * Source code in this file was written by Adam Roberts.
- * Code for calculating and storing the sum and max probabilities
- * was written by Robert Bradley.
- */
-
-
-package mad;
-
-import java.util.*;
-
-public class ProbabilityMatrices{
- int numSeqs;
- int[] seqLengths;
- int[][] index;
- SparseMatrix[] matrices;
-
- public ProbabilityMatrices(int[] seqLengths){
- this.seqLengths = seqLengths;
- this.numSeqs = seqLengths.length;
- this.matrices = new SparseMatrix[numSeqs*(numSeqs-1)/2];
- buildIndex();
- }
-
- private void buildIndex(){
- int x = 0;
- this.index = new int[numSeqs][numSeqs];
- for (int i = 0; i < numSeqs; i++)
- for (int j = i+1; j < numSeqs; j++){
- this.index[i][j] = x;
- this.index[j][i] = x++;
- }
- }
-
- public void addElement(int seq1, int seq2, int i1, int i2, double prob){
-
- //Handle gaps and index change from input file
- if (i1 < 0)
- i1 = seqLengths[seq1];
- if (i2 < 0)
- i2 = seqLengths[seq2];
-
- if (seq1 > seq2){
- int temp = i1;
- i1 = i2;
- i2 = temp;
- }
-
- if (!matrixExists(seq1, seq2))
- addMatrix(seq1, seq2);
-
- matrices[getIndex(seq1,seq2)].put(i1, i2, prob);
- }
-
- public double getElement(int seq1, int seq2, int i1, int i2){
-
- if (!matrixExists(seq1, seq2))
- return 0.0;
-
- // Handle gaps
- if (i1 < 0)
- i1 = seqLengths[seq1];
- if (i2 < 0)
- i2 = seqLengths[seq2];
-
- if (seq1 > seq2){
- int temp = i1;
- i1 = i2;
- i2 = temp;
- }
- return matrices[getIndex(seq1,seq2)].get(i1, i2);
- }
-
- /// Get sum_pos2 P((seq1, pos1) ~ (seq2, pos2)).
- public double getSumProb(int seq1, int seq2, int pos1){
-
- if (!matrixExists(seq1, seq2)) {
- System.err.println ("Probability matrix for sequences " + seq1 + " and " + seq2 + " does not exist.");
- System.exit(1);
- }
-
- // no gaps
- if (pos1 < 0) {
- System.err.println ("Sum probability is undefined for gaps; offending sequences are " + seq1 + " and " + seq2 + ".");
- System.exit(1);
- }
-
- if (seq1 < seq2)
- return matrices[getIndex(seq1,seq2)].getSumProbI(pos1);
- else
- return matrices[getIndex(seq2,seq1)].getSumProbJ(pos1);
-
- }
-
- /// Get max_pos2 P((seq1, pos1) ~ (seq2, pos2)).
- public double getMaxProb(int seq1, int seq2, int pos1){
-
- if (!matrixExists(seq1, seq2)) {
- System.err.println ("Probability matrix for sequences " + seq1 + " and " + seq2 + " does not exist.");
- System.exit(1);
- }
-
- // no gaps
- if (pos1 < 0) {
- System.err.println ("Max probability is undefined for gaps; offending sequences are " + seq1 + " and " + seq2 + ".");
- System.exit(1);
- }
-
- if (seq1 < seq2)
- return matrices[getIndex(seq1,seq2)].getMaxProbI(pos1);
- else
- return matrices[getIndex(seq2,seq1)].getMaxProbJ(pos1);
-
- }
-
- /// Get altmax_pos2 P((seq1, pos1) ~ (seq2, pos2)).
- public double getAltMaxProb(int seq1, int seq2, int pos1, int pos2){
-
- if (!matrixExists(seq1, seq2)) {
- System.err.println ("Probability matrix for sequences " + seq1 + " and " + seq2 + " does not exist.");
- System.exit(1);
- }
-
- // handle gaps
- if (pos1 < 0) {
- System.err.println ("Alt max probability is undefined for gaps in first sequence; offending sequences are " + seq1 + " and " + seq2 + ".");
- System.exit(1);
- }
- else if (pos2 < 0) {
- pos2 = seqLengths[seq2]; // convert to indexing used by SparseMatrix
- }
-
- if (seq1 < seq2) {
- return matrices[getIndex(seq1,seq2)].getAltMaxProbI(pos1,pos2);
- }
- else {
- return matrices[getIndex(seq2,seq1)].getAltMaxProbJ(pos2,pos1);
- }
-
- }
-
-
-
- private int getIndex(int seq1, int seq2){
- return index[seq1][seq2];
- }
-
- private void addMatrix(int seq1, int seq2){
-
- if (seq1 > seq2){
- int temp = seq1;
- seq1 = seq2;
- seq2 = temp;
- }
- matrices[getIndex(seq1, seq2)] = new SparseMatrix(seqLengths[seq1]+1, seqLengths[seq2]+1);
- }
-
-
- public boolean matrixExists(int seq1, int seq2){
- if (seq1 == seq2)
- return false;
- return matrices[getIndex(seq1, seq2)] != null;
- }
-
-
-
-}
\ No newline at end of file
diff --git a/display/mad/PropertyChangeHandler.java b/display/mad/PropertyChangeHandler.java
deleted file mode 100644
index b3dd843..0000000
--- a/display/mad/PropertyChangeHandler.java
+++ /dev/null
@@ -1,37 +0,0 @@
-
-/*
- * This file is part of FSA, a sequence alignment algorithm.
- * Source code in this file was written by Michael Smoot.
- */
-
-package mad;
-
-import java.util.*;
-import java.beans.*;
-
-
-public class PropertyChangeHandler {
-
- private static PropertyChangeSupport pcs;
- private static Object o;
-
- static {
- o = new Object();
- pcs = new PropertyChangeSupport( o );
- }
-
- public static PropertyChangeSupport getPropertyChangeSupport() {
- return pcs;
- }
-
- public static void firePropertyChange(String id, Object oldValue, Object newValue) {
- try {
- PropertyChangeIDs.valueOf(id);
- } catch (IllegalArgumentException ex) {
- System.err.println("Illegal PropertyChangeEvent ID: " + id + " ignoring!");
- return;
- }
- PropertyChangeEvent e = new PropertyChangeEvent(pcs, id, oldValue, newValue);
- pcs.firePropertyChange(e);
- }
-}
diff --git a/display/mad/PropertyChangeIDs.java b/display/mad/PropertyChangeIDs.java
deleted file mode 100644
index 6a339f6..0000000
--- a/display/mad/PropertyChangeIDs.java
+++ /dev/null
@@ -1,11 +0,0 @@
-
-/*
- * This file is part of FSA, a sequence alignment algorithm.
- * Source code in this file was written by Michael Smoot.
- */
-
-package mad;
-
-public enum PropertyChangeIDs {
- CHANGE_ALIGNMENT,
-}
diff --git a/display/mad/SaveAsFastaAction.java b/display/mad/SaveAsFastaAction.java
deleted file mode 100644
index f1c4469..0000000
--- a/display/mad/SaveAsFastaAction.java
+++ /dev/null
@@ -1,59 +0,0 @@
-
-/*
- * This file is part of FSA, a sequence alignment algorithm.
- * Source code in this file was written by Michael Smoot and Adam Roberts.
- */
-
-package mad;
-
-import java.util.*;
-import java.beans.*;
-import java.io.*;
-import javax.swing.*;
-import java.awt.event.ActionEvent;
-import java.awt.Component;
-
-
-public class SaveAsFastaAction extends AbstractAction implements PropertyChangeListener {
-
- Alignments aligns;
- MadPanel parent;
- JFileChooser fc;
-
- SaveAsFastaAction(MadPanel parent ) {
- super("Save as Multi-FASTA");
- this.parent = parent;
- fc = new JFileChooser();
- PropertyChangeHandler.getPropertyChangeSupport()
- .addPropertyChangeListener(PropertyChangeIDs.CHANGE_ALIGNMENT.toString(), this);
- aligns = parent.aligns;
- }
-
- public void actionPerformed(ActionEvent e) {
- Alignment a = aligns.get(aligns.index);
- System.out.print ("Saving as Multi-FASTA file...");
- if ( a != null ) {
- try {
- int returnVal = fc.showSaveDialog(parent);
- if (returnVal == JFileChooser.APPROVE_OPTION) {
- File file = fc.getSelectedFile();
- FileWriter fw = new FileWriter(file);
- String mfa = a.toMultiFasta();
- fw.write(mfa,0,mfa.length());
- fw.close();
- System.out.println ("done");
- }
- } catch (Exception ioe) {
- JOptionPane.showMessageDialog(parent,
- "Failed to save Multi-FASTA file:\n\n" + ioe.getMessage(),
- "Error saving file.",
- JOptionPane.ERROR_MESSAGE);
- ioe.printStackTrace();
- }
- } else
- System.err.println("No alignment found.");
-
- }
-
- public void propertyChange(PropertyChangeEvent e) {}
-}
diff --git a/display/mad/SaveAsMovAction.java b/display/mad/SaveAsMovAction.java
deleted file mode 100644
index ea9b07b..0000000
--- a/display/mad/SaveAsMovAction.java
+++ /dev/null
@@ -1,31 +0,0 @@
-
-/*
- * This file is part of FSA, a sequence alignment algorithm.
- * Source code in this file was written by Adam Roberts.
- */
-
-
-package mad;
-
-import java.util.*;
-import java.beans.*;
-import java.io.*;
-import javax.swing.*;
-import java.awt.event.ActionEvent;
-import java.awt.*;
-
-
-public class SaveAsMovAction extends AbstractAction {
-
- MadPanel parent;
-
- SaveAsMovAction(MadPanel parent ) {
- super("Export as Quicktime Movie");
- this.parent = parent;
- }
-
- public void actionPerformed(ActionEvent e) {
- this.parent.alignmentToMov();
- }
-
-}
diff --git a/display/mad/SaveAsTiffAction.java b/display/mad/SaveAsTiffAction.java
deleted file mode 100644
index 27b0ba5..0000000
--- a/display/mad/SaveAsTiffAction.java
+++ /dev/null
@@ -1,53 +0,0 @@
-
-/*
- * This file is part of FSA, a sequence alignment algorithm.
- * Source code in this file was written by Robert Bradley.
- */
-
-package mad;
-
-import java.util.*;
-import java.beans.*;
-import java.io.*;
-import javax.swing.*;
-import java.awt.event.ActionEvent;
-import java.awt.Component;
-
-public class SaveAsTiffAction extends AbstractAction implements PropertyChangeListener {
-
- AlignmentPanel parentAlignPanel;
- MadPanel parent;
- JFileChooser fc;
-
- SaveAsTiffAction(MadPanel parent ) {
- super("Save as TIFF file");
- this.parent = parent;
- fc = new JFileChooser();
- PropertyChangeHandler.getPropertyChangeSupport()
- .addPropertyChangeListener(PropertyChangeIDs.CHANGE_ALIGNMENT.toString(), this);
- parentAlignPanel = parent.alignPanel;
- }
-
- public void actionPerformed(ActionEvent e) {
-
- System.out.print("Saving as TIFF image...");
-
- try {
- int returnVal = fc.showSaveDialog(parent);
- if (returnVal == JFileChooser.APPROVE_OPTION) {
- File file = fc.getSelectedFile();
- parentAlignPanel.saveAsTiff (file.getPath());
- System.out.println("done");
- }
- } catch (Exception ioe) {
- JOptionPane.showMessageDialog(parent,
- "Failed to save TIFF file:\n\n" + ioe.getMessage(),
- "Error saving file.",
- JOptionPane.ERROR_MESSAGE);
- ioe.printStackTrace();
- }
-
- }
-
- public void propertyChange(PropertyChangeEvent e) {}
-}
diff --git a/display/mad/SparseMatrix.java b/display/mad/SparseMatrix.java
deleted file mode 100644
index 683e123..0000000
--- a/display/mad/SparseMatrix.java
+++ /dev/null
@@ -1,257 +0,0 @@
-
-/*
- * This file is part of FSA, a sequence alignment algorithm.
- * Source code in this file was written by Adam Roberts.
- * Code for calculating and storing the sum and max probabilities
- * was written by Robert Bradley.
- */
-
-
-package mad;
-
-//import it.unimi.dsi.fastutil.ints.*;
-import java.util.*;
-import java.lang.Math.*;
-
-public class SparseMatrix{
-
- private int length, width;
- private Vector<Double> values;
- private Map<Integer, Integer> indexMap;
-
- private Double[] sumProbI;
- private Double[][] maxProbI;
-
- private Double[] sumProbJ;
- private Double[][] maxProbJ;
-
- public SparseMatrix(int length, int width){
- this.length = length; // length == length of first sequence + 1
- this.width = width; // width == length of second sequence + 1
-
- indexMap = new HashMap<Integer, Integer>();
- values = new Vector<Double>(100, 10);
-
- sumProbI = new Double[length-1];
- maxProbI = new Double[length-1][2];
-
- sumProbJ = new Double[width-1];
- maxProbJ = new Double[width-1][2];
-
- }
-
- public void put(int i, int j, double e){
- int index = j*length+i;
-
- if (indexMap.containsKey(index)){
- System.err.println("SANITY CHECK FAILED: Matrix index repeated (i = " + i + ", j = " + j + ", index = " + index + ")");
- System.exit(-1);
- }
-
- // check that the probability is valid
- e = SparseMatrix.saneProb (e);
-
- indexMap.put(index, values.size());
- values.addElement(e);
-
- // Note that max is over all possible positions in the other sequence, including gapped.
- // The below check over single indices ensures that the possibility of gaps
- // in the other sequence are properly taken into account when finding the max (and alternate max).
-
- // first sequence
- if (i < length-1) { // i == (length - 1) corresponds to first sequence gapped
- // (NB sequence position indices are 0-based)
-
- // if max prob undefined, store new value
- if (maxProbI[i][0] == null) {
- maxProbI[i][0] = (Double) e;
- }
-
- // if new max, then store new value and update alternate max
- else if (maxProbI[i][0].doubleValue() < e) {
- maxProbI[i][1] = maxProbI[i][0];
- maxProbI[i][0] = (Double) e;
- }
-
- // if new alternate max b/c alternate max is undefined
- else if (maxProbI[i][1] == null) {
- maxProbI[i][1] = (Double) e;
- }
-
- // if new alternate max
- else if (maxProbI[i][1].doubleValue() < e) {
- maxProbI[i][1] = (Double) e;
- }
-
- }
-
- // second sequence
- if (j < width-1) { // j == (width - 1) corresponds to second sequence gapped
-
- // if max prob undefined, store new value
- // and initialize alternate max
- if (maxProbJ[j][0] == null) {
- maxProbJ[j][0] = (Double) e;
- }
-
- // if new max, then store new value and update alternate max
- else if (maxProbJ[j][0].doubleValue() < e) {
- maxProbJ[j][1] = maxProbJ[j][0];
- maxProbJ[j][0] = (Double) e;
- }
-
- // if new alternate max b/c alternate max is undefined
- else if (maxProbJ[j][1] == null) {
- maxProbJ[j][1] = (Double) e;
- }
-
- // if new alternate max
- else if (maxProbJ[j][1].doubleValue() < e) {
- maxProbJ[j][1] = (Double) e;
- }
-
- }
-
- // sum is only over possible aligned character pairs
- // (if gaps are included then all sums be 1. b/c they're normalized probability distributions)
- if ((i < length-1) && (j < width-1)) {
-
- if (sumProbI[i] == null)
- sumProbI[i] = (Double) e;
- else
- sumProbI[i] += (Double) e;
-
- if (sumProbJ[j] == null)
- sumProbJ[j] = (Double) e;
- else
- sumProbJ[j] += (Double) e;
-
- }
-
- }
-
- public double get(int i, int j){
- int index = j*length+i;
- if (!indexMap.containsKey(index))
- return 0.0;
- return SparseMatrix.saneProb (values.get(indexMap.get(index)));
- }
-
- /// Get sum_pos2 P((seq1, pos1) ~ (seq2, pos2)).
- /*
- * Cover the case of no entry for a match probability > 0.01.
- */
- public double getSumProbI(int pos){
- if (sumProbI[pos] == null) // cover case of no input data (no match prob above FSA's threshold)
- return 0.01;
- return SparseMatrix.saneProb (sumProbI[pos]);
- }
-
- /// Get sum_pos1 P((seq1, pos1) ~ (seq2, pos2)).
- /*
- * Cover the case of no entry for a match probability > 0.01.
- */
- public double getSumProbJ(int pos){
- if (sumProbJ[pos] == null) // cover case of no input data (no match prob above FSA's threshold)
- return 0.01;
- return SparseMatrix.saneProb (sumProbJ[pos]);
- }
-
- /// Get max_pos2 P((seq1, pos1) ~ (seq2, pos2)).
- public double getMaxProbI(int pos){
- // sanity check
- if (maxProbI[pos][0] == null) {
- System.err.println ("A max prob is null; this should never happen!");
- System.exit(1);
- }
- return SparseMatrix.saneProb (maxProbI[pos][0]);
- }
-
- /// Get altmax_pos2 P((seq1, pos1) ~ (seq2, pos2)).
- /*
- * \return second-best probability, or 0.01 if undefined
- * Minimum value of 0.01 is due to the inherent coarse-graining
- * of the probability reported by FSA.
- */
- public double getAltMaxProbI(int pos1, int pos2){
-
- // sanity check
- if (maxProbI[pos1][0] == null) {
- System.err.println ("A max prob is null; this should never happen!");
- System.exit(1);
- }
-
- // get probability to determine best alternate
- double prob = get(pos1,pos2);
-
- // if prob is the max, then return the second-best alternate
- if (Math.abs (prob - maxProbI[pos1][0].doubleValue()) < 0.0001) {
- if (maxProbI[pos1][1] != null)
- return SparseMatrix.saneProb (maxProbI[pos1][1]);
- else
- return 0.01;
- }
- // else return the max
- else
- return SparseMatrix.saneProb (maxProbI[pos1][0]);
-
- }
-
- /// Get altmax_pos1 P((seq1, pos1) ~ (seq2, pos2)).
- /*
- * \return second-best probability, or 0.01 if undefined
- * Minimum value of 0.01 is due to the inherent coarse-graining
- * of the probability reported by FSA.
- */
- public double getAltMaxProbJ(int pos1, int pos2){
-
- // sanity check
- if (maxProbJ[pos2][0] == null) {
- System.err.println ("A max prob is null; this should never happen!");
- System.exit(1);
- }
-
- // get probability to determine best alternate
- double prob = get(pos1,pos2);
-
- // if prob is the max, then return the second-best alternate
- if (Math.abs (prob - maxProbJ[pos2][0].doubleValue()) < 0.0001) {
- if (maxProbJ[pos2][1] != null)
- return SparseMatrix.saneProb (maxProbJ[pos2][1]);
- else
- return 0.01;
- }
- // else return the max
- else
- return SparseMatrix.saneProb (maxProbJ[pos2][0]);
-
- }
-
- /// Get max_pos1 P((seq1, pos1) ~ (seq2, pos2)).
- public double getMaxProbJ(int pos){
-
- // sanity check
- if (maxProbJ[pos][0] == null) {
- System.err.println ("A max prob is null; this should never happen!");
- System.exit(1);
- }
-
- return SparseMatrix.saneProb (maxProbJ[pos][0]);
- }
-
- /// Bounds-checking for a valid probability.
- static double saneProb (double p) {
- if (p < -0.0001 || p > 1.0001) {
- System.err.println("Error: probability " + p + " is out of bounds.");
- System.exit(1);
- }
- p = (p < -0.0001) ? 0. : p;
- p = (p > 1.0001) ? 1.0 : p;
- return p;
- }
-
- static double saneProb (Double p) {
- return saneProb (p.doubleValue());
- }
-
-}
\ No newline at end of file
diff --git a/display/mad/legend.jpg b/display/mad/legend.jpg
deleted file mode 100644
index 86972bc..0000000
Binary files a/display/mad/legend.jpg and /dev/null differ
diff --git a/display/mad/manifest.mf b/display/mad/manifest.mf
deleted file mode 100644
index 93b0654..0000000
--- a/display/mad/manifest.mf
+++ /dev/null
@@ -1,4 +0,0 @@
-Manifest-Version: 1.0
-Created-By: 1.6.0 (Sun Microsystems Inc.)
-Class-Path: JMF-2.1.1e/lib/jmf.jar jai-1_1_3/lib/jai_codec.jar jai-1_1_3/lib/jai_core.jar
-Main-Class: mad.MAD
diff --git a/display/mad/manifest.mf.in b/display/mad/manifest.mf.in
deleted file mode 100644
index 1804577..0000000
--- a/display/mad/manifest.mf.in
+++ /dev/null
@@ -1,4 +0,0 @@
-Manifest-Version: 1.0
-Created-By: 1.6.0 (Sun Microsystems Inc.)
-Class-Path: JMF-2.1.1e/lib/jmf.jar jai-1_1_3/lib/jai_codec.jar jai-1_1_3/lib/jai_core.jar
-Main-Class: @MAD_MAIN_CLASS@
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/fsa.git
More information about the debian-med-commit
mailing list