Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix seppJsonMerger.jar #138

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
1f724c7
extend PPlacerJSONMerger.java program such that it can automaically h…
sjanssen2 Nov 24, 2024
bf6c078
execute a tiny functional test, i.e. generate actual treefile and com…
sjanssen2 Nov 24, 2024
287052b
debug
sjanssen2 Nov 24, 2024
7421869
force log printing
sjanssen2 Nov 24, 2024
1c3fc85
add shell
sjanssen2 Nov 24, 2024
8c02040
copy config file into correct location
sjanssen2 Nov 24, 2024
872259c
reactivate other tests
sjanssen2 Nov 24, 2024
72d4e49
create archive of functional test run for local debugging
sjanssen2 Nov 25, 2024
fea3e4a
append python version to avoid archive naming conflict
sjanssen2 Nov 25, 2024
4c56612
Merge branch 'add_functest' of github.com:jlab/sepp into fix_merger
sjanssen2 Nov 25, 2024
450693c
document how I used docker to compile the seppJsonMerger.jar file
sjanssen2 Nov 25, 2024
9e7129f
add .coveragerc back in
sjanssen2 Nov 25, 2024
4839b43
remove older version of Dockerfile
sjanssen2 Nov 25, 2024
9055109
align whitespaces
sjanssen2 Nov 25, 2024
8a0b447
latest compile resul
sjanssen2 Nov 25, 2024
d021c94
be more verbose
sjanssen2 Nov 25, 2024
93c1bf4
move parameter to the end
sjanssen2 Nov 25, 2024
864abfb
add pplacer alpha 17 test
sjanssen2 Nov 25, 2024
2045ff3
gunzip -> unzip
sjanssen2 Nov 25, 2024
21ca11f
only delete in home dir
sjanssen2 Nov 25, 2024
1e075ea
remove pplacer and THEN get new binary
sjanssen2 Nov 25, 2024
604a3c6
fix path
sjanssen2 Nov 25, 2024
83097d9
some minor rounding differences will occure
sjanssen2 Nov 25, 2024
1fe2aab
also create artifact for pplacer test
sjanssen2 Nov 25, 2024
96d7438
also replace guppy binary with 1.1.17
sjanssen2 Nov 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/sepp_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,43 @@ jobs:
run: |
conda list
nosetests -w test/unittest --with-doctest --with-coverage
- name: functional test
shell: bash -el {0}
run: |
mkdir -p sepp-package/sepp/.sepp/ functional_tests/
cp ./.sepp/main.config sepp-package/sepp/.sepp/main.config
cd functional_tests
../sepp-package/run-sepp.sh ../test/unittest/data/q2-fragment-insertion/input_fragments.fasta funcTest -x 2 -a ../test/unittest/data/q2-fragment-insertion/reference_alignment_tiny.fasta -t ../test/unittest/data/q2-fragment-insertion/reference_phylogeny_tiny.nwk -r ../test/unittest/data/q2-fragment-insertion/RAxML_info-reference-gg-raxml-bl.info -b 1
diff funcTest_placement.tog.relabelled.tre ../test/functionaltest/funcTest_q2-tiny_placement.tog.relabelled.tre
cd ..
- name: Archive functional test results for local debugging
uses: actions/upload-artifact@v4
with:
name: SEPP_functional_tests_${{ matrix.python-version }}
path: functional_tests
- name: functional test pplacer 1.1.alpha17
shell: bash -el {0}
run: |
rm -rf functional_tests/
mkdir -p sepp-package/sepp/.sepp/ functional_tests/
cp ./.sepp/main.config sepp-package/sepp/.sepp/main.config
cd functional_tests
rm -v `find ~/ -type f -name pplacer`
rm -v `find ~/ -type f -name guppy`
wget "https://github.com/matsen/pplacer/releases/download/v1.1.alpha17/pplacer-Linux-v1.1.alpha17.zip"
unzip pplacer-Linux-v1.1.alpha17.zip
mv -v pplacer-Linux-v1.1.alpha17/pplacer ../.sepp/bundled-v4.5.5/pplacer
mv -v pplacer-Linux-v1.1.alpha17/guppy ../.sepp/bundled-v4.5.5/guppy
rm -rf pplacer-Linux-v1.1.alpha17*
../sepp-package/run-sepp.sh ../test/unittest/data/q2-fragment-insertion/input_fragments.fasta funcTest -x 2 -a ../test/unittest/data/q2-fragment-insertion/reference_alignment_tiny.fasta -t ../test/unittest/data/q2-fragment-insertion/reference_phylogeny_tiny.nwk -r ../test/unittest/data/q2-fragment-insertion/RAxML_info-reference-gg-raxml-bl.info -b 1
cat ../test/functionaltest/funcTest_q2-tiny_placement.tog.relabelled.tre | sed "s/((163164:0.0792419/((163164:0.079242/" | sed "s/1024637:0.0283109)'nodeid_321248':0.0224664/1024637:0.0283109)'nodeid_321248':0.0224708/" | sed "s/testseqe:0.0964783):0.195875)'nodeid_320633':0.0493007/testseqe:0.096466):0.195871)'nodeid_320633':0.0493007/" | sed "s/(272555:0.0600304/(272555:0.0600251/" | sed "s/testseqg:0.0321409):0.0609292)'nodeid_335817':0.281379)'nodeid_335169':0.00443657/testseqg:0.032141):0.0609345)'nodeid_335817':0.281379)'nodeid_335169':0.00443657/" > funcTest_q2-tiny_placement.tog.relabelled.tre
diff funcTest_placement.tog.relabelled.tre funcTest_q2-tiny_placement.tog.relabelled.tre
cd ..
- name: Archive functional test results (pplacer 1.1.alpha17) for local debugging
uses: actions/upload-artifact@v4
with:
name: SEPP_functional_tests_${{ matrix.python-version }}_pplacer1.1.alpha17
path: functional_tests
- name: convert coverage
shell: bash -el {0}
run: |
Expand Down
86 changes: 86 additions & 0 deletions test/functionaltest/funcTest_q2-tiny_placement.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions tools/merge/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM ubuntu:20.04

RUN apt-get -y update
RUN apt-get -y install wget git

# you need to register an account with Oracle to legally obtain this file from https://www.oracle.com/java/technologies/javase-java-archive-javase6-downloads.html
COPY jdk-6u45-linux-x64.bin /jdk-6u45-linux-x64.bin
RUN bash /jdk-6u45-linux-x64.bin

RUN git clone https://github.com/smirarab/sepp.git

# download and "install" ant in version 1.7.1
RUN wget https://archive.apache.org/dist/ant/binaries/apache-ant-1.7.1-bin.tar.gz
RUN tar xzvf apache-ant-1.7.1-bin.tar.gz

# ensure javac and ant can be found
ENV PATH=/apache-ant-1.7.1/bin:/jdk1.6.0_45/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

# automatically compile and package seppJsonMerger.jar
CMD cd /sepp/tools/merge && ant compile && ant jar
11 changes: 11 additions & 0 deletions tools/merge/howToCompileJar.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
The seppJsonMerger.jar uses a quite old JDK (version 1.6.0_45 from Sun Microsystems). Compiling with current JDKs is not possible without major updates to the code base, also for dependencies. I therefore composed a docker file, based on Ubuntu 20.04 that installs this specific JDK with according "ant" (version 1.7.1) to go back in time and be able to compile slight updates of the tools/merge/src/phylolab/taxonamic/PPlacerJSONMerger.java sources.

Unfortunately, the required JDK is not freely available. You need to register to Oracle to be able to download the file
jdk-6u45-linux-x64.bin from https://www.oracle.com/java/technologies/javase-java-archive-javase6-downloads.html

Once you have this file, place it into the sub-directory tools/merge/ and follow the below instructions:

- change into directory tools/merge: `cd tools/merge/`
- build docker container: `sudo docker build . -f Dockerfile -t sepp`
- run the docker container (it will automatically compile and package the seppJsonMerger.jar file): `sudo docker run -i -t sepp`
- Replace the above docker run command, in order to pull the compile result out of the container. By "mounting" your working directory to it, it will replace the sepp repository of the container with the one in your working directory, i.e. the seppJsonMerger.jar will be stored in your host system: `sudo docker run -v `pwd`/../../:/sepp -i -t sepp`
Binary file modified tools/merge/seppJsonMerger.jar
Binary file not shown.
18 changes: 10 additions & 8 deletions tools/merge/src/phylolab/taxonamic/PPlacerJSONMerger.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,23 +162,25 @@ private void relabelJson(String baseTree, JSONObject json,
HashMap<String, String> labelMap = mapTrees(jsonTree, baseTree);

JSONArray placements = json.getJSONArray("placements");
// Iterate through "field descriptions" to learn which column is holding
// what type of information about placements.
HashMap<String, Integer> fieldPositions = new HashMap<String, Integer>();
JSONArray fields = json.getJSONArray("fields");
int locEdgeNum=0;
while (! fields.getString(locEdgeNum).equals("edge_num")) {
locEdgeNum++;
}
for (int i = 0; i < fields.size(); i++) {
fieldPositions.put(fields.getString(i), i);
}

for (Iterator<JSONObject> iterator = placements.iterator(); iterator.hasNext();) {
JSONObject placement = iterator.next();
JSONArray p = placement.getJSONArray("p");
for (Iterator<JSONArray> itp = p.iterator(); itp.hasNext();) {
JSONArray pr = itp.next();
String newLab = (String) labelMap.get(pr.getString(locEdgeNum));
pr.set(locEdgeNum, new Integer(newLab));
String newLab = (String) labelMap.get(pr.getString(fieldPositions.get("edge_num")));
pr.set(fieldPositions.get("edge_num"), new Integer(newLab));

if (pr.getDouble(3) > ((Double) mainEdgeLen.get(newLab))
if (pr.getDouble(fieldPositions.get("distal_length")) > ((Double) mainEdgeLen.get(newLab))
.doubleValue())
pr.set(3, Double.valueOf(((Double) mainEdgeLen.get(newLab))
pr.set(fieldPositions.get("distal_length"), Double.valueOf(((Double) mainEdgeLen.get(newLab))
.doubleValue() * 0.99D));
}
}
Expand Down
Loading