From 6c36212c1e16557e6afb1b4dba9c28864d52ad4a Mon Sep 17 00:00:00 2001 From: MorellThomas Date: Fri, 8 Sep 2023 10:47:04 +0200 Subject: [PATCH] Properly integrated endGaps option for AlignSeq.traceAlignment() --- build.gradle | 109 +++++++++++----------- src/jalview/analysis/AlignSeq.java | 106 +++++++++++++++++++-- src/jalview/analysis/Finder.java | 3 +- src/jalview/analysis/PaSiMap.java | 2 +- src/jalview/analysis/ccAnalysis.java | 1 + src/jalview/datamodel/AlignmentView.java | 1 - src/jalview/gui/AlignFrame.java | 2 +- src/jalview/gui/CalculationChooser.java | 2 +- src/jalview/gui/PaSiMapPanel.java | 6 +- src/jalview/gui/PairwiseAlignPanel.java | 13 ++- test/jalview/gui/PairwiseAlignmentPanelTest.java | 4 +- 11 files changed, 172 insertions(+), 77 deletions(-) diff --git a/build.gradle b/build.gradle index a917a0d..800fe42 100644 --- a/build.gradle +++ b/build.gradle @@ -53,7 +53,6 @@ plugins { id 'eclipse' id "com.diffplug.spotless" version "6.18.0" //.gradle.spotless" "3.28.0" id 'com.github.johnrengelman.shadow' version '8.1.1' // was 4.0.3 - id "com.diffplug.gradle.spotless" version "3.28.0" id 'com.install4j.gradle' version '10.0.3' id 'com.dorongold.task-tree' version '2.1.1' // only needed to display task dependency tree with gradle task1 [task2 ...] taskTree id 'com.palantir.git-version' version '0.13.0' apply false @@ -194,7 +193,7 @@ ext { testDir = string("${jalviewDir}/${bareTestSourceDir}") classesDir = string("${jalviewDir}/${classes_dir}") - outputDir = file(classesDir) + destinationDirectory = file(classesDir) // clover useClover = clover.equals("true") @@ -592,14 +591,14 @@ sourceSets { main { java { srcDirs sourceDir - outputDir = file(classesDir) + destinationDirectory = file(classesDir) } resources { srcDirs = [ resourcesBuildDir, docBuildDir, helpBuildDir ] } - compileClasspath = files(sourceSets.main.java.outputDir) + compileClasspath = files(sourceSets.main.java.destinationDirectory) compileClasspath += fileTree(dir: "${jalviewDir}/${libDir}", include: ["*.jar"]) runtimeClasspath = compileClasspath @@ -609,14 +608,14 @@ sourceSets { clover { java { srcDirs cloverInstrDir - outputDir = cloverClassesDir + destinationDirectory = cloverClassesDir } resources { srcDirs = sourceSets.main.resources.srcDirs } - compileClasspath = files( sourceSets.clover.java.outputDir ) + compileClasspath = files( sourceSets.clover.java.destinationDirectory ) //compileClasspath += files( testClassesDir ) compileClasspath += fileTree(dir: "${jalviewDir}/${libDir}", include: ["*.jar"]) compileClasspath += fileTree(dir: "${jalviewDir}/${clover_lib_dir}", include: ["*.jar"]) @@ -628,14 +627,14 @@ sourceSets { test { java { srcDirs testSourceDir - outputDir = file(testClassesDir) + destinationDirectory = file(testClassesDir) } resources { srcDirs = useClover ? sourceSets.clover.resources.srcDirs : sourceSets.main.resources.srcDirs } - compileClasspath = files( sourceSets.test.java.outputDir ) + compileClasspath = files( sourceSets.test.java.destinationDirectory ) compileClasspath += useClover ? sourceSets.clover.compileClasspath : sourceSets.main.compileClasspath compileClasspath += fileTree(dir: "${jalviewDir}/${utils_dir}/testnglibs", include: ["**/*.jar"]) @@ -660,7 +659,7 @@ eclipse { } classpath { - //defaultOutputDir = sourceSets.main.java.outputDir + //defaultOutputDir = sourceSets.main.java.destinationDirectory configurations.each{ c-> if (c.isCanBeResolved()) { minusConfigurations += [c] @@ -699,7 +698,7 @@ eclipse { HashMap alreadyAddedLibPath = new HashMap<>(); sourceSets.main.compileClasspath.findAll { it.name.endsWith(".jar") }.any { - //don't want to add outputDir as eclipse is using its own output dir in bin/main + //don't want to add destinationDirectory as eclipse is using its own output dir in bin/main if (it.isDirectory() || ! it.exists()) { // don't add dirs to classpath, especially if they don't exist return false // groovy "continue" in .any closure @@ -719,7 +718,7 @@ eclipse { } sourceSets.test.compileClasspath.findAll { it.name.endsWith(".jar") }.any { - //no longer want to add outputDir as eclipse is using its own output dir in bin/main + //no longer want to add destinationDirectory as eclipse is using its own output dir in bin/main if (it.isDirectory() || ! it.exists()) { // don't add dirs to classpath return false // groovy "continue" in .any closure @@ -1096,7 +1095,7 @@ compileTestJava { clean { doFirst { - delete sourceSets.main.java.outputDir + delete sourceSets.main.java.destinationDirectory } } @@ -1104,7 +1103,7 @@ clean { cleanTest { dependsOn cleanClover doFirst { - delete sourceSets.test.java.outputDir + delete sourceSets.test.java.destinationDirectory } } @@ -1196,7 +1195,7 @@ def convertMdToHtml (FileTree mdFiles, File cssFile) { task copyDocs(type: Copy) { def inputDir = "${jalviewDir}/${doc_dir}" - def outputDir = "${docBuildDir}/${doc_dir}" + def destinationDirectory = "${docBuildDir}/${doc_dir}" from(inputDir) { include('**/*.txt') include('**/*.md') @@ -1217,10 +1216,10 @@ task copyDocs(type: Copy) { exclude('**/*.html') exclude('**/*.xml') } - into outputDir + into destinationDirectory inputs.dir(inputDir) - outputs.dir(outputDir) + outputs.dir(destinationDirectory) } @@ -1455,7 +1454,7 @@ def getMdSections(String content) { task copyHelp(type: Copy) { def inputDir = helpSourceDir - def outputDir = "${helpBuildDir}/${help_dir}" + def destinationDirectory = "${helpBuildDir}/${help_dir}" from(inputDir) { include('**/*.txt') include('**/*.md') @@ -1480,11 +1479,11 @@ task copyHelp(type: Copy) { exclude('**/*.xml') exclude('**/*.jhm') } - into outputDir + into destinationDirectory inputs.dir(inputDir) outputs.files(helpFile) - outputs.dir(outputDir) + outputs.dir(destinationDirectory) } @@ -1632,7 +1631,7 @@ task copyResources(type: Copy) { description = "Copy (and make text substitutions in) the resources dir to the build area" def inputDir = resourceDir - def outputDir = resourcesBuildDir + def destinationDirectory = resourcesBuildDir from(inputDir) { include('**/*.txt') include('**/*.md') @@ -1653,10 +1652,10 @@ task copyResources(type: Copy) { exclude('**/*.html') exclude('**/*.xml') } - into outputDir + into destinationDirectory inputs.dir(inputDir) - outputs.dir(outputDir) + outputs.dir(destinationDirectory) } task copyChannelResources(type: Copy) { @@ -1665,7 +1664,7 @@ task copyChannelResources(type: Copy) { description = "Copy the channel resources dir to the build resources area" def inputDir = "${channelDir}/${resource_dir}" - def outputDir = resourcesBuildDir + def destinationDirectory = resourcesBuildDir from(inputDir) { include(channel_props) filter(ReplaceTokens, @@ -1679,10 +1678,10 @@ task copyChannelResources(type: Copy) { from(inputDir) { exclude(channel_props) } - into outputDir + into destinationDirectory inputs.dir(inputDir) - outputs.dir(outputDir) + outputs.dir(destinationDirectory) } task createBuildProperties(type: WriteProperties) { @@ -2085,8 +2084,8 @@ jar { "Implementation-Version": JALVIEW_VERSION } - def outputDir = "${jalviewDir}/${package_dir}" - outputDir = file(outputDir) + def destinationDirectory = "${jalviewDir}/${package_dir}" + destinationDirectory = file(destinationDirectory) archiveFileName = rootProject.name+".jar" duplicatesStrategy "EXCLUDE" @@ -2097,11 +2096,11 @@ jar { exclude "**/*.jar" exclude "**/*.jar.*" - inputs.dir(sourceSets.main.java.outputDir) + inputs.dir(sourceSets.main.java.destinationDirectory) sourceSets.main.resources.srcDirs.each{ dir -> inputs.dir(dir) } - outputs.file("${outputDir}/${archiveFileName}") + outputs.file("${destinationDirectory}/${archiveFileName}") } @@ -3331,10 +3330,10 @@ task jalviewjsEclipseCopyDropins(type: Copy) { def inputFiles = fileTree(dir: "${jalviewDir}/${jalviewjs_eclipse_dropins_dir}", include: "*.jar") inputFiles += file("${jalviewDir}/${jalviewjsJ2sPlugin}") - def outputDir = "${jalviewDir}/${jalviewjsBuildDir}/${jalviewjs_eclipse_tmp_dropins_dir}" + def destinationDirectory = "${jalviewDir}/${jalviewjsBuildDir}/${jalviewjs_eclipse_tmp_dropins_dir}" from inputFiles - into outputDir + into destinationDirectory } @@ -3442,13 +3441,13 @@ task jalviewjsSyncAllLibs (type: Sync) { dependsOn jalviewjsTransferUnzipAllLibs def inputFiles = fileTree(dir: "${jalviewDir}/${jalviewjsTransferSiteLibDir}") inputFiles += fileTree(dir: "${jalviewDir}/${jalviewjsTransferSiteSwingJsDir}") - def outputDir = "${jalviewDir}/${jalviewjsSiteDir}" + def destinationDirectory = "${jalviewDir}/${jalviewjsSiteDir}" from inputFiles - into outputDir + into destinationDirectory def outputFiles = [] rename { filename -> - outputFiles += "${outputDir}/${filename}" + outputFiles += "${destinationDirectory}/${filename}" null } preserve { @@ -3467,13 +3466,13 @@ task jalviewjsSyncResources (type: Sync) { dependsOn buildResources def inputFiles = fileTree(dir: resourcesBuildDir) - def outputDir = "${jalviewDir}/${jalviewjsSiteDir}/${jalviewjs_j2s_subdir}" + def destinationDirectory = "${jalviewDir}/${jalviewjsSiteDir}/${jalviewjs_j2s_subdir}" from inputFiles - into outputDir + into destinationDirectory def outputFiles = [] rename { filename -> - outputFiles += "${outputDir}/${filename}" + outputFiles += "${destinationDirectory}/${filename}" null } preserve { @@ -3486,13 +3485,13 @@ task jalviewjsSyncResources (type: Sync) { task jalviewjsSyncSiteResources (type: Sync) { def inputFiles = fileTree(dir: "${jalviewDir}/${jalviewjs_site_resource_dir}") - def outputDir = "${jalviewDir}/${jalviewjsSiteDir}" + def destinationDirectory = "${jalviewDir}/${jalviewjsSiteDir}" from inputFiles - into outputDir + into destinationDirectory def outputFiles = [] rename { filename -> - outputFiles += "${outputDir}/${filename}" + outputFiles += "${destinationDirectory}/${filename}" null } preserve { @@ -3506,13 +3505,13 @@ task jalviewjsSyncSiteResources (type: Sync) { task jalviewjsSyncBuildProperties (type: Sync) { dependsOn createBuildProperties def inputFiles = [file(buildProperties)] - def outputDir = "${jalviewDir}/${jalviewjsSiteDir}/${jalviewjs_j2s_subdir}" + def destinationDirectory = "${jalviewDir}/${jalviewjsSiteDir}/${jalviewjs_j2s_subdir}" from inputFiles - into outputDir + into destinationDirectory def outputFiles = [] rename { filename -> - outputFiles += "${outputDir}/${filename}" + outputFiles += "${destinationDirectory}/${filename}" null } preserve { @@ -3731,7 +3730,7 @@ task jalviewjsBuildAllCores { def swingJ2sDir = "${jalviewDir}/${jalviewjsTransferSiteSwingJsDir}/${jalviewjs_j2s_subdir}" def libJ2sDir = "${jalviewDir}/${jalviewjsTransferSiteLibDir}/${jalviewjs_j2s_subdir}" def jsDir = "${jalviewDir}/${jalviewjsTransferSiteSwingJsDir}/${jalviewjs_js_subdir}" - def outputDir = "${jalviewDir}/${jalviewjsTransferSiteCoreDir}/${jalviewjs_j2s_subdir}/core" + def destinationDirectory = "${jalviewDir}/${jalviewjsTransferSiteCoreDir}/${jalviewjs_j2s_subdir}/core" def prefixFile = "${jsDir}/core/coretop2.js" def suffixFile = "${jsDir}/core/corebottom2.js" @@ -3775,8 +3774,8 @@ task jalviewjsBuildAllCores { } def list = fileTree(dir: j2sDir, includes: filelist) - def jsfile = "${outputDir}/core${name}.js" - def zjsfile = "${outputDir}/core${name}.z.js" + def jsfile = "${destinationDirectory}/core${name}.js" + def zjsfile = "${destinationDirectory}/core${name}.z.js" jalviewjsCoreClasslists += [ 'jsfile': jsfile, @@ -3794,8 +3793,8 @@ task jalviewjsBuildAllCores { // _stevesoft core. add any cores without a classlist here (and the inputs and outputs) def stevesoftClasslistName = "_stevesoft" def stevesoftClasslist = [ - 'jsfile': "${outputDir}/core${stevesoftClasslistName}.js", - 'zjsfile': "${outputDir}/core${stevesoftClasslistName}.z.js", + 'jsfile': "${destinationDirectory}/core${stevesoftClasslistName}.js", + 'zjsfile': "${destinationDirectory}/core${stevesoftClasslistName}.z.js", 'list': fileTree(dir: j2sDir, include: "com/stevesoft/pat/**/*.js"), 'name': stevesoftClasslistName ] @@ -3828,8 +3827,8 @@ task jalviewjsBuildAllCores { ] ) def allClasslist = [ - 'jsfile': "${outputDir}/core${allClasslistName}.js", - 'zjsfile': "${outputDir}/core${allClasslistName}.z.js", + 'jsfile': "${destinationDirectory}/core${allClasslistName}.js", + 'zjsfile': "${destinationDirectory}/core${allClasslistName}.z.js", 'list': allJsFiles, 'name': allClasslistName ] @@ -3882,11 +3881,11 @@ task jalviewjsPublishCoreTemplates { dependsOn jalviewjsBuildAllCores def inputFileName = "${jalviewDir}/${j2s_coretemplate_html}" def inputFile = file(inputFileName) - def outputDir = "${jalviewDir}/${jalviewjsTransferSiteCoreDir}" + def destinationDirectory = "${jalviewDir}/${jalviewjsTransferSiteCoreDir}" def outputFiles = [] jalviewjsCoreClasslists.each { cl -> - def outputFile = "${outputDir}/${jalviewjsJalviewTemplateName}_${cl.name}.html" + def outputFile = "${destinationDirectory}/${jalviewjsJalviewTemplateName}_${cl.name}.html" cl['outputfile'] = outputFile outputFiles += outputFile } @@ -3905,13 +3904,13 @@ task jalviewjsSyncCore (type: Sync) { dependsOn jalviewjsBuildAllCores dependsOn jalviewjsPublishCoreTemplates def inputFiles = fileTree(dir: "${jalviewDir}/${jalviewjsTransferSiteCoreDir}") - def outputDir = "${jalviewDir}/${jalviewjsSiteDir}" + def destinationDirectory = "${jalviewDir}/${jalviewjsSiteDir}" from inputFiles - into outputDir + into destinationDirectory def outputFiles = [] rename { filename -> - outputFiles += "${outputDir}/${filename}" + outputFiles += "${destinationDirectory}/${filename}" null } preserve { diff --git a/src/jalview/analysis/AlignSeq.java b/src/jalview/analysis/AlignSeq.java index 3448e79..4ec0457 100755 --- a/src/jalview/analysis/AlignSeq.java +++ b/src/jalview/analysis/AlignSeq.java @@ -381,7 +381,6 @@ public class AlignSeq /** * DOCUMENT ME! */ - //&! not / 10 public void traceAlignment() { // Find the maximum score along the rhs or bottom row @@ -411,7 +410,103 @@ public class AlignSeq int j = maxj; int trace; maxscore = score[i][j] / 10f; - //maxscore = score[i][j]; + + + aseq1 = new int[seq1.length + seq2.length]; + aseq2 = new int[seq1.length + seq2.length]; + + StringBuilder sb1 = new StringBuilder(aseq1.length); + StringBuilder sb2 = new StringBuilder(aseq2.length); + + count = (seq1.length + seq2.length) - 1; + + + while (i > 0 && j > 0) + { + aseq1[count] = seq1[i]; + sb1.append(s1str.charAt(i)); + aseq2[count] = seq2[j]; + sb2.append(s2str.charAt(j)); + + trace = findTrace(i, j); + + if (trace == 0) + { + i--; + j--; + } + else if (trace == 1) + { + j--; + aseq1[count] = GAP_INDEX; + sb1.replace(sb1.length() - 1, sb1.length(), "-"); + } + else if (trace == -1) + { + i--; + aseq2[count] = GAP_INDEX; + sb2.replace(sb2.length() - 1, sb2.length(), "-"); + } + + count--; + } + + seq1start = i + 1; + seq2start = j + 1; + + if (aseq1[count] != GAP_INDEX) + { + aseq1[count] = seq1[i]; + sb1.append(s1str.charAt(i)); + } + + if (aseq2[count] != GAP_INDEX) + { + aseq2[count] = seq2[j]; + sb2.append(s2str.charAt(j)); + } + + + /* + * we built the character strings backwards, so now + * reverse them to convert to sequence strings + */ + astr1 = sb1.reverse().toString(); + astr2 = sb2.reverse().toString(); + } + + /** + * DOCUMENT ME! + */ + public void traceAlignmentWithEndGaps() + { + // Find the maximum score along the rhs or bottom row + float max = -Float.MAX_VALUE; + + for (int i = 0; i < seq1.length; i++) + { + if (score[i][seq2.length - 1] > max) + { + max = score[i][seq2.length - 1]; + maxi = i; + maxj = seq2.length - 1; + } + } + + for (int j = 0; j < seq2.length; j++) + { + if (score[seq1.length - 1][j] > max) + { + max = score[seq1.length - 1][j]; + maxi = seq1.length - 1; + maxj = j; + } + } + + int i = maxi; + int j = maxj; + int trace; + maxscore = score[i][j] / 10f; //&! get trailing gaps while ((i < seq1.length - 1) || (j < seq2.length - 1)) @@ -658,14 +753,12 @@ public class AlignSeq * * @return DOCUMENT ME! */ - //&! not * 10 public int findTrace(int i, int j) { int t = 0; float pairwiseScore = scoreMatrix.getPairwiseScore(s1str.charAt(i), s2str.charAt(j)); float max = score[i - 1][j - 1] + (pairwiseScore * 10); - //float max = score[i - 1][j - 1] + (pairwiseScore); if (F[i][j] > max) { @@ -703,7 +796,6 @@ public class AlignSeq /** * DOCUMENT ME! */ - //&! not * 10 public void calcScoreMatrix() { int n = seq1.length; @@ -711,7 +803,6 @@ public class AlignSeq // top left hand element score[0][0] = scoreMatrix.getPairwiseScore(s1str.charAt(0), - //s2str.charAt(0)); s2str.charAt(0)) * 10; E[0][0] = -GAP_EXTEND_COST; F[0][0] = 0; @@ -727,7 +818,6 @@ public class AlignSeq float pairwiseScore = scoreMatrix.getPairwiseScore(s1str.charAt(0), s2str.charAt(j)); score[0][j] = max(pairwiseScore * 10, -GAP_OPEN_COST, - //score[0][j] = max(pairwiseScore, -GAP_OPEN_COST, -GAP_EXTEND_COST); traceback[0][j] = 1; @@ -743,7 +833,6 @@ public class AlignSeq float pairwiseScore = scoreMatrix.getPairwiseScore(s1str.charAt(i), s2str.charAt(0)); score[i][0] = max(pairwiseScore * 10, E[i][0], F[i][0]); - //score[i][0] = max(pairwiseScore, E[i][0], F[i][0]); traceback[i][0] = -1; } @@ -760,7 +849,6 @@ public class AlignSeq float pairwiseScore = scoreMatrix.getPairwiseScore(s1str.charAt(i), s2str.charAt(j)); score[i][j] = max(score[i - 1][j - 1] + (pairwiseScore * 10), - //score[i][j] = max(score[i - 1][j - 1] + (pairwiseScore), E[i][j], F[i][j]); traceback[i][j] = findTrace(i, j); } diff --git a/src/jalview/analysis/Finder.java b/src/jalview/analysis/Finder.java index 21fa2f1..c84c69a 100644 --- a/src/jalview/analysis/Finder.java +++ b/src/jalview/analysis/Finder.java @@ -606,7 +606,8 @@ public class Finder implements FinderI } else { - allFeatures = sf.getAllFeatures(null); + //allFeatures = sf.getAllFeatures(null); + allFeatures = sf.getAllFeatures(); } // so we can check we are advancing when debugging long fpos = 0; diff --git a/src/jalview/analysis/PaSiMap.java b/src/jalview/analysis/PaSiMap.java index e9236cb..77c28be 100755 --- a/src/jalview/analysis/PaSiMap.java +++ b/src/jalview/analysis/PaSiMap.java @@ -241,7 +241,7 @@ public class PaSiMap implements Runnable { // run needleman regardless if aligned or not // gui.PairwiseAlignPanel <++> - PairwiseAlignPanel alignment = new PairwiseAlignPanel(seqs); + PairwiseAlignPanel alignment = new PairwiseAlignPanel(seqs, true); float[][] scores = alignment.getAlignmentScores(); //bigger index first -- eg scores[14][13] Hashtable connectivity = seqs.calculateConnectivity(scores, dim); diff --git a/src/jalview/analysis/ccAnalysis.java b/src/jalview/analysis/ccAnalysis.java index 948aa8f..5e149b8 100755 --- a/src/jalview/analysis/ccAnalysis.java +++ b/src/jalview/analysis/ccAnalysis.java @@ -792,6 +792,7 @@ public class ccAnalysis /** * check the termination condition for nonlinear least squares + * TODO can be removed and added just as one line in trf (: terminationStatus = (ftolSatisfied condition || xtolSatisfied condition) ? 1 : 0;) doesnt matter as long as distinguished between 0 and rest * * @param actualReduction * @param cost diff --git a/src/jalview/datamodel/AlignmentView.java b/src/jalview/datamodel/AlignmentView.java index 8b2a5c3..e6604d1 100644 --- a/src/jalview/datamodel/AlignmentView.java +++ b/src/jalview/datamodel/AlignmentView.java @@ -1106,7 +1106,6 @@ public class AlignmentView } } } - //&! AlignmentI visal = view.getVisibleAlignment('-'); if (visal != null) { diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 49bd4e9..3deb8e0 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -3787,7 +3787,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, else { JInternalFrame frame = new JInternalFrame(); - frame.setContentPane(new PairwiseAlignPanel(viewport)); + frame.setContentPane(new PairwiseAlignPanel(viewport, false)); Desktop.addInternalFrame(frame, MessageManager.getString("action.pairwise_alignment"), 600, 500); diff --git a/src/jalview/gui/CalculationChooser.java b/src/jalview/gui/CalculationChooser.java index 816b537..6a3aa0b 100644 --- a/src/jalview/gui/CalculationChooser.java +++ b/src/jalview/gui/CalculationChooser.java @@ -89,7 +89,7 @@ public class CalculationChooser extends JPanel private static final int MIN_PCA_SELECTION = 4; - private static final int MIN_PASIMAP_SELECTION = 4; //&! <++>!! chekc how many + private static final int MIN_PASIMAP_SELECTION = 8; //&! AlignFrame af; diff --git a/src/jalview/gui/PaSiMapPanel.java b/src/jalview/gui/PaSiMapPanel.java index 62a0c80..f3a1f52 100644 --- a/src/jalview/gui/PaSiMapPanel.java +++ b/src/jalview/gui/PaSiMapPanel.java @@ -109,8 +109,8 @@ public class PaSiMapPanel extends GPCAPanel boolean selected = av.getSelectionGroup() != null && av.getSelectionGroup().getSize() > 0; - //&! do i need seqstrings? - AlignmentView seqstrings = av.getAlignmentView(selected); + //&! do i need seqstrings? -> no + //AlignmentView seqstrings = av.getAlignmentView(selected); SequenceI[] seqs; if (!selected) { @@ -420,7 +420,7 @@ public class PaSiMapPanel extends GPCAPanel } } - public void makePaSiMapImage(ImageMaker.TYPE type) + public void makePaSiMapImage(ImageMaker.TYPE type) throws Exception { int width = getRotatableCanvas().getWidth(); int height = getRotatableCanvas().getHeight(); diff --git a/src/jalview/gui/PairwiseAlignPanel.java b/src/jalview/gui/PairwiseAlignPanel.java index 1cca215..e51024e 100755 --- a/src/jalview/gui/PairwiseAlignPanel.java +++ b/src/jalview/gui/PairwiseAlignPanel.java @@ -57,7 +57,7 @@ public class PairwiseAlignPanel extends GPairwiseAlignPanel * @param viewport * DOCUMENT ME! */ - public PairwiseAlignPanel(AlignmentViewport viewport) + public PairwiseAlignPanel(AlignmentViewport viewport, boolean endGaps) { super(); this.av = viewport; @@ -107,7 +107,14 @@ public class PairwiseAlignPanel extends GPairwiseAlignPanel } as.calcScoreMatrix(); - as.traceAlignment(); + if (endGaps) + { + //&! + as.traceAlignmentWithEndGaps(); + } else { + as.traceAlignment(); + } + //&! as.scoreAlignment(); if (!first) @@ -118,8 +125,8 @@ public class PairwiseAlignPanel extends GPairwiseAlignPanel first = false; as.printAlignment(System.out); scores[i][j] = as.getMaxScore() / as.getASeq1().length; - alignmentScores[i][j] = as.getAlignmentScore(); //&! + alignmentScores[i][j] = as.getAlignmentScore(); totscore = totscore + scores[i][j]; textarea.append(as.getOutput()); diff --git a/test/jalview/gui/PairwiseAlignmentPanelTest.java b/test/jalview/gui/PairwiseAlignmentPanelTest.java index 750698a..34e5877 100644 --- a/test/jalview/gui/PairwiseAlignmentPanelTest.java +++ b/test/jalview/gui/PairwiseAlignmentPanelTest.java @@ -55,7 +55,7 @@ public class PairwiseAlignmentPanelTest sg.setEndRes(35); viewport.setSelectionGroup(sg); - PairwiseAlignPanel testee = new PairwiseAlignPanel(viewport); + PairwiseAlignPanel testee = new PairwiseAlignPanel(viewport, false); String text = ((JTextArea) PA.getValue(testee, "textarea")).getText(); String expected = "Score = 80.0\n" + "Length of alignment = 4\n" @@ -80,7 +80,7 @@ public class PairwiseAlignmentPanelTest DataSourceType.PASTE); AlignViewport viewport = af.getViewport(); - PairwiseAlignPanel testee = new PairwiseAlignPanel(viewport); + PairwiseAlignPanel testee = new PairwiseAlignPanel(viewport, false); String text = ((JTextArea) PA.getValue(testee, "textarea")).getText(); String expected = "Score = 80.0\n" + "Length of alignment = 4\n" -- 1.7.10.2