Changeset 4535
- Timestamp:
- Nov 22, 2013, 4:39:31 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/api/core/conf/common-queries.xml
r4506 r4535 255 255 </description> 256 256 </query> 257 258 <query id="GET_UNIQUE_PEPTIDE_SEQUENCES_BELOW_FDR_IN_HITS_FOR_PROJECT" type="HQL"> 259 <sql> 260 SELECT DISTINCT h.description 261 FROM HitData h 262 WHERE h.project = :project AND h.protein = false AND h.combinedFDR <= :combinedFDR 263 ORDER by h.description 264 </sql> 265 <description> 266 Load all distinct (unique) peptide sequences in the Hits table for a project. 267 </description> 268 </query> 257 269 258 270 <query id="GET_UNIQUE_CHARGES_IN_HITS_FOR_PROJECT" type="HQL"> -
trunk/api/core/src/org/proteios/core/Hit.java
r4506 r4535 145 145 "GET_UNIQUE_PEPTIDE_SEQUENCES_IN_HITS_FOR_PROJECT"); 146 146 query.setEntity("project", project.getData()); 147 return query.list(); 148 } 149 150 @SuppressWarnings("unchecked") 151 public static List<String> getUniquePeptideSequencesBelowFDR(Project project, 152 DbControl dc,float combinedFDR) 153 { 154 org.hibernate.Query query = HibernateUtil.getPredefinedQuery(dc 155 .getHibernateSession(), 156 "GET_UNIQUE_PEPTIDE_SEQUENCES_BELOW_FDR_IN_HITS_FOR_PROJECT"); 157 query.setEntity("project", project.getData()); 158 query.setFloat("combinedFDR", combinedFDR); 147 159 return query.list(); 148 160 } -
trunk/client/servlet/src/locale/en/dictionary
r4522 r4535 848 848 SearchXTandemUsingLocalInstallation=Search X!Tandem using local installation 849 849 SearchXTandemViaWebInterface=Search X!Tandem via web interface 850 SecondaryPeptideCutOff=Secondary peptide cutoff 850 851 SelectFileType=Select File Type 851 852 SelectFractionIdEntryMode=Fraction ID input: -
trunk/client/servlet/src/org/proteios/action/feature/CreateFeatureHitMatchJob.java
r4339 r4535 57 57 public static final VFloat VALIGNTOL = new VFloat("aligntol",true); 58 58 public static final VFloat VFDRCUTOFF = new VFloat("fdrCutOff",true); 59 public static final VFloat VSECONDARYFDRCUTOFF = new VFloat("secondaryFdrCutOff",true); 59 60 60 61 /* … … 78 79 Float alignTimeTol = getValidFloat(VALIGNTOL); 79 80 Float fdrCutOff = getValidFloat(VFDRCUTOFF); 81 Float secondaryFdrCutOff = getValidFloat(VSECONDARYFDRCUTOFF); 80 82 Boolean isSecondary = getValidBoolean(VSECONDARY); 81 83 if (isSecondary == null) … … 115 117 isSecondary); 116 118 job.setParameterValue("fdrCutOff", new FloatParameterType(), fdrCutOff); 119 job.setParameterValue("secondaryFdrCutOff", new FloatParameterType(), secondaryFdrCutOff); 117 120 job.setName("Match features and hits"); 118 121 job.setDescription("Matching in project:" + project+ ", FDR cutoff:" + fdrCutOff + ", tolerance:"+tolerance + ", secondary:"+isSecondary); -
trunk/client/servlet/src/org/proteios/action/feature/FeatureHitMatchForm.java
r4339 r4535 57 57 CreateFeatureHitMatchJob.VFDRCUTOFF); 58 58 tolFDRF.setValue(new Float(0.01)); 59 tolFDRF.setLabel(" peptideCutOff");59 tolFDRF.setLabel("PeptideCutOff"); 60 60 tolFDRF.setHelp("Peptide identification FDR cutoff."); 61 61 properties.add(tolFDRF); 62 TextField<Float> stolFDRF = new TextField<Float>( 63 CreateFeatureHitMatchJob.VSECONDARYFDRCUTOFF); 64 stolFDRF.setValue(new Float(1f)); 65 stolFDRF.setLabel("SecondaryPeptideCutOff"); 66 stolFDRF.setHelp("FDR cutoff for peptides that pass the primary FDR cutoff elsewhere in the project."); 67 properties.add(stolFDRF); 62 68 Checkbox<VBoolean> isSecondaryF = new Checkbox<VBoolean>( 63 69 CreateFeatureHitMatchJob.VSECONDARY); -
trunk/plugin/src/org/proteios/plugins/FeatureHitMatcher.java
r4351 r4535 61 61 import java.io.OutputStream; 62 62 import java.io.PrintWriter; 63 import java.sql.Timestamp; 63 64 import java.util.ArrayList; 64 65 import java.util.Arrays; 66 import java.util.Date; 65 67 import java.util.List; 68 import java.util.TreeMap; 66 69 67 70 /** … … 76 79 static float MONOISOTOPIC_PROTON_MASS = (float) 1.007276035; 77 80 boolean jobAborted = false; 81 long currentCluster =0; 82 TreeMap<String,Long> clusterMap = new TreeMap<String,Long>(); 78 83 79 84 /** … … 93 98 public About getAbout() { 94 99 return new AboutImpl("Match features to hits", 95 "Match features to hits for a project", "0. 4",96 "2009-201 2, Marianne Sandin, Fredrik Levander", null, null,100 "Match features to hits for a project", "0.5", 101 "2009-2013, Marianne Sandin, Fredrik Levander", null, null, 97 102 "http://www.proteios.org"); 98 103 } … … 113 118 double alignTimeTol = 4; 114 119 float fdrCutOff = 0.01f; 120 float secondaryFdrCutOff = 1f; 115 121 int count = 0; 116 122 DbControl dc = sc.newDbControl(); … … 146 152 alignTimeTol = ((Float) job.getValue("alignTimeTol")).doubleValue(); 147 153 fdrCutOff = ((Float) job.getValue("fdrCutOff")).floatValue(); 154 secondaryFdrCutOff = ((Float) job.getValue("secondaryFdrCutOff")).floatValue(); 155 148 156 boolean matchRelated = ((Boolean) job.getValue("secondary")) 149 157 .booleanValue(); … … 165 173 166 174 writer.println("Hit FDR cutoff:" + fdrCutOff); 175 writer.println("Secondary hit FDR cutoff:" + secondaryFdrCutOff); 167 176 writer.println("m/z tolerance:" + tolerance); 168 177 writer.println("RT (minutes) tolerance - start:" + startTimeTol 169 178 + " end:" + endTimeTol); 170 writer.println("Matching with related files " + matchRelated);179 writer.println("Matching with related files:" + matchRelated); 171 180 172 181 if (matchRelated) { … … 185 194 + "\n"); 186 195 ItemQuery<Feature> featureQuery = qf.select(Feature.class); 196 List<String> peptideSequenceList = Hit.getUniquePeptideSequencesBelowFDR(project, dc, fdrCutOff); 197 for (int i=0;i<peptideSequenceList.size();i++) 198 { 199 String s = peptideSequenceList.get(i); 200 if (s.contains("delta")) { 201 peptideSequenceList.set(i,s.substring(0, s.indexOf("delta"))); 202 } 203 } 204 Timestamp tStmp = new Timestamp(new Date().getTime()); 205 currentCluster = tStmp.getTime(); 187 206 featureQuery.restrictPermanent(Restrictions.eq( 188 207 Hql.property("project"), Hql.entity(project))); … … 215 234 writer.println("File:" + currentMsFile); 216 235 List<Hit> hits = retrieveHits(currentMsFile, project, dc2, 217 fdrCutOff, matchRelated);236 fdrCutOff, secondaryFdrCutOff, peptideSequenceList, matchRelated); 218 237 List<Feature> features = featureQuery.list(dc2); 219 238 PolynomialSplineFunction func = null; … … 387 406 log.debug("m/z matching:" + f.getMassToChargeRatio() 388 407 + " hit:" + hitMz); 389 // In rare cases the end retention isnull!408 // In rare cases the start or end retention time can be null! 390 409 if (f.getEndRetentionTimeInMinutes() == null) 391 410 f.setEndRetentionTimeInMinutes(new Float(f 392 411 .getApexRetentionTimeInMinutes() + endTimeTol)); 412 if (f.getStartRetentionTimeInMinutes() == null) 413 f.setStartRetentionTimeInMinutes(new Float(f 414 .getApexRetentionTimeInMinutes() - startTimeTol)); 393 415 if (hitRt >= f.getStartRetentionTimeInMinutes() 394 416 && hitRt <= f.getEndRetentionTimeInMinutes()) { … … 413 435 replaced++; 414 436 } 415 f.setPeptideSequence(h.getDescription().substring(0,h.getDescription().contains("delta") ? h.getDescription().lastIndexOf(" ") : h.getDescription().length()));437 setFeatureSequenceAndClusterId(f, h); 416 438 f.addHit(h); 417 439 newmatches++; … … 470 492 if (best) { 471 493 472 f.setPeptideSequence(h.getDescription().substring(0, h.getDescription().contains("delta") ? h.getDescription().lastIndexOf(" ") : h.getDescription().length()));494 setFeatureSequenceAndClusterId(f, h); 473 495 writer.println("Better scoring hit sequence replacing old"); 474 496 // We only want the precursor quantity … … 526 548 h.setPrecursorQuantity(f.getIntegratedIntensity()); 527 549 f.addHit(h); 528 f.setPeptideSequence(h.getDescription().substring(0, h.getDescription().contains("delta") ? h.getDescription().lastIndexOf(" ") : h.getDescription().length()));550 setFeatureSequenceAndClusterId(f, h); 529 551 count++; 530 552 newmatches++; … … 579 601 return count; 580 602 } 603 604 private void setFeatureSequenceAndClusterId(Feature f, Hit h) 605 { 606 f.setPeptideSequence(h.getDescription().substring(0,h.getDescription().contains("delta") ? h.getDescription().lastIndexOf(" ") : h.getDescription().length())); 607 String comb = f.getPeptideSequence()+","+f.getChargeState(); 608 if (clusterMap.containsKey(comb)) 609 { 610 f.setClusterId(clusterMap.get(comb)); 611 } 612 else 613 { 614 f.setClusterId(currentCluster); 615 clusterMap.put(comb, currentCluster); 616 currentCluster++; 617 } 618 } 581 619 582 620 private int getFirstHitForChargeState(List<Hit> hits, int charge) { … … 590 628 591 629 private List<Hit> retrieveHits(File msFile, Project project, DbControl dc, 592 float fdrCutOff, boolean matchRelated) {630 float fdrCutOff, float secondaryFdrCutOff, List<String> peptideSequenceList, boolean matchRelated) { 593 631 List<Hit> hits = new ArrayList<Hit>(); 594 632 ItemQuery<Hit> hitQuery = Hit.getQuery(project); 633 int notSoGoodHits = 0; 595 634 // First check if the same msXML file can be found in the hits table 596 635 hitQuery.restrict(Restrictions.eq(Hql.property("peakListFile"), … … 601 640 hitQuery.setPermanentParameter("protein", false, null); 602 641 hitQuery.restrictPermanent(Restrictions.lteq( 603 Hql.property("combinedFDR"), Expressions.aFloat( fdrCutOff)));642 Hql.property("combinedFDR"), Expressions.aFloat(secondaryFdrCutOff))); 604 643 } 605 644 if (hitQuery.count(dc) == 0) { … … 668 707 hitQuery.restrictPermanent(Restrictions.lteq( 669 708 Hql.property("combinedFDR"), 670 Expressions.aFloat( fdrCutOff)));709 Expressions.aFloat(secondaryFdrCutOff))); 671 710 log.debug("Hit peakListFile:" + h.getPeakListFile()); 672 711 } … … 676 715 ItemResultList<Hit> hitlist = hitQuery.list(dc); 677 716 for (Hit h : hitlist) { 678 hits.add(h); 679 } 680 log.debug("Hits found:" + hits.size()); 717 if (h.getCombinedFDR()<=fdrCutOff) 718 hits.add(h); 719 else { 720 String s = h.getDescription(); 721 if (s.contains("delta")) 722 { 723 s = s.substring(0, s.indexOf("delta")); 724 } 725 if (peptideSequenceList.contains(s)) 726 { 727 hits.add(h); 728 notSoGoodHits++; 729 } 730 } 731 } 732 log.debug("Hits found:" + hits.size() + ". " + notSoGoodHits + " retained above primary FDR threshold."); 681 733 return hits; 682 734 }
Note: See TracChangeset
for help on using the changeset viewer.