Skip to content

Commit

Permalink
command line error fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Genet Abay committed Apr 13, 2021
1 parent fb5ae6f commit 012c18a
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.compomics.coss.controller.decoyGeneration.*;
import com.compomics.coss.controller.SpectrumAnnotation.Annotation;
import com.compomics.coss.controller.rescoring.Rescore;
import com.compomics.coss.model.ComparisonResult;
import com.compomics.coss.model.ConfigHolder;
import java.io.File;
Expand Down Expand Up @@ -39,6 +40,8 @@ public class MainConsoleController implements UpdateListener {
public void startRunning(String[] args) {
try {

System.out.println("Starting COSS-V2");
System.out.println("Rescoring with Percolator is set on by default in this version");
int lenArgs = args.length;
String arg1 = args[0];
if (lenArgs <= 1 || lenArgs > 5) {
Expand Down Expand Up @@ -75,14 +78,13 @@ public void startRunning(String[] args) {
} else if (lenArgs == 3 && (arg1.startsWith("-a"))) {

System.out.println("Annotating spectral library file...");
double fragTol=0.5;
try{
fragTol= Double.parseDouble(args[2]);
}catch(NumberFormatException ex){
double fragTol = 0.5;
try {
fragTol = Double.parseDouble(args[2]);
} catch (NumberFormatException ex) {
LOG.info("check the fragment tolearnce input: " + ex.toString());
}



annotateLibrary(fragTol, args[1]);
Runtime.getRuntime().exit(0);

Expand All @@ -109,8 +111,8 @@ public void startRunning(String[] args) {

startMatching();

ImportExport exp = new ImportExport(result, configData);
exp.saveResult_CL(2);
// ImportExport exp = new ImportExport(result, configData);
// exp.saveResult_CL(2);
}

}
Expand Down Expand Up @@ -227,9 +229,27 @@ private void startMatching() {

dispatcher = new Dispatcher(this.configData, this, LOG);
result = dispatcher.dispatch();

if (configData.isDecoyAvailable() && result != null) {
validateResult();
LOG.info("Number of validated identified spectra: " + Integer.toString(result.size()));
LOG.info("Number of validated identified spectra by COSS: " + Integer.toString(result.size()));

LOG.info("starting rescoring the result with Percolator ... ");
Rescore rescore = new Rescore(result);
try {
boolean finished = rescore.start_rescoring(configData.getExperimentalSpecFile().toString());
if (finished) {
LOG.info("Percolator finishes scoring and result is stored in the directory of input file ");
} else {
LOG.info("Percolator exits with error. Result not rescored ");
if (!rescore.error_msg.isEmpty()) {
LOG.info(rescore.error_msg);
}
}
} catch (IOException ex) {
java.util.logging.Logger.getLogger(MainFrameController.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}

} else {
LOG.info("No decoy spectra found in library");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ private void fillExpSpectraTable() {
int resultSize = 0;
resultSize = result.size();// configData.getExpSpectraIndex().size();
Spectrum expSpec;
Object[] row = new Object[13];
Object[] row = new Object[15];
ComparisonResult res;
MatchedLibSpectra matchedSpec;
int row_index;
Expand Down Expand Up @@ -616,6 +616,9 @@ public void fillBestmatchTable(int target) {
row[11] = Double.toString(mSpec.getSumMatchedInt_Lib());
row[12] = Double.toString(mSpec.getNumMatchedPeaks());
tblModelResult.addRow(row);
if(mainView.chkboxPercolator.isSelected()){
break;
}

}

Expand Down Expand Up @@ -971,22 +974,31 @@ protected void done() {
}
} catch (IOException ex) {
java.util.logging.Logger.getLogger(MainFrameController.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}finally{

}finally{
List<ComparisonResult> temp = new ArrayList<>();
List<Integer> newIndex= new ArrayList<Integer>(rescore.rescored_result.keySet()) ;
double rescored_score;
double q_val;
String[] splits;
for(int i=0;i<newIndex.size();i++){

for(int i=0;i<newIndex.size();i++){
temp.add(i, result.get(newIndex.get(i)));
splits = rescore.rescored_result.get(newIndex.get(i)).split(",");
rescored_score = Double.parseDouble(splits[0]);
q_val = Double.parseDouble(splits[1]);
try{
rescored_score = Double.parseDouble(splits[0]);
}catch(NumberFormatException ex){
rescored_score = 0.0;
}
try{
q_val = Double.parseDouble(splits[1]);

}catch(NumberFormatException ex){

q_val = 0.0;
}

temp.get(i).setTopScore(rescored_score);
temp.get(i).setQval(q_val);
temp.get(i).getMatchedLibSpec().get(0).setScore(rescored_score);
}

result=temp;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public boolean start_rescoring(String output_path) throws IOException {
id=title.substring(title.indexOf("Index")).split("=")[1];
int index=Integer.parseInt(id);
rescored_result.put(index, sb.toString());
sb.setLength(0);


}else if(line.contains("percolator finished")){
Expand Down

0 comments on commit 012c18a

Please sign in to comment.