Skip to content

Commit

Permalink
Cleaning obsolete code/comments
Browse files Browse the repository at this point in the history
In particular: Removed code for producing LateX-figures of thesis and
for assessing the contributions of the new start-, intron- and
stop-models (this code will be kept in my masterthesis-repository)
  • Loading branch information
DEVetter committed Sep 24, 2020
1 parent d8caa14 commit 85731dc
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 61 deletions.
7 changes: 4 additions & 3 deletions src/main/java/de/vetter/pogigwasc/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,19 @@
import java.time.format.DateTimeFormatter;

/**
* Main class for gene-prediction: Takes at least one, and up to three
* Main class for gene-prediction: Takes at least one, and up to four
* parameters:
* <ol>
* <li>-i: the input-file (.fasta)</li>
* <li>-o: the output file (.gff, can have arbitrary extension)</li>
* <li>-p: the parameter-file (.properties), flagged by "-p"</li>
* <li>-n: flag whether the prediction should be intronless (this does
* <b>not</b> quite mean prediction optimized for mRNA-reads, as multiple genes
* can still be predicted on the same contig!)
* </ol>
*
* If no output file is specified, one will be created in the same directory as
* the input-file, with date and time-information in its filename.<br>
* If no parameter-file is specified, a default parameter-file (also, and mainly
* used for code-testing) will be used (<b>this no longer works, if the executable is removed from the sources!</b>)
*/
public class App {

Expand Down
3 changes: 1 addition & 2 deletions src/main/java/de/vetter/pogigwasc/LoxodesMagnusGHMM.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,11 @@ public static String parseToGFF(String header, Parse parse, ModelParameters para
result.append(System.lineSeparator());

}

// Handling the start-region which extends beyond the CDS
if (currentFeature != GFFFeature.CDS)
startOfCurrentFeature = state.getName().equals(LoxodesMagnusGHMM.FORWARD_START)
? currentPos + (parameters.getStartRegionSize() - 3)
: currentPos;
// TODO ^ notice this! It is for the new StartRegion-state!
currentFeature = GFFFeature.CDS;

break;
Expand Down
18 changes: 0 additions & 18 deletions src/main/java/de/vetter/pogigwasc/ModelParameters.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ public ModelParameters(FileReader parameterFileReader) throws IOException {

currentParameter = "start_region_size";
startregionSize = Integer.parseInt(properties.getProperty(currentParameter));
// old start-region (i.e. just deterministic ATG):
// startregionSize = 3;

currentParameter = "stop_region_size";
stopregionSize = Integer.parseInt(properties.getProperty(currentParameter));
Expand Down Expand Up @@ -310,22 +308,6 @@ private void computePoissonNormaliser() {
intronTruncatedPoissonNormaliser = 1-Math.exp(intronTruncatedPoissonNormaliser);
intronTruncatedPoissonNormaliser = intronTruncatedPoissonNormaliser/(intronMax - intronMin + 1);
// This value will be ADDED to the probability of seeing any length within min-max.
/*
System.out.println("Intron-state: length-distribution:");
System.out.println("l,poisson,empirical");
double[] LENGTH_PROBABILITIES = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.2188, 0.2812, 0.1042, 0.2292, 0.1146, 0.0208, 0.0104,
0.0104, 0.0, 0.0, 0.0104, 0.0, 0.0, 0.0 };
double sum = 0;
for(int k = 0; k < intronMax + 2; k++) {
sum += Math.exp(getLogProbabilityIntronLength(k));
System.out.println(k + "," + Math.exp(getLogProbabilityIntronLength(k)) + ","
+ (k < LENGTH_PROBABILITIES.length ? LENGTH_PROBABILITIES[k] : 0));
}
System.out.println("\n sum = " + sum + " (should be 1)");
*/
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/de/vetter/pogigwasc/Utilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
public class Utilities {

// Can be used for poisson -- but currently, i am no longer using poisson.
// Used for Poisson
private static final double[] LOG_FACTORIALS = new double[] { 0.0, 0.0, 0.6931471805599453, 1.791759469228055,
3.1780538303479453, 4.787491742782046, 6.579251212010101, 8.525161361065415, 10.60460290274525,
12.80182748008147, 15.104412573075518, 17.502307845873887, 19.98721449566189, 22.552163853123425,
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/de/vetter/pogigwasc/Viterbi.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
import java.util.ArrayList;
import java.util.List;

import de.vetter.pogigwasc.states.HMMState;

/**
* Implements the viterbi algorithm as described by Stanke (AUGUSTUS): Construct
* Implements the Viterbi algorithm as described by Stanke (AUGUSTUS): Construct
* a Viterbi-instance for a GHMM and a given sequence, to compute the
* viterbi-variables of that model on that sequence, and yield the MAP-parses
* Viterbi-variables of that model on that sequence, and yield the MAP-parses
*
* @author David Emanuel Vetter
*
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/de/vetter/pogigwasc/states/IntronState.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,6 @@ public double computeLogEmissionProbability(int previousState, String emissionHi
// if(baseUsage == Double.NEGATIVE_INFINITY)
// return baseUsage;
}
/* Compute without respect to intron-structure! This is the old style
baseUsage = 0;
for(int i = 2; i < length - 2; i++) {
baseUsage += parameters.getLogBaseProbabilityNCS(newEmission.charAt(i));
}
*/

return lengthProb + baseUsage;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public double computeLogEmissionProbability(int previousState, String emissionHi
}

double result = 0;
/* */
for(int i = 0; i < parameters.getStartRegionSize() - 3; i++) {
result += parameters.getLogBaseProbabilityStartRegion(newEmission.charAt(i));
}
Expand Down
26 changes: 0 additions & 26 deletions src/main/java/de/vetter/pogigwasc/states/StopRegionState.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,32 +27,6 @@ public double computeLogEmissionProbability(int previousState, String emissionHi
for(int i = 0; i < parameters.getStopRegionSize() - 3; i += 3)
result += parameters.getLogCodonProbabilityStopRegion(newEmission.substring(i, i+3));

/* old mode:
double[] empirical = { 0.03837953091684435, 0.029850746268656716, 0.0255863539445629, 0.019189765458422176,
0.014925373134328358, 0.008528784648187633, 0.010660980810234541, 0.0021321961620469083,
0.029850746268656716, 0.0255863539445629, 0.0042643923240938165, 0.017057569296375266,
0.010660980810234541, 0.008528784648187633, 0.0, 0.01279317697228145, 0.023454157782515993,
0.014925373134328358, 0.021321961620469083, 0.0042643923240938165, 0.029850746268656716,
0.01279317697228145, 0.023454157782515993, 0.006396588486140725, 0.008528784648187633,
0.006396588486140725, 0.019189765458422176, 0.0042643923240938165, 0.008528784648187633,
0.0021321961620469083, 0.0021321961620469083, 0.0021321961620469083, 0.0255863539445629,
0.014925373134328358, 0.006396588486140725, 0.021321961620469083, 0.017057569296375266,
0.006396588486140725, 0.008528784648187633, 0.0042643923240938165, 0.0255863539445629,
0.017057569296375266, 0.05543710021321962, 0.042643923240938165, 0.008528784648187633,
0.006396588486140725, 0.042643923240938165, 0.008528784648187633, 0.02771855010660981,
0.01279317697228145, 0.006396588486140725, 0.006396588486140725, 0.031982942430703626,
0.0021321961620469083, 0.021321961620469083, 0.006396588486140725, 0.019189765458422176,
0.019189765458422176, 0.02771855010660981, 0.017057569296375266, 0.008528784648187633,
0.006396588486140725, 0.021321961620469083, 0.006396588486140725 };
result = 0;
for(int i = 0; i < parameters.getStopRegionSize() - 3; i += 3) {
int codonIndex = Utilities.baseToIndex(newEmission.charAt(i)) * 16;
codonIndex += Utilities.baseToIndex(newEmission.charAt(i+1)) * 4;
codonIndex += Utilities.baseToIndex(newEmission.charAt(i+2));
result += empirical[codonIndex];
}
// END old mode */

return result;
}

Expand Down

0 comments on commit 85731dc

Please sign in to comment.