Skip to content

Commit c18144a

Browse files
author
Benjamin Linard
committed
Merge stripped branch 'preprod'
2 parents 629bc4a + edd6905 commit c18144a

9 files changed

Lines changed: 268 additions & 229 deletions

File tree

nbproject/private/private.xml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
33
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
44
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
5-
<group>
6-
<file>file:/media/ben/STOCK/SOURCES/NetBeansProjects/RAPPAS/src/main_v2/Main_v2.java</file>
7-
<file>file:/media/ben/STOCK/SOURCES/NetBeansProjects/RAPPAS/src/charts/ChartsForNodes.java</file>
8-
<file>file:/media/ben/STOCK/SOURCES/NetBeansProjects/RAPPAS/nbproject/project.properties</file>
9-
<file>file:/media/ben/STOCK/SOURCES/NetBeansProjects/RAPPAS/src/charts/ChartsForReads.java</file>
10-
</group>
5+
<group/>
116
</open-files>
127
</project-private>

nbproject/project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ debug.test.classpath=\
2727
dist.archive.excludes=
2828
# This directory is removed when the project is cleaned:
2929
dist.dir=dist
30-
dist.jar=${dist.dir}/ViromePlacer.jar
30+
dist.jar=${dist.dir}/RAPPAS.jar
3131
dist.javadoc.dir=${dist.dir}/javadoc
3232
endorsed.classpath=
3333
excludes=

src/core/algos/PlacementProcess.java

Lines changed: 88 additions & 95 deletions
Large diffs are not rendered by default.

src/core/hash/UnionPointerWithMap.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
import it.unimi.dsi.fastutil.chars.Char2FloatMap;
99
import it.unimi.dsi.fastutil.chars.Char2FloatOpenHashMap;
10-
import it.unimi.dsi.fastutil.ints.Int2FloatMap;
11-
import it.unimi.dsi.fastutil.ints.Int2FloatOpenHashMap;
1210
import java.io.Serializable;
1311
import java.util.List;
1412
import java.util.stream.Collectors;

src/main_v2/ArgumentsParser_v2.java

Lines changed: 108 additions & 76 deletions
Large diffs are not rendered by default.

src/main_v2/Main_DBBUILD_3.java

Lines changed: 58 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ public class Main_DBBUILD_3 {
9797
* @param keepRatio
9898
* @param doGapJumps
9999
* @param limitTo1Jump
100+
* @param gapJumpThreshold
100101
* @throws java.io.FileNotFoundException
101102
* @throws java.lang.ClassNotFoundException
102103
*/
@@ -127,15 +128,10 @@ public static void DBGeneration( int analysisType,
127128
int keepAtMost,
128129
float keepRatio,
129130
boolean doGapJumps,
130-
boolean limitTo1Jump
131+
boolean limitTo1Jump,
132+
float gapJumpThreshold
131133
) throws FileNotFoundException, IOException, ClassNotFoundException {
132134

133-
134-
135-
136-
137-
138-
139135

140136
////////////////////////////////////////////////////////////////////
141137
////////////////////////////////////////////////////////////////////
@@ -232,6 +228,26 @@ public static void DBGeneration( int analysisType,
232228
}
233229
align.writeAlignmentAsFasta(reducedAlign);
234230
Infos.println("Reduced alignment written to: "+reducedAlign.getAbsolutePath());
231+
232+
}
233+
234+
//check gap ratio in reference alignment
235+
//if >= to gapJumpThreshold, activate gap jumps
236+
boolean gapJumpsActivated=false;
237+
if (doGapJumps) { //if false, the user explicitely deactivated jumps
238+
239+
double[] gapProportions = align.getGapProportions();
240+
double gap=0.0; double nonGap=0.0;
241+
for (int i = 0; i < gapProportions.length; i++) {
242+
gap+=gapProportions[i];
243+
nonGap+=(1.0-gapProportions[i]);
244+
}
245+
double gapRatio=gap/nonGap;
246+
Infos.println("Gap ratio: "+gapRatio);
247+
if (gapRatio>=gapJumpThreshold) {
248+
gapJumpsActivated=true;
249+
Infos.println(">="+gapJumpThreshold+", gap jumps activated.");
250+
}
235251
}
236252

237253

@@ -411,11 +427,11 @@ public static void DBGeneration( int analysisType,
411427
// and the modification in ARTree operated by the AR software
412428
// (which renames internal nodes/labels in its own way...)
413429
System.out.println("Parsing Ancestral reconstruction results...");
414-
arpr=new ARResults( arpl,
415-
align,
416-
originalTree,
417-
extendedTree,
418-
s
430+
arpr=new ARResults( arpl,
431+
align,
432+
originalTree,
433+
extendedTree,
434+
s
419435
);
420436
//output in the AR directory the mapping of the nodes for debugging
421437
File map=new File(arpl.ARPath.getAbsolutePath()+File.separator+"ARtree_id_mapping.tsv");
@@ -629,7 +645,7 @@ public static void DBGeneration( int analysisType,
629645
pos,
630646
nodeId,
631647
wordCompression,
632-
doGapJumps,
648+
gapJumpsActivated,
633649
limitTo1Jump
634650
);
635651

@@ -764,7 +780,7 @@ public static void DBGeneration( int analysisType,
764780
File dbmedium=new File(db.getAbsoluteFile()+".medium");
765781
File dbsmall=new File(db.getAbsoluteFile()+".small");
766782
File dbunion=new File(db.getAbsoluteFile()+".union");
767-
File dbsmallunion=new File(db.getAbsoluteFile()+".sunion");
783+
//File dbsmallunion=new File(db.getAbsoluteFile()+".sunion");
768784

769785

770786

@@ -868,18 +884,18 @@ public static void DBGeneration( int analysisType,
868884
placer.doPlacements(query, dbunion, workDir, callString, nsBound,keepAtMost,keepRatio);
869885
}
870886
//reduction to small DB
871-
System.out.println("Reduction to small union DB...");
872-
session.hash.reducetoSmallHash_v2(100);
873-
System.gc();
887+
//System.out.println("Reduction to small union DB...");
888+
//session.hash.reducetoSmallHash_v2(100);
889+
//System.gc();
874890
//calibration to small DB
875891
//NOTE: not done, we keep medium DB calibration as the basis.
876892
//now do placements on small DB
877-
System.out.println("Starting placement on small union DB...");
878-
placer=new Main_PLACEMENT_v07(session,dbInRAM);
879-
for (int i = 0; i < queries.size(); i++) {
880-
File query = queries.get(i);
881-
placer.doPlacements(query, dbsmallunion, workDir, callString, nsBound,keepAtMost,keepRatio);
882-
}
893+
//System.out.println("Starting placement on small union DB...");
894+
//placer=new Main_PLACEMENT_v07(session,dbInRAM);
895+
//for (int i = 0; i < queries.size(); i++) {
896+
//File query = queries.get(i);
897+
// placer.doPlacements(query, dbsmallunion, workDir, callString, nsBound,keepAtMost,keepRatio);
898+
//}
883899
}
884900

885901
System.out.println("DBINRAM OPERATIONS FINISHED.");
@@ -1101,30 +1117,30 @@ public static void DBGeneration( int analysisType,
11011117
session.hash.reducetoSmallHash_v2(100);
11021118
System.gc();
11031119
//calibration
1104-
float calibrationNormScoreSmallUnion=Float.NEGATIVE_INFINITY;
1105-
if (!noCalibration) {
1106-
if (writeTSVCalibrationLog) {
1107-
bwTSVCalibration=new BufferedWriter(new FileWriter(new File(logPath+"calibration_small.tsv")),bufferSize);
1108-
}
1109-
System.out.println("Score calibration on "+calibrationSampleSize+" random sequences (small union DB)...");
1110-
//do the placement and calculate score quantiles
1111-
asp=new PlacementProcess(session,Float.NEGATIVE_INFINITY, calibrationSampleSize);
1112-
calibrationNormScoreSmallUnion = asp.processCalibration(rs,calibrationSampleSize, null, SequenceKnife.SAMPLING_LINEAR, 0,q_quantile,n_quantile);
1113-
System.out.println("Score bound: "+calibrationNormScoreSmallUnion);
1114-
//closes the calibration log
1115-
if (writeTSVCalibrationLog){
1116-
bwTSVCalibration.close();
1117-
}
1118-
}
1120+
//float calibrationNormScoreSmallUnion=Float.NEGATIVE_INFINITY;
1121+
//if (!noCalibration) {
1122+
// if (writeTSVCalibrationLog) {
1123+
// bwTSVCalibration=new BufferedWriter(new FileWriter(new File(logPath+"calibration_small.tsv")),bufferSize);
1124+
// }
1125+
// System.out.println("Score calibration on "+calibrationSampleSize+" random sequences (small union DB)...");
1126+
// //do the placement and calculate score quantiles
1127+
// asp=new PlacementProcess(session,Float.NEGATIVE_INFINITY, calibrationSampleSize);
1128+
// calibrationNormScoreSmallUnion = asp.processCalibration(rs,calibrationSampleSize, null, SequenceKnife.SAMPLING_LINEAR, 0,q_quantile,n_quantile);
1129+
// System.out.println("Score bound: "+calibrationNormScoreSmallUnion);
1130+
// //closes the calibration log
1131+
// if (writeTSVCalibrationLog){
1132+
// bwTSVCalibration.close();
1133+
// }
1134+
//}
11191135
//associate medium calibration
1120-
session.associateCalibrationScore(calibrationNormScoreSmallUnion);
1136+
//session.associateCalibrationScore(calibrationNormScoreSmallUnion);
11211137
//store in DB
1122-
System.out.println("Serialization of the database (small union)...");
1123-
session.storeHash(dbsmallunion);
1138+
//System.out.println("Serialization of the database (small union)...");
1139+
//session.storeHash(dbsmallunion);
11241140

11251141
//serialization finished, output some log infos
11261142
Infos.println("DB UNION: "+Environement.getFileSize(dbunion)+" Mb saved");
1127-
Infos.println("DB SMALL-UNION: "+Environement.getFileSize(dbsmallunion)+" Mb saved");
1143+
//Infos.println("DB SMALL-UNION: "+Environement.getFileSize(dbsmallunion)+" Mb saved");
11281144
System.out.println("\"Union\" database saved.");
11291145
}
11301146

src/main_v2/Main_PLACEMENT_v07.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,15 @@ public int doPlacements( File q,
9898
//DEBUG PARAMETERS
9999
////////////////////////////////////////////////////////////////////
100100
////////////////////////////////////////////////////////////////////
101-
101+
102+
//minOverlap is currently deprecated !
102103
//minimum read/ref overlap,in bp. When not respected, read not reported
103104
int minOverlap=100;
104105
//word sampling method
105106
int queryWordSampling=SequenceKnife.SAMPLING_LINEAR;
106107

107108
//debug
108-
int queryLimit=100000000;
109+
int queryLimit=50000;
109110

110111

111112
////////////////////////////////////////////////////////////////////

src/main_v2/Main_v2.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
*/
2020
public class Main_v2 {
2121

22-
private final static String consoleVersion="1.00";
22+
private final static String consoleVersion="1.01";
2323

2424
public static void main (String[] args) {
2525
try {
2626
long startTime=System.currentTimeMillis();
2727
System.out.println("################################################");
28-
System.out.println("## \"Rapid Alignment-free Phylogenetic Placement ");
29-
System.out.println("## via Ancestral Sequences\"");
28+
System.out.println("## Rapid Alignment-free Phylogenetic Placement ");
29+
System.out.println("## via Ancestral Sequences");
3030
System.out.println("## RAPPAS v"+consoleVersion);
3131
System.out.println("## benjamin.linard, fabio.pardi ([at].lirmm.fr)");
3232
System.out.println("## LIRMM, Univ. of Montpellier, CNRS");
@@ -105,7 +105,8 @@ public static void main (String[] args) {
105105
argsParser.keepAtMost,
106106
argsParser.keepFactor,
107107
argsParser.doGapJumps,
108-
argsParser.limitTo1Jump
108+
argsParser.limitTo1Jump,
109+
argsParser.gapJumpThreshold
109110

110111
);
111112

@@ -138,7 +139,8 @@ public static void main (String[] args) {
138139

139140

140141
long endTime=System.currentTimeMillis();
141-
System.out.println("Total execution time: "+(endTime-startTime)+" ms");
142+
System.out.println("Total execution time: "+(endTime-startTime)+" ms ("+((endTime-startTime)/60000)+" min)");
143+
System.out.println("Have a coffee, you \"placed\" your world.");
142144
//System.exit(0);
143145

144146
} catch (Exception ex) {

src/main_v2/SessionNext_v2.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public class SessionNext_v2 {
4141
public float alpha=1.0f;
4242

4343

44+
45+
4446
public States states=null;
4547
public Alignment align=null;
4648
public PhyloTree originalTree=null;

0 commit comments

Comments
 (0)