Skip to content

Commit

Permalink
Remove un-necesary class for threads
Browse files Browse the repository at this point in the history
  • Loading branch information
ypriverol committed May 17, 2020
1 parent fc062de commit 2586780
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 158 deletions.
1 change: 0 additions & 1 deletion src/lucxor/Globals.java
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,6 @@ static String[] parseNLLine(String line) {
public static void calcFLR() throws InterruptedException, ExecutionException {
double maxDeltaScore = -1.0;
FLR flr = new FLR();
ArrayList<FLR> flrAry = new ArrayList<>();

log.info("\nComputing False Localization Rate (FLR)");

Expand Down
8 changes: 4 additions & 4 deletions src/lucxor/LucXor.java
Original file line number Diff line number Diff line change
Expand Up @@ -529,12 +529,12 @@ private static void runHCDcode() throws IOException,
m.printStats();

// Compute intensity parameters
m.estimateNP_intensity('b');
m.estimateNP_intensity('y');
m.estimateNP_intensity('n');
m.estimateNPIntensity('b');
m.estimateNPIntensity('y');
m.estimateNPIntensity('n');

// Compute distance parameters
m.estimateNP_posDist();
m.estimateNPPosDist();
log.info("\n"); // makes for prettier output

Globals.modelingMapHCD.put(z, m);
Expand Down
11 changes: 8 additions & 3 deletions src/lucxor/MathFunctions.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,14 @@ public static double factorial(double x) {
}



/**
* Get all combinations for all PTMs
* @param candModSites Candidate Modification sites
* @param k Number of combinations
* @return
*/
static List<TIntList> getAllCombinations(TIntList candModSites, int k) {
List<TIntList> ret = new ArrayList<>();
int L = candModSites.size(); // total number of values

// http://code.google.com/p/combinatoricslib/#3._Simple_combinations

Expand All @@ -75,7 +79,8 @@ static List<TIntList> getAllCombinations(TIntList candModSites, int k) {

for(ICombinatoricsVector<Integer> combination : gen) {
TIntArrayList curList = new TIntArrayList();
for(int i : combination) curList.add(i);
for(int i : combination)
curList.add(i);

ret.add(curList);
curList = null;
Expand Down
29 changes: 14 additions & 15 deletions src/lucxor/ModelDataHCD.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,15 @@ public class ModelDataHCD {
static final int ntick = 2000;

double bIntBW, yIntBW; // positive peak intensity bandwidth
double negIntBW; // negative peak intensity bandwidth
double posDistBW; // positive peak distance bandwidth

double bIntMean, bIntVar, yIntMean, yIntVar;
double negIntMean, negIntVar;
double posDistMean, posDistVar;
double negDistMean, negDistVar;




double[] bTickMarksInt, yTickMarksInt, negTickMarksInt;
double[] posTickMarksDist, negTickMarksDist;
double[] posTickMarksDist;
double[] f_int_b, f_int_y, f_int_neg;
double[] f_dist;

Expand Down Expand Up @@ -165,7 +163,6 @@ public void percentileTrim(char ionType, int dataType, double percentTrim) {
// Compute the mean for pos and neg data. This function must be called
// *before* the calcVar function
public void calcMean() {
double mean = 0;
double N = 0;
double sum = 0;

Expand Down Expand Up @@ -197,7 +194,6 @@ public void calcMean() {
// For the negative distribution we assume a uniform distribution over a
// 1 Dalton window. As such, the log of a uniform distribution between
// -1 to 1 is zero
negDistMean = 0;
}


Expand Down Expand Up @@ -247,12 +243,16 @@ public void calcVar() {
negIntVar = (v / N);

}



// Function computes the estimated parameters for the non-parametric model
// for the intensity of the peaks assigned to this ModelData object
void estimateNP_intensity(char ionType) throws InterruptedException, ExecutionException {


/**
* Function computes the estimated parameters for the non-parametric model
* for the intensity of the peaks assigned to this ModelData object
* @param ionType ionType
* @throws InterruptedException
* @throws ExecutionException
*/
void estimateNPIntensity(char ionType) throws InterruptedException, ExecutionException {
int N = 0;
double[] norm_ints = null;
double[] tickMarksInt = null;
Expand Down Expand Up @@ -369,15 +369,14 @@ else if(ionType == 'y') {
else {
negTickMarksInt = tickMarksInt;
f_int_neg = f_int;
negIntBW = bw;
}

}


// Function computes the estimated parameters for the non-parametric model
// for the m/z distances for the positive peaks in this model object
void estimateNP_posDist() throws InterruptedException, ExecutionException {
void estimateNPPosDist() throws InterruptedException, ExecutionException {

int N = 0;
double min_dist = 0, max_dist = 0;
Expand Down
102 changes: 19 additions & 83 deletions src/lucxor/PSM.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ void process() {
if(isKeeper) {
// We will reconstruct the specId here to remove left-padded zeros
String suffix = "";
String scanStr = Integer.toString(scanNum);

if(Globals.inputType == Constants.PEPXML) {
if(Globals.spectrumSuffix.equalsIgnoreCase(Constants.MZXML_TYPE))
Expand Down Expand Up @@ -770,13 +769,13 @@ void debugWriteScoredPeaks() throws IOException {
for(Peak pk : mPK) {
if(!pk.isMatched()) continue;

String mz = df.format(MathFunctions.roundDouble(pk.getMz(), 4));
String relI = df.format(MathFunctions.roundDouble(pk.getRelIntensity(), 4));
String normI = df.format(MathFunctions.roundDouble(pk.getNormIntensity(), 4));
String Iscore = df.format(MathFunctions.roundDouble(pk.getIntensityScore(), 4));
String Dscore = df.format(MathFunctions.roundDouble(pk.getDistScore(), 4));
String score = df.format(MathFunctions.roundDouble(pk.getScore(), 4));
String dist = df.format(MathFunctions.roundDouble(pk.getDist(), 4));
String mz = df.format(MathFunctions.roundDouble(pk.getMz(), numDecimals));
String relI = df.format(MathFunctions.roundDouble(pk.getRelIntensity(), numDecimals));
String normI = df.format(MathFunctions.roundDouble(pk.getNormIntensity(), numDecimals));
String Iscore = df.format(MathFunctions.roundDouble(pk.getIntensityScore(), numDecimals));
String Dscore = df.format(MathFunctions.roundDouble(pk.getDistScore(), numDecimals));
String score = df.format(MathFunctions.roundDouble(pk.getScore(), numDecimals));
String dist = df.format(MathFunctions.roundDouble(pk.getDist(), numDecimals));

bw.write("0\t" + score1pep.getModPeptide() + "\t" + pk.getMatchedIonStr() + "\t" + mz + "\t" + dist + "\t" +
relI + "\t" + normI + "\t" + Dscore + "\t" + Iscore + "\t" +
Expand All @@ -796,13 +795,13 @@ void debugWriteScoredPeaks() throws IOException {
for(Peak pk : mPK) {
if(!pk.isMatched()) continue;

String mz = df.format(MathFunctions.roundDouble(pk.getMz(), 4));
String relI = df.format(MathFunctions.roundDouble(pk.getRelIntensity(), 4));
String normI = df.format(MathFunctions.roundDouble(pk.getNormIntensity(), 4));
String Iscore = df.format(MathFunctions.roundDouble(pk.getIntensityScore(), 4));
String Dscore = df.format(MathFunctions.roundDouble(pk.getDistScore(), 4));
String score = df.format(MathFunctions.roundDouble(pk.getScore(), 4));
String dist = df.format(MathFunctions.roundDouble(pk.getDist(), 4));
String mz = df.format(MathFunctions.roundDouble(pk.getMz(), numDecimals));
String relI = df.format(MathFunctions.roundDouble(pk.getRelIntensity(), numDecimals));
String normI = df.format(MathFunctions.roundDouble(pk.getNormIntensity(), numDecimals));
String Iscore = df.format(MathFunctions.roundDouble(pk.getIntensityScore(), numDecimals));
String Dscore = df.format(MathFunctions.roundDouble(pk.getDistScore(), numDecimals));
String score = df.format(MathFunctions.roundDouble(pk.getScore(), numDecimals));
String dist = df.format(MathFunctions.roundDouble(pk.getDist(), numDecimals));

bw.write("1\t" + score2pep.getModPeptide() + "\t" + pk.getMatchedIonStr() + "\t" + mz + "\t" + dist + "\t" +
relI + "\t" + normI + "\t" + Dscore + "\t" + Iscore + "\t" +
Expand Down Expand Up @@ -864,11 +863,11 @@ String writeMatchedPks() {
for(Peak pk : mPK) {
if(!pk.isMatched()) continue;

String mz = df.format(MathFunctions.roundDouble(pk.getMz(), 4));
String relI = df.format(MathFunctions.roundDouble(pk.getRelIntensity(), 4));
String Iscore = df.format(MathFunctions.roundDouble(pk.getIntensityScore(), 4));
String Dscore = df.format(MathFunctions.roundDouble(pk.getDistScore(), 4));
String score = df.format(MathFunctions.roundDouble(pk.getScore(), 4));
String mz = df.format(MathFunctions.roundDouble(pk.getMz(), numDecimals));
String relI = df.format(MathFunctions.roundDouble(pk.getRelIntensity(), numDecimals));
String Iscore = df.format(MathFunctions.roundDouble(pk.getIntensityScore(), numDecimals));
String Dscore = df.format(MathFunctions.roundDouble(pk.getDistScore(), numDecimals));
String score = df.format(MathFunctions.roundDouble(pk.getScore(), numDecimals));

ret.append(specId).append("\t2\t").append(score2pep.getModPeptide()).append("\t").append(pk.getMatchedIonStr()).append("\t").append(mz).append("\t").append(relI).append("\t").append(Dscore).append("\t").append(Iscore).append("\t").append(score).append("\n");
}
Expand Down Expand Up @@ -908,10 +907,6 @@ public int getCharge() {
return charge;
}

public double getPSMscore() {
return PSMscore;
}

public double getDeltaScore() {
return deltaScore;
}
Expand Down Expand Up @@ -944,22 +939,10 @@ public boolean isDecoy() {
return isDecoy;
}

public boolean isUnambiguous() {
return isUnambiguous;
}

public TIntDoubleHashMap getModCoordMap() {
return modCoordMap;
}

public TMap<String, Double> getPosPermutationScoreMap() {
return posPermutationScoreMap;
}

public TMap<String, Double> getNegPermutationScoreMap() {
return negPermutationScoreMap;
}

public List<Peak> getPosPeaks() {
return posPeaks;
}
Expand All @@ -968,10 +951,6 @@ public List<Peak> getNegPeaks() {
return negPeaks;
}

public Spectrum getPeakList() {
return PeakList;
}

public Peptide getOrigPep() {
return origPep;
}
Expand All @@ -980,14 +959,6 @@ public String getPeptideSequence(){
return origPep.getPeptide();
}

public Peptide getScore1pep() {
return score1pep;
}

public Peptide getScore2pep() {
return score2pep;
}

public void setSpecId(String specId) {
this.specId = specId;
}
Expand All @@ -1008,43 +979,8 @@ public void setPSMscore(double PSMscore) {
this.PSMscore = PSMscore;
}

public void setDeltaScore(double deltaScore) {
this.deltaScore = deltaScore;
}

public void setKeeper(boolean keeper) {
isKeeper = keeper;
}

public void setUseForModel(boolean useForModel) {
this.useForModel = useForModel;
}

public void setDecoy(boolean decoy) {
isDecoy = decoy;
}

public void setUnambiguous(boolean unambiguous) {
isUnambiguous = unambiguous;
}

public void setPeakList(Spectrum peakList) {
PeakList = peakList;
}

public void setOrigPep(Peptide origPep) {
this.origPep = origPep;
}

public void setPeptideSequence(String sequence){
this.origPep.setPeptide(sequence);
}

public void setScore1pep(Peptide score1pep) {
this.score1pep = score1pep;
}

public void setScore2pep(Peptide score2pep) {
this.score2pep = score2pep;
}
}
2 changes: 1 addition & 1 deletion src/lucxor/PSMList.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public Object[] toArray() {
}

@Override
public <T> T[] toArray(T[] a) {
public <PSM> PSM[] toArray(PSM[] a) {
return psmList.toArray(a);
}

Expand Down
11 changes: 0 additions & 11 deletions src/lucxor/Peak.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ public class Peak {
// Comparator to sort Peak objects based upon mz dist values from low to high
public static Comparator comparator_mz_abs_dist = Comparator.comparingDouble(o -> Math.abs(((Peak)o).dist));

// default constructor
Peak(double x, double y) { mz = x; rawIntensity = y; }

public Peak() {
mz = 0;
relIntensity = 0;
Expand Down Expand Up @@ -109,10 +106,6 @@ public void setMz(double mz) {
this.mz = mz;
}

public double getRawIntensity() {
return rawIntensity;
}

public void setRawIntensity(double rawIntensity) {
this.rawIntensity = rawIntensity;
}
Expand Down Expand Up @@ -181,10 +174,6 @@ public void setMatchedIonStr(String matchedIonStr) {
this.matchedIonStr = matchedIonStr;
}

public double getMatchedIonMZ() {
return matchedIonMZ;
}

public void setMatchedIonMZ(double matchedIonMZ) {
this.matchedIonMZ = matchedIonMZ;
}
Expand Down
6 changes: 4 additions & 2 deletions src/lucxor/Peptide.java
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,11 @@ else if( nonTargetMods.containsKey(i) ) {
String AA = Character.toString( peptide.charAt(i) );
String aa = AA.toLowerCase();
int score = 0;
if( !Globals.TargetModMap.containsKey(AA) ) score++;
if( !Globals.TargetModMap.containsKey(AA))
score++;

if( !this.nonTargetMods.containsKey(aa) ) score++;
if( !this.nonTargetMods.containsKey(aa) )
score++;

if(score == 2) candModSites.add(i);
}
Expand Down
38 changes: 0 additions & 38 deletions src/lucxor/ScoringWorkerThread.java

This file was deleted.

0 comments on commit 2586780

Please sign in to comment.