Skip to content
Commits on Source (10)
......@@ -7,9 +7,7 @@
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="build-mac-only" location="build-mac-only"/>
<property name="lib" location="lib"/>
<property name="dist" location="dist"/>
<property environment="env"/>
......@@ -19,31 +17,9 @@
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
<mkdir dir="${build-mac-only}"/>
<mkdir dir="${dist}"/>
</target>
<target name="compile-jam" depends="init">
<!-- Compile the java code from ${jamsrc} into ${build} -->
<condition property="isMac">
<os family="mac"/>
</condition>
<javac source="1.5" srcdir="${src}" target="1.5" destdir="${build}" debug="true">
<include name="org/**/*"/>
<exclude name="org/**/maconly/*" unless = "isMac"/>
</javac>
<!-- Utils.class was getting included in jebl.jar -->
<!-- twice and Pack200 was having issues. -->
<!-- Doesn't seem to be the case for me, the class is missing! RM-->
<!--<delete file="${build}/org/virion/jam/mac/Utils.class"/>-->
<copy todir="${build}">
<fileset dir="${src}" includes="org/**/*.png"/>
</copy>
</target>
<target name="clean">
<mkdir dir="${build}"/>
<delete includeEmptyDirs="true">
......@@ -52,41 +28,9 @@
</target>
<target name="compile-jam-mac-only" depends="init">
<!-- Compile the java code from ${jamsrc} into ${build} -->
<condition property="isMac">
<os family="mac"/>
</condition>
<javac source="1.5" srcdir="${src}" target="1.5" destdir="${build-mac-only}">
<include name="org/**/maconly/*"/>
</javac>
</target>
<target name="dist-jam-mac-only" depends="compile-jam-mac-only" description="generate the -mac-only distribution">
<!-- Create the distribution directory -->
<mkdir dir="${dist}"/>
<!-- create the mac-only jar file -->
<jar jarfile="${lib}/jam-mac-only.jar">
<fileset dir="${build-mac-only}" includes="**/mac*/**/*.class,*.properties"/>
</jar>
</target>
<target name="dist-jam" depends="compile-jam" description="generate the JAM distribution">
<!-- Create the distribution directory -->
<mkdir dir="${dist}"/>
<delete file="${dist}/jam.jar"/>
<!-- Put everything in ${build} into the jam.jar file -->
<jar jarfile="${dist}/jam.jar">
<fileset dir="${build}" includes="org/**/*.class,org/**/*.properties,org/**/*.png"/>
<zipgroupfileset dir="${lib}" includes="jam-mac-only.jar"/>
</jar>
</target>
<target name="compile-jebl" depends="init">
<!-- Compile the java code from ${src} into ${build} -->
<javac source="1.5" srcdir="${src}" destdir="${build}" debug="true" target="1.5">
<javac source="1.6" srcdir="${src}" destdir="${build}" debug="true" target="1.6">
<include name="jebl/**/*"/>
</javac>
<copy todir="${build}">
......@@ -101,32 +45,16 @@
<!-- Put everything in ${build} into the jebl-${DSTAMP}.jar file -->
<jar jarfile="${dist}/jebl.jar">
<fileset dir="${build}" includes="jebl/**/*.class,jebl/**/*.properties,jebl/**/*.png"/>
<zipgroupfileset dir="${lib}" includes="**/*.jar"/>
</jar>
</target>
<target name="dist" depends="dist-jebl,dist-jam" description="generate the distribution">
<target name="dist" depends="dist-jebl" description="generate the distribution">
<!-- Create the distribution directory -->
<mkdir dir="${dist}"/>
<!-- Put everything in ${build} into the jebl-${DSTAMP}.jar file -->
<jar jarfile="${dist}/jebl.jar">
<fileset dir="${build}" includes="**/*.class,**/*.properties,**/*.png"/>
<zipgroupfileset dir="${lib}" includes="**/*.jar"/>
</jar>
</target>
<target name="dist-clean" depends="clean,compile-jebl,compile-jam" description="generate the distribution">
<!-- For some reason I don't fully understand, running the standard distribute
script doesn't always work if you have done a previous build on a previous version
of the source code. For some reason, it just doesn't compile some files. This
script seems to work better.-->
<mkdir dir="${dist}"/>
<!-- Put everything in ${build} into the jebl-${DSTAMP}.jar file -->
<jar jarfile="${dist}/jebl.jar">
<fileset dir="${build}" includes="**/*.class,**/*.properties,**/*.png"/>
<zipgroupfileset dir="${lib}" includes="**/*.jar"/>
</jar>
</target>
......
jebl2 (0.1+git20180418.653eb83-1) unstable; urgency=medium
* Add watch file using mode=git
* Remove now unneeded get-orig-source target
* debhelper 11
* Point Vcs fields to salsa.debian.org
* Standards-Version: 4.1.4
* Source / Target version 1.8 (instead of 1.6) since features of 8
are used
-- Andreas Tille <tille@debian.org> Thu, 05 Jul 2018 13:32:40 +0200
jebl2 (0.1+20140614-1) unstable; urgency=medium
* New upstream Git checkout
......
......@@ -3,16 +3,16 @@ Maintainer: Debian Med Packaging Team <debian-med-packaging@lists.alioth.debian.
Uploaders: Andreas Tille <tille@debian.org>
Section: java
Priority: optional
Build-Depends: debhelper (>= 9),
Build-Depends: debhelper (>= 11~),
javahelper
Build-Depends-Indep: default-jdk,
default-jdk-doc,
libtrove-java,
libtrove-java-doc,
ant
Standards-Version: 3.9.6
Vcs-Browser: https://anonscm.debian.org/cgit/debian-med/jebl2.git
Vcs-Git: https://anonscm.debian.org/debian-med/jebl2.git
Standards-Version: 4.1.4
Vcs-Browser: https://salsa.debian.org/med-team/jebl2
Vcs-Git: https://salsa.debian.org/med-team/jebl2.git
Homepage: https://github.com/rambaut/jebl2
Package: libjebl2-java
......
#!/bin/sh -e
COMPRESS=xz
NAME=`dpkg-parsechangelog | awk '/^Source/ { print $2 }'`
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/rambaut/${NAME}.git
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
GZIP="--best --no-name" tar --owner=root --group=root --mode=a+rX -caf "$NAME"_"$VERSION".orig.tar.${COMPRESS} "${TARDIR}"
rm -rf ${TARDIR}
Author: Andreas Tille <tille@debian.org>
Last-Update: Thu, 10 Feb 2011 10:26:38 +0100
Description: Do not build jam
--- a/build.xml
+++ b/build.xml
@@ -7,7 +7,6 @@
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="build" location="build"/>
- <property name="build-mac-only" location="build-mac-only"/>
<property name="lib" location="lib"/>
<property name="dist" location="dist"/>
@@ -19,31 +18,9 @@
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
- <mkdir dir="${build-mac-only}"/>
<mkdir dir="${dist}"/>
</target>
- <target name="compile-jam" depends="init">
- <!-- Compile the java code from ${jamsrc} into ${build} -->
-
- <condition property="isMac">
- <os family="mac"/>
- </condition>
- <javac source="1.5" srcdir="${src}" target="1.5" destdir="${build}" debug="true">
- <include name="org/**/*"/>
- <exclude name="org/**/maconly/*" unless = "isMac"/>
- </javac>
-
- <!-- Utils.class was getting included in jebl.jar -->
- <!-- twice and Pack200 was having issues. -->
- <!-- Doesn't seem to be the case for me, the class is missing! RM-->
- <!--<delete file="${build}/org/virion/jam/mac/Utils.class"/>-->
-
- <copy todir="${build}">
- <fileset dir="${src}" includes="org/**/*.png"/>
- </copy>
- </target>
-
<target name="clean">
<mkdir dir="${build}"/>
<delete includeEmptyDirs="true">
@@ -52,38 +29,6 @@
</target>
- <target name="compile-jam-mac-only" depends="init">
- <!-- Compile the java code from ${jamsrc} into ${build} -->
- <condition property="isMac">
- <os family="mac"/>
- </condition>
- <javac source="1.5" srcdir="${src}" target="1.5" destdir="${build-mac-only}">
- <include name="org/**/maconly/*"/>
- </javac>
- </target>
-
- <target name="dist-jam-mac-only" depends="compile-jam-mac-only" description="generate the -mac-only distribution">
- <!-- Create the distribution directory -->
- <mkdir dir="${dist}"/>
-
- <!-- create the mac-only jar file -->
- <jar jarfile="${lib}/jam-mac-only.jar">
- <fileset dir="${build-mac-only}" includes="**/mac*/**/*.class,*.properties"/>
- </jar>
- </target>
-
-
- <target name="dist-jam" depends="compile-jam" description="generate the JAM distribution">
- <!-- Create the distribution directory -->
- <mkdir dir="${dist}"/>
- <delete file="${dist}/jam.jar"/>
- <!-- Put everything in ${build} into the jam.jar file -->
- <jar jarfile="${dist}/jam.jar">
- <fileset dir="${build}" includes="org/**/*.class,org/**/*.properties,org/**/*.png"/>
- <zipgroupfileset dir="${lib}" includes="jam-mac-only.jar"/>
- </jar>
- </target>
-
<target name="compile-jebl" depends="init">
<!-- Compile the java code from ${src} into ${build} -->
<javac source="1.5" srcdir="${src}" destdir="${build}" debug="true" target="1.5">
@@ -105,7 +50,7 @@
</jar>
</target>
- <target name="dist" depends="dist-jebl,dist-jam" description="generate the distribution">
+ <target name="dist" depends="dist-jebl" description="generate the distribution">
<!-- Create the distribution directory -->
<mkdir dir="${dist}"/>
@@ -116,7 +61,7 @@
</jar>
</target>
- <target name="dist-clean" depends="clean,compile-jebl,compile-jam" description="generate the distribution">
+ <target name="dist-clean" depends="clean,compile-jebl" description="generate the distribution">
<!-- For some reason I don't fully understand, running the standard distribute
script doesn't always work if you have done a previous build on a previous version
of the source code. For some reason, it just doesn't compile some files. This
javadoc.patch
do_not_build_jam.patch
source_8.patch
Description: Source / Target version 1.8 (instead of 1.6) since features of 8 are used
Author: Andreas Tille <tille@debian.org>
Last-Update: Thu, 05 Jul 2018 12:08:56 +0200
--- a/build.xml
+++ b/build.xml
@@ -30,7 +30,7 @@
<target name="compile-jebl" depends="init">
<!-- Compile the java code from ${src} into ${build} -->
- <javac source="1.6" srcdir="${src}" destdir="${build}" debug="true" target="1.6">
+ <javac source="1.8" srcdir="${src}" destdir="${build}" debug="true" target="1.8">
<include name="jebl/**/*"/>
</javac>
<copy todir="${build}">
......@@ -12,6 +12,3 @@ override_dh_auto_clean:
override_dh_auto_build:
dh_auto_build
ant -buildfile javadoc.xml
get-orig-source:
. debian/get-orig-source
# Development of jebl2 moved to Git but upstream keeps the habit
# not to tag releases so we can not create a proper d/watch file
\ No newline at end of file
version=4
opts="mode=git,pretty=0.1+git%cd.%h" \
https://github.com/rambaut/jebl2.git HEAD
# Issue asking for release tags:
# https://github.com/rambaut/jebl2/issues/5
......@@ -1360,7 +1360,8 @@ public class NexusImporter implements AlignmentImporter, SequenceImporter, TreeI
// value=number, value="string", value={item1, item2, item3}
// (label must be quoted if it contains spaces (i.e. "my label"=label)
Pattern pattern = Pattern.compile("(\"[^\"]*\"+|[^,=\\s]+)\\s*(=\\s*(\\{[^=}]*\\}|\"[^\"]*\"+|[^,]+))?");
// Pattern pattern = Pattern.compile("(\"[^\"]*\"+|[^,=\\s]+)\\s*(=\\s*(\\{[^=}]*\\}|\"[^\"]*\"+|[^,]+))?");
Pattern pattern = Pattern.compile("(\"[^\"]*\"+|[^,=\\s]+)\\s*(=\\s*(\\{(\\{[^\\}]+\\},?)+\\}|\\{[^\\}]+\\}|\"[^\"]*\"+|[^,]+))?");
Matcher matcher = pattern.matcher(meta);
while (matcher.find()) {
......@@ -1397,9 +1398,23 @@ public class NexusImporter implements AlignmentImporter, SequenceImporter, TreeI
value = value.trim();
if (value.startsWith("{")) {
value = value.substring(1, value.length() - 1);
String[] elements;
if (value.startsWith("{")) {
// the value is a list of a list so recursively parse the elements
// and return an array
// need to match },{ but leave the brackets in place
value = value.replaceAll("\\},\\{","}@,@{");
elements = value.split("@,@");
} else {
// the value is a list so recursively parse the elements
// and return an array
String[] elements = value.substring(1, value.length() - 1).split(",");
elements = value.split(",");
}
Object[] values = new Object[elements.length];
for (int i = 0; i < elements.length; i++) {
values[i] = parseValue(elements[i]);
......
......@@ -71,7 +71,7 @@ public final class AminoAcids {
public static final AminoAcidState Z_STATE = new AminoAcidState("Glutamine or glutamic acid", "Glx", "Z", 23, new AminoAcidState[]{E_STATE, Q_STATE});
public static final AminoAcidState J_STATE = new AminoAcidState("Leucine or Isoleucine", "Xle", "J", 24, new AminoAcidState[]{I_STATE, L_STATE});
public static final AminoAcidState X_STATE = new AminoAcidState("Unknown amino acid", "Xaa", "X", 25, CANONICAL_STATES);
public static final AminoAcidState UNKNOWN_STATE = new AminoAcidState("Unknown amino acid", "Xaa", "?", 26, CANONICAL_STATES);
public static final AminoAcidState UNKNOWN_STATE = new AminoAcidState("Unknown amino acid", "Xaa", "X", 26, CANONICAL_STATES);
public static final AminoAcidState STOP_STATE = new AminoAcidState("Stop codon", " * ","*", 27);
public static final AminoAcidState GAP_STATE = new AminoAcidState("Gap", " - ", "-", 28, CANONICAL_STATES); // This really shouldn't include the canonical states, but I'm scared changing it may break stuff.
......
......@@ -11,6 +11,11 @@ package jebl.evolution.sequences;
import jebl.evolution.taxa.Taxon;
import jebl.util.Attributable;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
/**
* A biomolecular sequence.
*
......@@ -56,4 +61,61 @@ public interface Sequence extends Attributable, Comparable {
* @return the length
*/
int getLength();
/**
* Append two sequences together to create a new sequence object. New sequence has the taxon of
* the first sequence.
* @param sequence1
* @param sequence2
* @return
*/
public static Sequence appendSequences(Sequence sequence1, Sequence sequence2) {
if (sequence1.getSequenceType() != sequence2.getSequenceType()) {
throw new IllegalArgumentException("sequences to be appended not of the same type");
}
State[] states = new State[sequence1.getLength() + sequence2.getLength()];
System.arraycopy(sequence1.getStates(), 0, states, 0, sequence1.getLength());
System.arraycopy(sequence2.getStates(), 0, states, sequence1.getLength(), sequence2.getLength());
return new BasicSequence(sequence1.getSequenceType(), sequence1.getTaxon(), states);
}
/**
* Returns a sub-sequence for states from, to (inclusive).
* @param sequence
* @param from
* @param to
* @return
*/
public static Sequence getSubSequence(Sequence sequence, int from, int to) {
if (from > to) {
throw new IllegalArgumentException("subsequence from is greater than to");
}
if (from >= sequence.getLength() || to >= sequence.getLength()) {
throw new IllegalArgumentException("subsequence range out of bounds");
}
State[] states = new State[to - from + 1];
System.arraycopy(sequence.getStates(), from, states, 0, states.length);
return new BasicSequence(sequence.getSequenceType(), sequence.getTaxon(), states);
}
public static Sequence trimSequence(Sequence sequence, State[] trimStates) {
Set<State> trimSet = new HashSet<>(Arrays.asList(trimStates));
State[] sourceStates = sequence.getStates();
int i = 0;
while (i < sourceStates.length && trimSet.contains(sourceStates[i])) {
i++;
}
if (i == sourceStates.length) {
return new BasicSequence(sequence.getSequenceType(), sequence.getTaxon(), new State[] {} );
}
Sequence sequence1 = getSubSequence(sequence, i, sourceStates.length - 1);
sourceStates = sequence1.getStates();
i = sourceStates.length - 1;
while (i > 0 && trimSet.contains(sourceStates[i])) {
i--;
}
return getSubSequence(sequence1, 0, i);
}
}
package jebl.evolution.sequences;
/**
* @author rambaut
* Date: Jul 27, 2005
* Time: 12:48:31 AM
* @author Andrew Rambaut
*/
public class TranslatedSequence extends FilteredSequence {
/**
* Create a TranslatedSequence from a source codon or nucleotide sequence
* @param source
* @param geneticCode
*/
public TranslatedSequence(Sequence source, GeneticCode geneticCode) {
this(source, geneticCode, 1);
}
/**
* Create a TranslatedSequence from a source codon or nucleotide sequence
* @param source
* @param geneticCode
* @param frame indexed from 1
*/
public TranslatedSequence(Sequence source, GeneticCode geneticCode, int frame) {
super(source);
this.geneticCode = geneticCode;
this.frame = frame;
}
protected State[] filterSequence(Sequence source) {
return jebl.evolution.sequences.Utils.translate(source.getStates(), geneticCode);
return jebl.evolution.sequences.Utils.translate(source.getStates(), geneticCode, frame);
}
/**
......@@ -25,5 +39,6 @@ public class TranslatedSequence extends FilteredSequence {
}
private final GeneticCode geneticCode;
private final int frame;
}
......@@ -379,6 +379,28 @@ public class Utils {
return result;
}
/**
* Counts the number of stop codons in an amino acid sequence
* @param sequence the sequence string to count stop codons
* @return the number of stop codons
*/
public static int getStopCodonCount(final Sequence sequence) {
if (sequence.getSequenceType() != SequenceType.AMINO_ACID) {
throw new IllegalArgumentException("Sequence should be an amino acid sequence");
}
int count = 0;
for (State state : sequence.getStates()) {
if (((AminoAcidState)state).isStop()) {
count ++;
}
}
return count;
}
/**
* Produce a clean sequence filtered of spaces and digits.
* @param seq the sequence
......
......@@ -54,6 +54,12 @@ final public class RootedSubtree implements RootedTree {
}
if (children.size() >= 2) {
newNode = createInternalNode(children);
for( Map.Entry<String, Object> e : node.getAttributeMap().entrySet() ) {
newNode.setAttribute(e.getKey(), e.getValue());
}
setHeight(newNode, tree.getHeight(node));
} else if (children.size() == 1) {
newNode = children.get(0);
......@@ -63,17 +69,6 @@ final public class RootedSubtree implements RootedTree {
}
}
if (newNode != null) {
// final Map<String, Object> map = node.getAttributeMap();
// if( ! map.isEmpty() ) {
for( Map.Entry<String, Object> e : node.getAttributeMap().entrySet() ) {
newNode.setAttribute(e.getKey(), e.getValue());
}
// }
setHeight(newNode, tree.getHeight(node));
}
return newNode;
}
......