[med-svn] [Git][med-team/jebl2][master] 13 commits: New upstream version 0.1+git20190308
Pierre Gruet
gitlab at salsa.debian.org
Fri Apr 24 16:45:51 BST 2020
Pierre Gruet pushed to branch master at Debian Med / jebl2
Commits:
d7039deb by Pierre Gruet at 2020-04-23T21:57:42+02:00
New upstream version 0.1+git20190308
- - - - -
63a88174 by Pierre Gruet at 2020-04-23T21:57:45+02:00
Update upstream source from tag 'upstream/0.1+git20190308'
Update to upstream version '0.1+git20190308'
with Debian dir 3b527a1b342fb0c9084f001196e88a501c9da9bc
- - - - -
cdff9748 by Pierre Gruet at 2020-04-23T22:05:21+02:00
Deleting now useless patch source_8.patch
- - - - -
2f62eb5c by Pierre Gruet at 2020-04-23T22:28:43+02:00
Bumping Standard version to 4.5.0 (adding Rules-Requires-Root field)
- - - - -
6d5acb2c by Pierre Gruet at 2020-04-23T22:30:34+02:00
Marking the binary packages Multi-Arch: foreign
- - - - -
37a9706f by Pierre Gruet at 2020-04-23T22:33:33+02:00
Using secure URL in debian/copyright
- - - - -
05fab22d by Pierre Gruet at 2020-04-23T22:35:01+02:00
Dropping debian/compat file, using debhelper-compat
- - - - -
646822ba by Pierre Gruet at 2020-04-23T22:37:12+02:00
Trimming trailing whitespaces
- - - - -
3b5303a4 by Pierre Gruet at 2020-04-23T22:38:13+02:00
Updating debian/changelog
- - - - -
ebdab946 by Pierre Gruet at 2020-04-23T22:48:59+02:00
Adding salsa-ci.yml file
- - - - -
dcff12fe by Pierre Gruet at 2020-04-24T09:14:57+02:00
New uploader
- - - - -
bf68b523 by Pierre Gruet at 2020-04-24T14:00:06+02:00
Correcting path in debian/libjebl2-java-doc.javadoc
- - - - -
5009464a by Pierre Gruet at 2020-04-24T17:39:21+02:00
Adding Lintian overrides and documenting them
* zip files are wrongly detected as being broken
* some javascript contents is too hard to remove, see discussion on Java
mailing list (link in .lintian-overrides file)
- - - - -
20 changed files:
- build.xml
- debian/changelog
- − debian/compat
- debian/control
- debian/copyright
- debian/libjebl2-java-doc.javadoc
- + debian/libjebl2-java-doc.lintian-overrides
- debian/patches/series
- − debian/patches/source_8.patch
- + debian/salsa-ci.yml
- src/jebl/evolution/io/NexusExporter.java
- src/jebl/evolution/sequences/AminoAcidState.java
- src/jebl/evolution/sequences/BasicSequence.java
- src/jebl/evolution/sequences/CodonState.java
- src/jebl/evolution/sequences/Codons.java
- src/jebl/evolution/sequences/NucleotideState.java
- src/jebl/evolution/sequences/Nucleotides.java
- src/jebl/evolution/sequences/Sequence.java
- src/jebl/evolution/sequences/State.java
- src/jebl/evolution/sequences/Utils.java
Changes:
=====================================
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}">
=====================================
debian/changelog
=====================================
@@ -1,3 +1,18 @@
+jebl2 (0.1+git20190308-1) UNRELEASED; urgency=medium
+
+ * New upstream version 0.1+git20190308
+ * Deleting now useless patch source_8.patch
+ * Bumping Standard version to 4.5.0 (adding Rules-Requires-Root field)
+ * Marking the binary packages Multi-Arch: foreign
+ * Using secure URL in debian/copyright
+ * Dropping debian/compat file, using debhelper-compat
+ * Trimming trailing whitespaces
+ * Adding salsa-ci.yml file
+ * Correcting path in debian/libjebl2-java-doc.javadoc
+ * Adding and documenting lintian overrides.
+
+ -- Pierre Gruet <pgtdebian at free.fr> Thu, 23 Apr 2020 22:37:35 +0200
+
jebl2 (0.1+git20180418.653eb83-1) unstable; urgency=medium
* Add watch file using mode=git
=====================================
debian/compat deleted
=====================================
@@ -1 +0,0 @@
-11
=====================================
debian/control
=====================================
@@ -1,22 +1,25 @@
Source: jebl2
Maintainer: Debian Med Packaging Team <debian-med-packaging at lists.alioth.debian.org>
-Uploaders: Andreas Tille <tille at debian.org>
+Uploaders: Andreas Tille <tille at debian.org>,
+ Pierre Gruet <pgtdebian at free.fr>
Section: java
Priority: optional
-Build-Depends: debhelper (>= 11~),
+Build-Depends: debhelper-compat (= 12),
javahelper
Build-Depends-Indep: default-jdk,
default-jdk-doc,
libtrove-java,
libtrove-java-doc,
ant
-Standards-Version: 4.1.4
+Standards-Version: 4.5.0
+Rules-Requires-Root: no
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
Architecture: all
+Multi-Arch: foreign
Depends: ${java:Depends},
${misc:Depends}
Recommends: ${java:Recommends}
@@ -31,16 +34,17 @@ Description: Java Evolutionary Biology Library
Package: libjebl2-java-doc
Architecture: all
+Multi-Arch: foreign
Section: doc
Depends: ${java:Depends},
${misc:Depends}
Recommends: ${java:Recommends}
Description: Java Evolutionary Biology Library (documentation)
- A Java library for evolutionary biology and bioinformatics, including
+ A Java library for evolutionary biology and bioinformatics, including
objects representing biomolecular sequences, multiple sequence
alignments and phylogenetic trees.
.
- This is a branch of the original JEBL on
+ This is a branch of the original JEBL on
http://sourceforge.net/projects/jebl/ to develop a new API and class
library.
.
=====================================
debian/copyright
=====================================
@@ -1,4 +1,4 @@
-Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: JEBL2
Upstream-Contact: Andrew Rambaut <a.rambaut at ed.ac.uk>
Source: https://github.com/rambaut/jebl2
=====================================
debian/libjebl2-java-doc.javadoc
=====================================
@@ -1 +1 @@
-doc /usr/share/doc/libjebl2-java/api
+doc usr/share/doc/libjebl2-java/api
=====================================
debian/libjebl2-java-doc.lintian-overrides
=====================================
@@ -0,0 +1,9 @@
+# It would be too complicated to remove the javascript that is included in
+# javadocs, see the discussion on Debian Java mailing list starting at
+# https://lists.debian.org/debian-java/2018/06/msg00020.html.
+embedded-javascript-library usr/share/doc/libjebl2-java/api/*/jquery*.*s *
+
+#Lintian indicates that some zip files generated by javadoc are not
+# zip-compressed. Yet they are, and they can be perfectly unzipped with unzip
+# in order to get the .json file each one contains.
+broken-zip usr/share/doc/libjebl2-java/api/*.zip
=====================================
debian/patches/series
=====================================
@@ -1,2 +1 @@
javadoc.patch
-source_8.patch
=====================================
debian/patches/source_8.patch deleted
=====================================
@@ -1,15 +0,0 @@
-Description: Source / Target version 1.8 (instead of 1.6) since features of 8 are used
-Author: Andreas Tille <tille at 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}">
=====================================
debian/salsa-ci.yml
=====================================
@@ -0,0 +1,4 @@
+---
+include:
+ - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml
+ - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml
=====================================
src/jebl/evolution/io/NexusExporter.java
=====================================
@@ -317,6 +317,15 @@ public class NexusExporter implements AlignmentExporter, SequenceExporter, TreeE
* @param builder
*/
private void appendTree(RootedTree tree, Node node, StringBuilder builder) {
+
+ Node p = tree.getParent(node);
+ while (p != null) {
+ if (p == node) {
+ System.err.println("Circular reference in tree structure");
+ }
+ p = tree.getParent(p);
+ }
+
if (tree.isExternal(node)) {
appendTaxonName(tree.getTaxon(node), builder);
=====================================
src/jebl/evolution/sequences/AminoAcidState.java
=====================================
@@ -51,4 +51,6 @@ public final class AminoAcidState extends State {
public boolean isStop() {
return this == AminoAcids.STOP_STATE;
}
+
+ public SequenceType getType() { return SequenceType.AMINO_ACID; }
}
=====================================
src/jebl/evolution/sequences/BasicSequence.java
=====================================
@@ -111,7 +111,11 @@ public class BasicSequence implements Sequence {
* @return an array of state objects.
*/
public State[] getStates() {
- return sequenceType.toStateArray(getStateIndices());
+ if (sequenceType == SequenceType.CODON) {
+ return sequenceType.toStateArray(getString());
+ } else {
+ return sequenceType.toStateArray(getStateIndices());
+ }
}
public byte[] getStateIndices() {
=====================================
src/jebl/evolution/sequences/CodonState.java
=====================================
@@ -29,4 +29,6 @@ public final class CodonState extends State {
public boolean isGap() {
return this == Codons.GAP_STATE;
}
+
+ public SequenceType getType() { return SequenceType.CODON; }
}
=====================================
src/jebl/evolution/sequences/Codons.java
=====================================
@@ -89,7 +89,17 @@ public final class Codons {
public static boolean isGap(CodonState state) { return state == GAP_STATE; }
- public static NucleotideState[] toNucleotides(CodonState state) {
+ public static NucleotideState[] toNucleotides(State[] states) {
+ NucleotideState[] nucs = new NucleotideState[states.length * 3];
+ int i = 0;
+ for (State state : states) {
+ System.arraycopy(toNucleotides((CodonState)state), 0, nucs, i, 3);
+ i += 3;
+ }
+ return nucs;
+ }
+
+ public static NucleotideState[] toNucleotides(CodonState state) {
NucleotideState[] nucs = new NucleotideState[3];
String code = state.getCode();
nucs[0] = Nucleotides.getState(code.charAt(0));
=====================================
src/jebl/evolution/sequences/NucleotideState.java
=====================================
@@ -35,6 +35,6 @@ public final class NucleotideState extends State {
return this == Nucleotides.GAP_STATE;
}
-
+ public SequenceType getType() { return SequenceType.NUCLEOTIDE; }
}
=====================================
src/jebl/evolution/sequences/Nucleotides.java
=====================================
@@ -259,6 +259,39 @@ public final class Nucleotides {
return seq;
}
+ /**
+ * Convert an array of nucleotide states into an array of codon states
+ * @param states the nucleotide states
+ * @param readingFrame the reading frame (1 to 3)
+ * @return the codon states
+ */
+ public static CodonState[] toCodons(final State[] states, int readingFrame) {
+ if (states == null) throw new NullPointerException("States array is null");
+ if (states.length == 0) return new CodonState[0];
+
+ if (readingFrame < 1 || readingFrame > 3) {
+ throw new IllegalArgumentException("Reading frame should be between 1 and 3");
+ }
+
+ if (states[0] instanceof NucleotideState) {
+ int offset = readingFrame - 1;
+ int length = states.length - offset;
+
+ if (length == 0) return new CodonState[0];
+
+ CodonState[] conversion = new CodonState[length / 3];
+ for (int i = 0; i < conversion.length; i++) {
+ conversion[i] = Codons.getState(
+ (NucleotideState)states[i * 3 + offset],
+ (NucleotideState)states[(i * 3) + offset + 1],
+ (NucleotideState)states[(i * 3) + offset + 2]);
+ }
+ return conversion;
+ } else {
+ throw new IllegalArgumentException("Given states are not nucleotides so cannot be converted");
+ }
+ }
+
private static final NucleotideState[] statesByCode;
static {
=====================================
src/jebl/evolution/sequences/Sequence.java
=====================================
@@ -11,10 +11,7 @@ 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;
+import java.util.*;
/**
* A biomolecular sequence.
@@ -69,7 +66,7 @@ public interface Sequence extends Attributable, Comparable {
* @param sequence2
* @return
*/
- public static Sequence appendSequences(Sequence sequence1, Sequence sequence2) {
+ static Sequence appendSequences(Sequence sequence1, Sequence sequence2) {
if (sequence1.getSequenceType() != sequence2.getSequenceType()) {
throw new IllegalArgumentException("sequences to be appended not of the same type");
}
@@ -86,7 +83,7 @@ public interface Sequence extends Attributable, Comparable {
* @param to
* @return
*/
- public static Sequence getSubSequence(Sequence sequence, int from, int to) {
+ static Sequence getSubSequence(Sequence sequence, int from, int to) {
if (from > to) {
throw new IllegalArgumentException("subsequence from is greater than to");
}
@@ -98,24 +95,74 @@ public interface Sequence extends Attributable, Comparable {
return new BasicSequence(sequence.getSequenceType(), sequence.getTaxon(), states);
}
- public static Sequence trimSequence(Sequence sequence, State[] trimStates) {
+ 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[] {} );
+ if (i < sourceStates.length) {
+ 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);
+ } else {
+ return new BasicSequence(sequence.getSequenceType(), sequence.getTaxon(), new State[] {});
}
+ }
+
+ /**
+ * Strips a sequence of gaps
+ * @param sequence the sequence
+ * @return the stripped sequence
+ */
+ static Sequence stripGaps(final Sequence sequence) {
+ return new BasicSequence(sequence.getSequenceType(), sequence.getTaxon(), jebl.evolution.sequences.Utils.stripGaps(sequence.getStates()));
+ }
+
+
+ /**
+ * Strips a sequence of any states given
+ * @param sequence the sequence
+ * @param stripStates the states to strip
+ * @return an array of states
+ */
+ static Sequence stripStates(final Sequence sequence, final List<State> stripStates) {
+ return new BasicSequence(sequence.getSequenceType(), sequence.getTaxon(), jebl.evolution.sequences.Utils.stripStates(sequence.getStates(), stripStates));
+ }
- Sequence sequence1 = getSubSequence(sequence, i, sourceStates.length - 1);
- sourceStates = sequence1.getStates();
- i = sourceStates.length - 1;
- while (i > 0 && trimSet.contains(sourceStates[i])) {
- i--;
+ /**
+ * Searchers and replaces a sequence of any states given
+ * @param sequence the sequence
+ * @param searchStates the states to search for
+ * @return an array of states
+ */
+ static Sequence replaceStates(final Sequence sequence, final List<State> searchStates, State replaceState) {
+ return new BasicSequence(sequence.getSequenceType(), sequence.getTaxon(),
+ jebl.evolution.sequences.Utils.replaceStates(sequence.getStates(), searchStates, replaceState));
+ }
+
+
+ /**
+ * Counts the number of occurances of a state
+ * @param sequence the sequence string to count
+ * @param state the state
+ * @return the number of occurances
+ */
+ static int getStateCount(final Sequence sequence, final State state) {
+
+ int count = 0;
+ for (State s : sequence.getStates()) {
+ if (s.equals(state)) {
+ count ++;
+ }
}
- return getSubSequence(sequence1, 0, i);
+ return count;
}
+
}
=====================================
src/jebl/evolution/sequences/State.java
=====================================
@@ -89,7 +89,9 @@ public abstract class State implements Comparable {
public abstract boolean isGap();
- private String stateCode;
+ public abstract SequenceType getType();
+
+ private String stateCode;
private String name;
private Set<State> ambiguities;
private int index;
=====================================
src/jebl/evolution/sequences/Utils.java
=====================================
@@ -10,6 +10,10 @@ package jebl.evolution.sequences;
import jebl.evolution.taxa.Taxon;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
/**
* @author Andrew Rambaut
* @author Alexei Drummond
@@ -215,24 +219,53 @@ public class Utils {
return translateCharSequence(nucleotideSequence, geneticCode);
}
+ /**
+ * Strips a sequence of gaps
+ * @param sequence the sequence
+ * @return the stripped sequence
+ */
public static State[] stripGaps(final State[] sequence) {
- int count = 0;
+ if (sequence.length == 0) {
+ return new State[] {};
+ }
+
+ return stripStates(sequence, Collections.singletonList(sequence[0].getType().getGapState()));
+ }
+
+ /**
+ * Strips a sequence of any states given
+ * @param sequence the sequence
+ * @param stripStates the states to strip
+ * @return an array of states
+ */
+ public static State[] stripStates(final State[] sequence, final List<State> stripStates) {
+ List<State> stripped = new ArrayList<State>();
for (State state : sequence) {
- if (!state.isGap()) {
- count++;
+ if (!stripStates.contains(state)) {
+ stripped.add(state);
}
}
- State[] stripped = new State[count];
- int index = 0;
+ return stripped.toArray(new State[0]);
+ }
+
+ /**
+ * Searchers and replaces a sequence of any states given
+ * @param sequence the sequence
+ * @param searchStates the states to search for
+ * @return an array of states
+ */
+ public static State[] replaceStates(final State[] sequence, final List<State> searchStates, State replaceState) {
+ List<State> stripped = new ArrayList<State>();
for (State state : sequence) {
- if (!state.isGap()) {
- stripped[index] = state;
- index += 1;
+ if (searchStates.contains(state)) {
+ stripped.add(replaceState);
+ } else {
+ stripped.add(state);
}
}
- return stripped;
+ return stripped.toArray(new State[0]);
}
public static State[] reverse(final State[] sequence) {
View it on GitLab: https://salsa.debian.org/med-team/jebl2/-/compare/f1611fe5fbf19ca25334d74779f78131c07bdca2...5009464a62b1a324197067590bdb3dbc4addc413
--
View it on GitLab: https://salsa.debian.org/med-team/jebl2/-/compare/f1611fe5fbf19ca25334d74779f78131c07bdca2...5009464a62b1a324197067590bdb3dbc4addc413
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20200424/70c81c16/attachment-0001.html>
More information about the debian-med-commit
mailing list