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
testDir = string("${jalviewDir}/${bareTestSourceDir}")
classesDir = string("${jalviewDir}/${classes_dir}")
- outputDir = file(classesDir)
+ destinationDirectory = file(classesDir)
// clover
useClover = clover.equals("true")
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
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"])
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"])
}
classpath {
- //defaultOutputDir = sourceSets.main.java.outputDir
+ //defaultOutputDir = sourceSets.main.java.destinationDirectory
configurations.each{ c->
if (c.isCanBeResolved()) {
minusConfigurations += [c]
HashMap<String, Boolean> 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
}
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
clean {
doFirst {
- delete sourceSets.main.java.outputDir
+ delete sourceSets.main.java.destinationDirectory
}
}
cleanTest {
dependsOn cleanClover
doFirst {
- delete sourceSets.test.java.outputDir
+ delete sourceSets.test.java.destinationDirectory
}
}
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')
exclude('**/*.html')
exclude('**/*.xml')
}
- into outputDir
+ into destinationDirectory
inputs.dir(inputDir)
- outputs.dir(outputDir)
+ outputs.dir(destinationDirectory)
}
task copyHelp(type: Copy) {
def inputDir = helpSourceDir
- def outputDir = "${helpBuildDir}/${help_dir}"
+ def destinationDirectory = "${helpBuildDir}/${help_dir}"
from(inputDir) {
include('**/*.txt')
include('**/*.md')
exclude('**/*.xml')
exclude('**/*.jhm')
}
- into outputDir
+ into destinationDirectory
inputs.dir(inputDir)
outputs.files(helpFile)
- outputs.dir(outputDir)
+ outputs.dir(destinationDirectory)
}
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')
exclude('**/*.html')
exclude('**/*.xml')
}
- into outputDir
+ into destinationDirectory
inputs.dir(inputDir)
- outputs.dir(outputDir)
+ outputs.dir(destinationDirectory)
}
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,
from(inputDir) {
exclude(channel_props)
}
- into outputDir
+ into destinationDirectory
inputs.dir(inputDir)
- outputs.dir(outputDir)
+ outputs.dir(destinationDirectory)
}
task createBuildProperties(type: WriteProperties) {
"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"
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}")
}
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
}
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 {
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 {
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 {
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 {
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"
}
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,
// _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
]
]
)
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
]
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
}
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 {
/**
* DOCUMENT ME!
*/
- //&! not / 10
public void traceAlignment()
{
// Find the maximum score along the rhs or bottom row
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))
*
* @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)
{
/**
* DOCUMENT ME!
*/
- //&! not * 10
public void calcScoreMatrix()
{
int n = seq1.length;
// 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;
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;
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;
}
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);
}