Skip to content

Commit

Permalink
REFINE module supports multiple labels
Browse files Browse the repository at this point in the history
  • Loading branch information
itamposis committed May 22, 2022
1 parent 261b45f commit 4814641
Show file tree
Hide file tree
Showing 22 changed files with 242 additions and 161 deletions.
2 changes: 2 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions conf/conf.casino
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ STRDIV=9
#Refine OPTIONS
FLANK=3
REFINE=false
REFINE_LABELS=M
ML_INIT=false

# DECODING OPTIONS
Expand Down
1 change: 1 addition & 0 deletions conf/conf.cpg
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ STRDIV=9
#Refine OPTIONS
FLANK=3
REFINE=false
REFINE_LABELS=M
ML_INIT=false

# DECODING OPTIONS
Expand Down
4 changes: 3 additions & 1 deletion conf/conf.demo
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ EMISSIONS=FILE
WEIGHTS=RPROP

# Multithreaded parallelization for multicores
PARALLEL=true
PARALLEL=false
defCPU=true
nCPU=10

Expand Down Expand Up @@ -53,6 +53,7 @@ STRDIV=9
#Refine OPTIONS
FLANK=3
REFINE=false
REFINE_LABELS=M
ML_INIT=false

# DECODING OPTIONS
Expand All @@ -61,6 +62,7 @@ NBEST=false
DYNAMIC=false
POSVIT=false
PLP=true
LPB=false
CONSTRAINT=false

#EARLY STOPPING OPTIONS
Expand Down
124 changes: 0 additions & 124 deletions conf/conf.hmmtm

This file was deleted.

1 change: 1 addition & 0 deletions conf/conf.lipo
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ STRDIV=9
#Refine OPTIONS
FLANK=3
REFINE=false
REFINE_LABELS=M
ML_INIT=false

# DECODING OPTIONS
Expand Down
1 change: 1 addition & 0 deletions conf/conf.signal
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ STRDIV=9
#Refine OPTIONS
FLANK=3
REFINE=false
REFINE_LABELS=M
ML_INIT=false

# DECODING OPTIONS
Expand Down
1 change: 1 addition & 0 deletions conf/conf.tat
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ STRDIV=9
#Refine OPTIONS
FLANK=3
REFINE=false
REFINE_LABELS=M
ML_INIT=false

# DECODING OPTIONS
Expand Down
18 changes: 10 additions & 8 deletions conf/conf.tmbb
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# TRAINING OPTIONS
RUN_CML=true
RUN_GRADIENT=true
HNN=true
HNN=false
ALLOW_BEGIN=true
ALLOW_END=true
RUN_ViterbiTraining=false
threshold=0.02
maxIter=50
maxIter=200

#PR
#PROBABILITIES
#FILE, RANDOM, UNIFORM, VITERBI
TRANSITIONS=FILE
#FILE, RANDOM, UNIFORM, VITERBI
EMISSIONS=FILE
#FILE, RANDOM_NORMAL, RANDOM_UNIFORM, RPROP, BOOT
WEIGHTS=RPROP
WEIGHTS=FILE

# Multithreaded parallelization for multicores
PARALLEL=false
Expand Down Expand Up @@ -53,6 +53,7 @@ STRDIV=9
#Refine OPTIONS
FLANK=3
REFINE=true
REFINE_LABELS=M
ML_INIT=false

# DECODING OPTIONS
Expand All @@ -61,7 +62,8 @@ NBEST=false
DYNAMIC=false
POSVIT=false
PLP=true
CONSTRAINT=false
LPB=false
CONSTRAINT=true

#EARLY STOPPING OPTIONS
EARLY=false
Expand Down Expand Up @@ -92,9 +94,9 @@ NOISE_EM=true
PRIOR_TRANS=0.001

#HNN OPTIONS
windowLeft=5
windowRight=5
nhidden=9
windowLeft=3
windowRight=3
nhidden=11
ADD_GRAD=0.0
DECAY=0.001
#1: Sigmoid, 2: Sigmoid Modified, 3: Tanh
Expand Down
6 changes: 4 additions & 2 deletions conf/conf.tmbbHNN
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ EMISSIONS=FILE
WEIGHTS=FILE

# Multithreaded parallelization for multicores
PARALLEL=false
PARALLEL=true
defCPU=true
nCPU=10

Expand Down Expand Up @@ -53,6 +53,7 @@ STRDIV=9
#Refine OPTIONS
FLANK=3
REFINE=true
REFINE_LABELS=M
ML_INIT=false

# DECODING OPTIONS
Expand All @@ -61,6 +62,7 @@ NBEST=false
DYNAMIC=false
POSVIT=false
PLP=true
LPB=false
CONSTRAINT=false

#EARLY STOPPING OPTIONS
Expand Down Expand Up @@ -121,4 +123,4 @@ minDelta=1e-6
etaInc=1.2
etaDec=0.5

#RANDOM SEQUENCE UTILITY
#RANDOM SEQUENCE UTILITY
16 changes: 8 additions & 8 deletions models/CpG.mdel
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# MODEL OPTIONS
MODEL=CpG

ESYM=AGCT
ESYM=ACGT
OSYM=HLBE
PSYM=HBE

Expand All @@ -14,15 +14,15 @@ outLabels=O
# A+ C+ G+ T+ A- C- G- T-
# A C G T a c g t
STATE =B A C G T a c g t E
OSTATE=B A C G T a c g t E
PSTATE=B H H H H H H H H E
OSTATE=B H H H H L L L L E
PSTATE=B H H H H L L L L E

#MODEL PRIOR for every esym
PRIOR = 0.077 0.018 0.058 0.066

# Distribution for each osym
# Each column must have a summ equal to 1
# osym H B E
PRIOR1 = 0.97 0.0 0.0
PRIOR2 = 0.01 0.0 0.0
PRIOR3 = 0.02 0.0 0.0
# Each column must have a sum equal to 1
# osym H L B E
PRIOR1 = 0.97 0.97 0.0 0.0
PRIOR2 = 0.01 0.01 0.0 0.0
PRIOR3 = 0.02 0.02 0.0 0.0
2 changes: 1 addition & 1 deletion models/casino.mdel
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ PSTATE=B H H E
PRIOR = 0.077 0.018 0.058 0.066 0.040 0.072

# Distribution for each osym
# Each column must have a summ equal to 1
# Each column must have a sum equal to 1
# osym H B E
PRIOR1 = 0.97 0.0 0.0
PRIOR2 = 0.01 0.0 0.0
Expand Down
5 changes: 3 additions & 2 deletions src/hmm/Args.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.io.*;

public class Args {
static String Vesrion = "1.0.1";
static String Vesrion = "1.0.5";

static boolean RUN_TRAINING = false;
static boolean RUN_CROSSVAL = false;
Expand Down Expand Up @@ -54,7 +54,7 @@ public static final void Init(String[] args) {
switch (a) {
case 'V':

System.err.println("JUCHMME Version" + Vesrion);
System.err.println("JUCHMME Version " + Vesrion);
System.exit(0);

case 'a':
Expand Down Expand Up @@ -140,6 +140,7 @@ public static final void Init(String[] args) {
case 't':
if (args.length > i + 1) {
file = args[i + 1];
filesThree.add(args[i + 1]);
i++;
RUN_TRAINING = true;
Params.THREELINE = true;
Expand Down
12 changes: 10 additions & 2 deletions src/hmm/Estimator.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,18 @@ private HMM Estimate(SeqSet trainSet, Probs tab, WeightsL weightsL) throws Excep
//training.GetModel().print( new SystemOut() );

for (int j = 0; j < trainSet.nseqs; j++) {
trainSet.seq[j].PutDashes(Model.transmLabels);
System.out.println("Performed refinement " + trainSet.seq[j].header);
//Refine multiple labels
for (int i = 0; i < Params.REFINE_LABELS.length(); i++) {
String label = Character.toString(Params.REFINE_LABELS.charAt(i));
if (Model.psym.contains(label)) {
trainSet.seq[j].PutDashes(label);
} else {
System.out.println("Warning: Refinement label "+label+" doesn't exist in model PSYM value.");
}
}
Viterbi vit2 = new Viterbi(training.GetModel(), trainSet.seq[j], false);
trainSet.seq[j].SetObs(vit2.getPath2());
System.out.println("Performed refinement.");
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/hmm/Juchmme.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static void main(String[] args) throws Exception {
long startTime = System.currentTimeMillis();

System.out.println("JUCHMME :: Java Utility for Class Hidden Markov Models and Extensions");
System.out.println("Version 1.0.4; September 2019");
System.out.println("Version 1.0.5; September 2019");
System.out.println("Copyright (C) 2019 Pantelis Bagos");
System.out.println("Freely distributed under the GNU General Public Licence (GPLv3)");
System.out.println("--------------------------------------------------------------------------");
Expand Down Expand Up @@ -109,6 +109,7 @@ public static void main(String[] args) throws Exception {
if (Params.THREELINE) {
SeqSet testSet = new SeqSet((String) Args.filesThree.get(0));
Decoding dec = new Decoding(model, testSet, Params.CONSTRAINT, true, Params.parallel, Params.MSA);
stats.calcStats(testSet);
}

if (Params.FASTA) {
Expand Down
Loading

0 comments on commit 4814641

Please sign in to comment.