diff --git a/pom.xml b/pom.xml index a6a40d2..cf73f8d 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ edu.scripps.yates luciphor_dtaselect_integrator - 1.1.0 + 1.2.0 luciphor_dtaselect_integrator Program that takes output from luciphor and some thresholds on its scores and integrates the results into a DTASelect-filter.txt file. diff --git a/src/main/java/edu/scripps/yates/luciphor_dtaselect_integrator/LuciphorDtaselectIntegrator.java b/src/main/java/edu/scripps/yates/luciphor_dtaselect_integrator/LuciphorDtaselectIntegrator.java index 40de310..8d4965c 100644 --- a/src/main/java/edu/scripps/yates/luciphor_dtaselect_integrator/LuciphorDtaselectIntegrator.java +++ b/src/main/java/edu/scripps/yates/luciphor_dtaselect_integrator/LuciphorDtaselectIntegrator.java @@ -31,6 +31,7 @@ public class LuciphorDtaselectIntegrator { private static final String COL_LOCAL_FLR = "localFLR"; private static final String DTA_COL_PSMID = "FileName"; private static final String DTA_COL_SEQUENCE = "Sequence"; + private static final String COL_PEP1SCORE = "pep1score"; public LuciphorDtaselectIntegrator(String luciphorPath, String dtaselectPath, Double lflrThreshold, Double gflrThreshold) { @@ -91,7 +92,8 @@ private void processDTASelect(Map filteredLuciphorEntries // get the indexes of the headers indexByHeader = getIndexByHeader(line); // add new columns for the original sequence and the luciphor scores - fw.write(line + "\toriginal_sequence\t" + COL_GLOBAL_FLR + "\t" + COL_LOCAL_FLR + "\n"); + fw.write(line + "\toriginal_sequence\tluciphor_score\t" + COL_GLOBAL_FLR + "\t" + COL_LOCAL_FLR + + "\n"); continue; } if (!isPSMLine) { @@ -108,7 +110,7 @@ private void processDTASelect(Map filteredLuciphorEntries final String originalSequence = split[indexByHeader.get(DTA_COL_SEQUENCE)]; final String sequenceToReplace = luciphorEntry.getFormattedPredictedSequence(originalSequence); // if (originalSequence.equals(sequenceToReplace)) { -// fw.write(line + "\t\t\t\n"); +// fw.write(line + "\t\t\t\t\n"); // continue; // } // create new array of values @@ -127,8 +129,10 @@ private void processDTASelect(Map filteredLuciphorEntries numChanged++; newLineValues.add(originalSequence); } + newLineValues.add(String.valueOf(luciphorEntry.getScore())); newLineValues.add(String.valueOf(luciphorEntry.getGlobalFLR())); newLineValues.add(String.valueOf(luciphorEntry.getLocalFLR())); + // get the new line as string final StringBuilder newLine = new StringBuilder(); int i = 0; @@ -144,7 +148,7 @@ private void processDTASelect(Map filteredLuciphorEntries continue; } else { - fw.write(line + "\t\t\t\n"); + fw.write(line + "\t\t\t\t\n"); } } } @@ -213,12 +217,24 @@ private List readLuciphorFile() throws IOException { for (int numLine = 1; numLine < lines.size(); numLine++) { final String line = lines.get(numLine); final String[] split = line.split("\t"); + if (!indexByHeader.containsKey(COL_SPEC_ID) || !indexByHeader.containsKey(COL_PRED_PEP1)) { + continue; + } final String psmID = split[indexByHeader.get(COL_SPEC_ID)]; final String predictedSequence = split[indexByHeader.get(COL_PRED_PEP1)]; - final double localFLR = Double.valueOf(split[indexByHeader.get(COL_LOCAL_FLR)]); - final double globalFLR = Double.valueOf(split[indexByHeader.get(COL_GLOBAL_FLR)]); - final LuciphorEntry luciphorEntry = new LuciphorEntry(psmID, predictedSequence, localFLR, globalFLR); - + double localFLR = Double.NaN; + if (indexByHeader.containsKey(COL_LOCAL_FLR)) { + localFLR = Double.valueOf(split[indexByHeader.get(COL_LOCAL_FLR)]); + } + double globalFLR = Double.NaN; + if (indexByHeader.containsKey(COL_GLOBAL_FLR)) { + globalFLR = Double.valueOf(split[indexByHeader.get(COL_GLOBAL_FLR)]); + } + double score = Double.NaN; + if (indexByHeader.containsKey(COL_PEP1SCORE)) { + score = Double.valueOf(split[indexByHeader.get(COL_PEP1SCORE)]); + } + final LuciphorEntry luciphorEntry = new LuciphorEntry(psmID, predictedSequence, localFLR, globalFLR, score); ret.add(luciphorEntry); } System.out.println(ret.size() + " PSMs read from Luciphor file"); diff --git a/src/main/java/edu/scripps/yates/luciphor_dtaselect_integrator/LuciphorEntry.java b/src/main/java/edu/scripps/yates/luciphor_dtaselect_integrator/LuciphorEntry.java index ffbc094..9354b96 100644 --- a/src/main/java/edu/scripps/yates/luciphor_dtaselect_integrator/LuciphorEntry.java +++ b/src/main/java/edu/scripps/yates/luciphor_dtaselect_integrator/LuciphorEntry.java @@ -14,13 +14,15 @@ public class LuciphorEntry { private final String predictedSequence; private final double localFLR; private final double globalFLR; + private final double score; private static Set modifiedAAs = new THashSet(); - public LuciphorEntry(String psmID, String predictedSequence, double localFLR, double globalFLR) { + public LuciphorEntry(String psmID, String predictedSequence, double localFLR, double globalFLR, double score) { this.psmID = psmID; this.predictedSequence = predictedSequence; this.localFLR = localFLR; this.globalFLR = globalFLR; + this.score = score; findModifiedAAs(predictedSequence); } @@ -123,4 +125,8 @@ private TIntObjectMap getPTMsByPosition(List ptms) { return ret; } + public double getScore() { + return score; + } + }