Skip to content
Commits on Source (7)
libjloda-java (0.0+git20180523.cbaf6d1-1) unstable; urgency=medium
* New upstream commit
* Watch file based on git mode
* Point Vcs-fields to Salsa
* Standards-Version: 4.1.4
-- Andreas Tille <tille@debian.org> Fri, 25 May 2018 23:11:46 +0200
libjloda-java (0.0+20180317-1) experimental; urgency=medium
* New upstream commit
......
......@@ -10,9 +10,9 @@ Build-Depends: debhelper (>= 11~),
libbatik-java,
libjama-java,
libopenjfx-java
Standards-Version: 4.1.3
Vcs-Browser: https://anonscm.debian.org/cgit/debian-med/libjloda-java.git
Vcs-Git: https://anonscm.debian.org/git/debian-med/libjloda-java.git
Standards-Version: 4.1.4
Vcs-Browser: https://salsa.debian.org/med-team/libjloda-java
Vcs-Git: https://salsa.debian.org/med-team/libjloda-java.git
Homepage: https://github.com/danielhuson/jloda
Package: libjloda-java
......
#!/bin/sh -e
COMPRESS=xz
NAME=`dpkg-parsechangelog | awk '/^Source/ { print $2 }'`
ONAME=`echo $NAME | sed 's/lib\(.*\)-java/\1/'`
MVERSION=`dpkg-parsechangelog | awk '/^Version:/ { print $2 }' | sed 's/^\([0-9\.]\+\)[+~][-0-9]\+$/\1/'`
mkdir -p ../tarballs
cd ../tarballs
# need to clean up the tarballs dir first because upstream tarball might
# contain a directory with unpredictable name
rm -rf *
git clone --quiet https://github.com/danielhuson/${ONAME} ${NAME}
cd $NAME
VERSION=${MVERSION}+`date -d @$(git show --format="%at" | head -n1) +%Y%m%d`
# for esthetical reasons set file timestamps (if git-restore-mtime is installed)
git restore-mtime || true
cd ..
TARDIR=${NAME}-${VERSION}
mv ${NAME} ${TARDIR}
rm -rf ${TARDIR}/.git
rm -rf ${TARDIR}/jars/batik*
rm -rf ${TARDIR}/jars/Jama-*
find ${TARDIR} -name .DS_Store -delete
GZIP="--best --no-name" tar --owner=root --group=root --mode=a+rX -caf "$NAME"_"$VERSION".orig.tar.${COMPRESS} "${TARDIR}"
rm -rf ${TARDIR}
......@@ -13,6 +13,3 @@ override_dh_clean:
override_dh_auto_build:
ant -buildfile antbuild/build.xml jar
get-orig-source:
. debian/get-orig-source
version=3
version=4
https://github.com/danielhuson/jloda/releases .*/archive/.*(\d[\d.-]+)\.(?:tar(?:\.gz|\.bz2)?|tgz)
opts="mode=git,pretty=0.0+git%cd.%h" \
https://github.com/danielhuson/jloda.git HEAD
# Issue asking for release tags:
# https://github.com/danielhuson/jloda/issues/1
/*
* Copyright (C) 2015 Daniel H. Huson
* Copyright (C) 2018 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
......
/*
* Copyright (C) 2015 Daniel H. Huson
* Copyright (C) 2018 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
......
/*
* Copyright (C) 2015 Daniel H. Huson
* Copyright (C) 2018 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
......
......@@ -43,9 +43,9 @@ public class FruchtermanReingoldLayout {
public FruchtermanReingoldLayout(Graph graph, NodeSet fixedNodes) {
this.graph = graph;
nodes = graph.getNodes().toArray();
edges = new int[graph.getNumberOfEdges()][2];
coordinates = new float[nodes.length][2];
forceDelta = new float[nodes.length][2];
edges = new int[2][graph.getNumberOfEdges()];
coordinates = new float[2][nodes.length];
forceDelta = new float[2][nodes.length];
fixed = new BitSet();
initialize(fixedNodes);
......@@ -63,8 +63,8 @@ public class FruchtermanReingoldLayout {
}
int eId = 0;
for (Edge e = graph.getFirstEdge(); e != null; e = e.getNext()) {
edges[eId][0] = node2id.get(e.getSource());
edges[eId][1] = node2id.get(e.getTarget());
edges[0][eId] = node2id.get(e.getSource());
edges[1][eId] = node2id.get(e.getTarget());
eId++;
}
......@@ -79,8 +79,8 @@ public class FruchtermanReingoldLayout {
while (stack.size() > 0) {
Node w = stack.pop();
int id = node2id.get(w);
coordinates[id][0] = (float) (100 * Math.sin(2 * Math.PI * count / nodes.length));
coordinates[id][1] = (float) (100 * Math.cos(2 * Math.PI * count / nodes.length));
coordinates[0][id] = (float) (100 * Math.sin(2 * Math.PI * count / nodes.length));
coordinates[1][id] = (float) (100 * Math.cos(2 * Math.PI * count / nodes.length));
count++;
for (Edge e = w.getFirstAdjacentEdge(); e != null; e = w.getNextAdjacentEdge(e)) {
Node u = e.getOpposite(w);
......@@ -114,7 +114,7 @@ public class FruchtermanReingoldLayout {
}
for (int v = 0; v < nodes.length; v++) {
result.set(nodes[v], new Point2D.Float(coordinates[v][0], coordinates[v][1]));
result.set(nodes[v], new Point2D.Float(coordinates[0][v], coordinates[1][v]));
}
}
......@@ -131,57 +131,57 @@ public class FruchtermanReingoldLayout {
for (int v1 = 0; v1 < nodes.length; v1++) {
for (int v2 = 0; v2 < nodes.length; v2++) {
if (v1 != v2) {
float xDist = coordinates[v1][0] - coordinates[v2][0];
float yDist = coordinates[v1][1] - coordinates[v2][1];
float xDist = coordinates[0][v1] - coordinates[0][v2];
float yDist = coordinates[1][v1] - coordinates[1][v2];
float dist = (float) Math.sqrt(xDist * xDist + yDist * yDist);
if (dist > 0) {
float repulsiveF = k * k / dist;
forceDelta[v1][0] += xDist / dist * repulsiveF;
forceDelta[v1][1] += yDist / dist * repulsiveF;
forceDelta[0][v1] += xDist / dist * repulsiveF;
forceDelta[1][v1] += yDist / dist * repulsiveF;
}
}
}
}
// attraction
for (int[] edge : edges) {
int v1 = edge[0];
int v2 = edge[1];
float xDist = coordinates[v1][0] - coordinates[v2][0];
float yDist = coordinates[v1][1] - coordinates[v2][1];
for (int i = 0; i < edges[0].length; i++) {
int v1 = edges[0][i];
int v2 = edges[1][i];
float xDist = coordinates[0][v1] - coordinates[0][v2];
float yDist = coordinates[1][v1] - coordinates[1][v2];
float dist = (float) Math.sqrt(xDist * xDist + yDist * yDist);
if (dist > 0) {
float attractiveF = dist * dist / k;
forceDelta[v1][0] -= xDist / dist * attractiveF;
forceDelta[v1][1] -= yDist / dist * attractiveF;
forceDelta[v2][0] += xDist / dist * attractiveF;
forceDelta[v2][1] += yDist / dist * attractiveF;
forceDelta[0][v1] -= xDist / dist * attractiveF;
forceDelta[1][v1] -= yDist / dist * attractiveF;
forceDelta[0][v2] += xDist / dist * attractiveF;
forceDelta[1][v2] += yDist / dist * attractiveF;
}
}
// gravity
for (int v = 0; v < nodes.length; v++) {
float distSquared = (float) Math.sqrt(coordinates[v][0] * coordinates[v][0] + coordinates[v][1] * coordinates[v][1]);
float distSquared = (float) Math.sqrt(coordinates[0][v] * coordinates[0][v] + coordinates[1][v] * coordinates[1][v]);
float gravityF = 0.01f * k * (float) gravity * distSquared;
forceDelta[v][0] -= gravityF * coordinates[v][0] / distSquared;
forceDelta[v][1] -= gravityF * coordinates[v][1] / distSquared;
forceDelta[0][v] -= gravityF * coordinates[0][v] / distSquared;
forceDelta[1][v] -= gravityF * coordinates[1][v] / distSquared;
}
// speed
for (int v = 0; v < nodes.length; v++) {
forceDelta[v][0] *= speed / SPEED_DIVISOR;
forceDelta[v][1] *= speed / SPEED_DIVISOR;
forceDelta[0][v] *= speed / SPEED_DIVISOR;
forceDelta[1][v] *= speed / SPEED_DIVISOR;
}
// apply the forces:
for (int v = 0; v < nodes.length; v++) {
float xDist = forceDelta[v][0];
float yDist = forceDelta[v][1];
float xDist = forceDelta[0][v];
float yDist = forceDelta[1][v];
float dist = (float) Math.sqrt(xDist * xDist + yDist * yDist);
if (dist > 0 && !fixed.get(v)) {
float limitedDist = Math.min(maxDisplace * ((float) speed / SPEED_DIVISOR), dist);
coordinates[v][0] += xDist / dist * limitedDist;
coordinates[v][1] += yDist / dist * limitedDist;
coordinates[0][v] += xDist / dist * limitedDist;
coordinates[1][v] += yDist / dist * limitedDist;
}
}
}
......
/*
* Copyright (C) 2015 Daniel H. Huson
* Copyright (C) 2018 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
......@@ -26,8 +26,11 @@ import java.io.FilenameFilter;
* Daniel Huson, 12.2017
*/
public class GFF3FileFilter extends FileFilterBase implements FilenameFilter {
public GFF3FileFilter() {
this(true);
private boolean lookInside = true;
public GFF3FileFilter(boolean allowGZip, boolean lookInside, String... additionalSuffixes) {
this(allowGZip, additionalSuffixes);
this.lookInside = lookInside;
}
public GFF3FileFilter(String... additionalSuffixes) {
......@@ -46,8 +49,11 @@ public class GFF3FileFilter extends FileFilterBase implements FilenameFilter {
public boolean accept(String fileName) {
boolean suffixOk = super.accept(Basic.getFileNameWithoutZipOrGZipSuffix(fileName));
if (suffixOk) { // look inside the file
if (lookInside) {
final String[] lines = Basic.getFirstLinesFromFile(new File(fileName), 1);
return lines != null && lines[0] != null && lines[0].startsWith("##gff-version 3");
} else
return true;
} else
return false;
}
......@@ -56,6 +62,14 @@ public class GFF3FileFilter extends FileFilterBase implements FilenameFilter {
* @return description of file matching the filter
*/
public String getBriefDescription() {
return "GFF Files";
return "GFF3 Files";
}
public boolean isLookInside() {
return lookInside;
}
public void setLookInside(boolean lookInside) {
this.lookInside = lookInside;
}
}
......@@ -20,6 +20,7 @@
package jloda.util;
import java.util.Comparator;
import java.util.Iterator;
/**
* a generic pair of objects
......@@ -196,4 +197,72 @@ public class Pair<S, T> implements Comparable<Pair<S, T>>, Comparator<Pair<S, T>
public boolean contains(Object x) {
return x.equals(first) || x.equals(second);
}
/**
* iterable over first elements
*
* @param src
* @param <P>
* @param <Q>
* @return iterable over all first elements
*/
public static <P, Q> Iterable<P> firstValues(final Iterable<Pair<P, Q>> src) {
return new Iterable<P>() {
@Override
public Iterator<P> iterator() {
return new Iterator<P>() {
private final Iterator<Pair<P, Q>> it = src.iterator();
@Override
public boolean hasNext() {
return it.hasNext();
}
@Override
public P next() {
return it.next().getFirst();
}
@Override
public void remove() {
it.remove();
}
};
}
};
}
/**
* iterable over second elements
*
* @param src
* @param <P>
* @param <Q>
* @return iterable over all second elements
*/
public static <P, Q> Iterable<Q> secondValues(final Iterable<Pair<P, Q>> src) {
return new Iterable<Q>() {
@Override
public Iterator<Q> iterator() {
return new Iterator<Q>() {
private final Iterator<Pair<P, Q>> it = src.iterator();
@Override
public boolean hasNext() {
return it.hasNext();
}
@Override
public Q next() {
return it.next().getSecond();
}
@Override
public void remove() {
it.remove();
}
};
}
};
}
}
/*
* Copyright (C) 2015 Daniel H. Huson
* Copyright (C) 2018 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
......
......@@ -19,8 +19,6 @@
*/
package jloda.util;
import java.util.Collection;
/**
* calculates basic statistics
* Daniel Huson, 5.2006
......@@ -38,9 +36,8 @@ public class Statistics {
*
* @param data
*/
public Statistics(Collection<? extends Number> data) {
count = data.size();
if (count > 0) {
public Statistics(Iterable<? extends Number> data) {
int count = 0;
for (Number number : data) {
double value = number.doubleValue();
sum += value;
......@@ -48,7 +45,10 @@ public class Statistics {
min = value;
if (value > max)
max = value;
count++;
}
this.count = count;
if (count > 0) {
mean = sum / count;
if (count > 1) {
double sum2 = 0;
......