Skip to content
Snippets Groups Projects
Commit 9e4c2a3a authored by Alexis  CRISCUOLO's avatar Alexis CRISCUOLO :black_circle:
Browse files

2.1

parent 6a192234
No related branches found
No related tags found
No related merge requests found
...@@ -2,19 +2,26 @@ ...@@ -2,19 +2,26 @@
[_REQ_](https://research.pasteur.fr/fr/tool/r%CE%B5q-assessing-branch-supports-o%C6%92-a-distance-based-phylogenetic-tree-with-the-rate-o%C6%92-elementary-quartets/) is a command line program written in [Java](https://docs.oracle.com/javase/8/docs/technotes/guides/language/index.html) that estimates the rate of elementary quartets (REQ) for each internal branch of an unrooted binary phylogenetic tree from a distance matrix, as described by [Guénoche and Garreta (2001)](https://doi.org/10.1007/3-540-45727-5_5). [_REQ_](https://research.pasteur.fr/fr/tool/r%CE%B5q-assessing-branch-supports-o%C6%92-a-distance-based-phylogenetic-tree-with-the-rate-o%C6%92-elementary-quartets/) is a command line program written in [Java](https://docs.oracle.com/javase/8/docs/technotes/guides/language/index.html) that estimates the rate of elementary quartets (REQ) for each internal branch of an unrooted binary phylogenetic tree from a distance matrix, as described by [Guénoche and Garreta (2001)](https://doi.org/10.1007/3-540-45727-5_5).
## Installation
Clone this repository using the following command line:
```bash
git clone https://gitlab.pasteur.fr/GIPhy/REQ.git
```
## Compilation and execution ## Compilation and execution
The source code of _REQ_ is inside the _src_ directory and can be compiled and executed in two different ways.
The source code of _REQ_ is inside the _src_ directory and can be compiled and executed in two different ways.
#### Building an executable jar file #### Building an executable jar file
On computers with [Oracle JDK](http://www.oracle.com/technetwork/java/javase/downloads/index.html) (6 or higher) installed, a Java executable jar file can be created. On computers with [Oracle JDK](http://www.oracle.com/technetwork/java/javase/downloads/index.html) (6 or higher) installed, a Java executable jar file can be created by typing the following command lines inside the _src/_ directory:
In a command-line window, go to the _src_ directory and type:
```bash ```bash
javac REQ.java javac REQ.java
echo Main-Class: REQ > MANIFEST.MF echo Main-Class: REQ > MANIFEST.MF
jar -cmvf MANIFEST.MF REQ.jar REQ.class jar -cmvf MANIFEST.MF REQ.jar REQ.class
rm MANIFEST.MF REQ.class rm MANIFEST.MF REQ.class
``` ```
This will create the executable jar file `REQ.jar` that can be run with the following command line model: This will create the executable jar file `REQ.jar` that can be run with the following command line model:
```bash ```bash
...@@ -23,12 +30,12 @@ java -jar REQ.jar [files] ...@@ -23,12 +30,12 @@ java -jar REQ.jar [files]
#### Building a native executable #### Building a native executable
On computers with [GraalVM](hhttps://www.graalvm.org/downloads/) installed, a native executable can also be built. On computers with [GraalVM](hhttps://www.graalvm.org/downloads/) installed, a native executable can be built.
In a command-line window, go to the _src_ directory, and type: In a command-line window, go to the _src_ directory, and type:
```bash ```bash
javac REQ.java javac REQ.java
native-image REQ REQ native-image REQ REQ
rm REQ.class rm -f REQ.build_artifacts.txt REQ.class
``` ```
This will create the native executable `REQ` that can be launched with the following command line model: This will create the native executable `REQ` that can be launched with the following command line model:
```bash ```bash
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
REQ: assessing branch supports of a distance-based phylogenetic tree with rates of elementary quartets REQ: assessing branch supports of a distance-based phylogenetic tree with rates of elementary quartets
Copyright (C) 2017,2018,2019,2020 Institut Pasteur Copyright (C) 2017-2024 Institut Pasteur
This program is free software: you can redistribute it and/or modify it under the terms of the GNU This program is free software: you can redistribute it and/or modify it under the terms of the GNU
General Public License as published by the Free Software Foundation, either version 3 of the License, or General Public License as published by the Free Software Foundation, either version 3 of the License, or
...@@ -19,15 +19,32 @@ ...@@ -19,15 +19,32 @@
Contact: Contact:
Alexis Criscuolo alexis.criscuolo@pasteur.fr Alexis Criscuolo alexis.criscuolo@pasteur.fr
Genome Informatics & Phylogenetics (GIPhy) giphy.pasteur.fr Genome Informatics & Phylogenetics (GIPhy) giphy.pasteur.fr
Bioinformatics and Biostatistics Hub research.pasteur.fr/team/hub-giphy Centre de Ressources Biologiques de l'Institut Pasteur (CRBIP) research.pasteur.fr/en/b/VTq
USR 3756 IP CNRS research.pasteur.fr/team/bioinformatics-and-biostatistics-hub
Dpt. Biologie Computationnelle research.pasteur.fr/department/computational-biology
Institut Pasteur, Paris, FRANCE research.pasteur.fr Institut Pasteur, Paris, FRANCE research.pasteur.fr
4888888883
48800007 4003 1
4880000007 400001 83 101 100 01 4000009 888888888 101 888888888 08 80 888888888
4000000008 8000001 83 181 10101 01 601 1 181 181 181 08 80 181
40000000008 8000001 803 181 10 101 01 60003 181 181 181 08 80 181
100888880008 800007 60003 181 10 10101 4 109 181 181 181 68 87 181
81 68888 80887 600008 101 10 001 0000007 101 101 101 600009 101
808883 1 887 6000008
8000000003 480000008
600000000083 888000000007 10000000 40 4000009 888888888 10000000 08 80 1000000
60000000008 80000000007 180 39 4000 601 1 181 10 08 80 10 39
6000000008 8000000007 18000007 47 00 60003 181 1000000 08 80 1000007
680000008 800000087 180 40000000 4 109 181 10 68 87 10 06
6888008 8000887 100 47 00 0000007 101 10000000 600009 10 00
688 8887
######################################################################################################## ########################################################################################################
*/ */
/* /*
######################################################################################################## ########################################################################################################
### v2.1 (240328ac)
+ fixed bug when a leaf is not present in the distance matrix
+ no change in the quite obfuscated code style
### v2.0.200528ac ### v2.0.200528ac
+ verify that the input tree is unrooted and fully binary + verify that the input tree is unrooted and fully binary
+ faster running times by minimizing String conversion + faster running times by minimizing String conversion
...@@ -41,7 +58,7 @@ import java.text.*; ...@@ -41,7 +58,7 @@ import java.text.*;
public class REQ { public class REQ {
// constants // constants
final static String VERSION = "v2.0.200528ac"; final static String VERSION = "v2.1 (240328ac)";
final static int MAX = 32760; final static int MAX = 32760;
final static int INF = Integer.MAX_VALUE; final static int INF = Integer.MAX_VALUE;
...@@ -75,7 +92,10 @@ public class REQ { ...@@ -75,7 +92,10 @@ public class REQ {
//### man ############################################################################################################################################################################ //### man ############################################################################################################################################################################
if ( args.length < 3 ) { if ( args.length < 3 ) {
System.out.println(""); System.out.println("");
System.out.println(" REQ " + VERSION); System.out.println(" REQ " + VERSION + " Copyright (C) 2017-2024 Institut Pasteur");
System.out.println("");
System.out.println(" >-< https://research.pasteur.fr/fr/b/_LV");
System.out.println(" >-< https://gitlab.pasteur.fr/GIPhy/REQ");
System.out.println(""); System.out.println("");
System.out.println(" USAGE: REQ <dfile> <tfile> <outfile> [-v]"); System.out.println(" USAGE: REQ <dfile> <tfile> <outfile> [-v]");
System.out.println(""); System.out.println("");
...@@ -124,12 +144,12 @@ public class REQ { ...@@ -124,12 +144,12 @@ public class REQ {
while ( --u >= 0 ) while ( --u >= 0 )
switch ( tr.charAt(u) ) { switch ( tr.charAt(u) ) {
case '(': case '(':
if ( tr.charAt(++u) != '(' ) { tr = tr.replace(u, v, String.valueOf(j=lbl.indexOf(tr.substring(u, v)))); if ( tr.charAt(++u) != '(' ) { tr = tr.replace(u, v, String.valueOf(j=lbl.indexOf(line=tr.substring(u, v))));
if ( j != -1 ) tip[--i] = (short) j; else { System.err.println(tr.substring(u, v) + " is not inside distance matrix"); System.exit(1); } } if ( j != -1 ) tip[--i] = (short) j; else { System.err.println(line + " does not belong to the distance matrix labels"); System.exit(1); } }
--u; break; --u; break;
case ',': case ',':
if ( tr.charAt(++u) != '(' ) { tr = tr.replace(u, v, String.valueOf(j=lbl.indexOf(tr.substring(u, v)))); if ( tr.charAt(++u) != '(' ) { tr = tr.replace(u, v, String.valueOf(j=lbl.indexOf(line=tr.substring(u, v))));
if ( j != -1 ) tip[--i] = (short) j; else { System.err.println(tr.substring(u, v) + " is not inside distance matrix"); System.exit(1); } } if ( j != -1 ) tip[--i] = (short) j; else { System.err.println(line + " does not belong to the distance matrix labels"); System.exit(1); } }
v = --u; break; v = --u; break;
case ')': ++d; v = u; break; case ')': ++d; v = u; break;
} }
...@@ -143,8 +163,8 @@ public class REQ { ...@@ -143,8 +163,8 @@ public class REQ {
//# sup last //# sup last
tr = tr.insert(0, '('); sup = apc(tr, tr.lastIndexOf(")")); tr = tr.insert(sup, ')'); //# NOTE: closing parenthesis at index 'sup' should not be considered for REQ calculations tr = tr.insert(0, '('); sup = apc(tr, tr.lastIndexOf(")")); tr = tr.insert(sup, ')'); //# NOTE: closing parenthesis at index 'sup' should not be considered for REQ calculations
last = tr.lastIndexOf(")"); last = tr.lastIndexOf(")");
//# NOTE: totip[x] = id in tip[] of the taxon at or right after position x in tr //# tr = "( ( 1 , 3 ) , ( 0 , 2 ) ) ;" tip = [1,3,0,2] //# NOTE: totip[x] = id in tip[] of the taxon right after position x in tr //# tr = "( ( 1 , 3 ) , ( 0 , 2 ) ) ;" tip = [1,3,0,2]
totip = new short[x=tr.length()]; //# totip = [0,0,0,1,1,2,2,2,2,3,4,4,4,4] totip = new short[x=tr.length()]; //# totip = [0,0,0,1,1,2,2,2,2,3,4,4,4,4]
s = (short) n; while ( --x >= 0 ) { switch ( tr.charAt(x) ) { case '(': case ',': if ( tr.charAt(++x) != '(' ) totip[x] = --s; --x; break; } totip[x] = s; } s = (short) n; while ( --x >= 0 ) { switch ( tr.charAt(x) ) { case '(': case ',': if ( tr.charAt(++x) != '(' ) totip[x] = --s; --x; break; } totip[x] = s; }
are = new ArrayList<Double>(n); std = new BitSet(n); u = 0; are = new ArrayList<Double>(n); std = new BitSet(n); u = 0;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment