Changeset 4540
- Timestamp:
- Jan 8, 2014, 10:48:49 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/client/servlet/src/org/proteios/action/ActionFactory.java
r4421 r4540 48 48 import org.proteios.action.hit.ViewHit; 49 49 import org.proteios.action.hit.ViewHitExternalId; 50 import org.proteios.action.hit.ViewHitFeature; 50 51 import org.proteios.action.hit.ViewHitPDBFile; 51 52 import org.proteios.action.hit.ViewHitSearchResultFile; … … 683 684 link = getActionLink(ViewHitSubHits.class, label); 684 685 } 686 else if (key.equals("PrecursorQuantity")) 687 { 688 link = getActionLink(ViewHitFeature.class, label); 689 } 685 690 else if (key.equals("Protein")) 686 691 { -
trunk/plugin/src/org/proteios/plugins/ClearFeatures.java
r4310 r4540 76 76 { 77 77 return new AboutImpl("Clear Features", "Clear features in project", 78 "0. 1", "2012, Fredrik Levander", null, null,78 "0.2", "2012-2014, Fredrik Levander", null, null, 79 79 "http://www.proteios.org"); 80 80 } … … 118 118 int updatedFeatures = removeFeatureSequences(project, dc); 119 119 dc.commit(); 120 int deletedIds = clearClusterIds(project,sc); 120 121 response 121 .setDone(updatedFeatures + " feature sequences removed. " + updatedHits + " hits updated. " + removedAligned + " aligned hits deleted. ");122 .setDone(updatedFeatures + " feature sequences removed. " + updatedHits + " hits updated. " + removedAligned + " aligned hits deleted. " + deletedIds + " cluster IDs removed."); 122 123 } 123 124 else … … 146 147 QueryFactory qf = new QueryFactory(); 147 148 ItemQuery<Hit> hitQuery = qf.select(Hit.class); 148 hitQuery.restrictPermanent(Restrictions.eq(Hql.property("project"), Hql149 .entity(project)));149 hitQuery.restrictPermanent(Restrictions.eq(Hql.property("project"), 150 Hql.entity(project))); 150 151 hitQuery.restrictPermanent(Restrictions.eq(Hql.property("scoreType"), 151 152 Expressions.string("Proteios aligned"))); … … 176 177 QueryFactory qf = new QueryFactory(); 177 178 ItemQuery<Hit> hitQuery = qf.select(Hit.class); 178 hitQuery.restrictPermanent(Restrictions.eq(Hql.property("project"), Hql179 .entity(project)));180 hitQuery.restrictPermanent(Restrictions.neq( Hql181 .property("precursorQuantity"), null));179 hitQuery.restrictPermanent(Restrictions.eq(Hql.property("project"), 180 Hql.entity(project))); 181 hitQuery.restrictPermanent(Restrictions.neq( 182 Hql.property("precursorQuantity"), null)); 182 183 for (Iterator<Hit> iter = hitQuery.iterate(dc); iter.hasNext();) 183 184 { … … 189 190 } 190 191 hitQuery = qf.select(Hit.class); 191 hitQuery.restrictPermanent(Restrictions.eq(Hql.property("project"), Hql192 .entity(project)));193 hitQuery.restrictPermanent(Restrictions.eq( Hql194 .property("precursorQuantity"), null));192 hitQuery.restrictPermanent(Restrictions.eq(Hql.property("project"), 193 Hql.entity(project))); 194 hitQuery.restrictPermanent(Restrictions.eq( 195 Hql.property("precursorQuantity"), null)); 195 196 hitQuery.restrictPermanent(Restrictions.neq(Hql.property("feature"), 196 197 null)); … … 216 217 QueryFactory qf = new QueryFactory(); 217 218 ItemQuery<Feature> query = qf.select(Feature.class); 218 query.restrictPermanent(Restrictions.eq(Hql.property("project"), Hql219 .entity(project)));219 query.restrictPermanent(Restrictions.eq(Hql.property("project"), 220 Hql.entity(project))); 220 221 query.restrict(Restrictions.neq(Hql.property("peptideSequence"), null)); 221 222 for (Iterator<Feature> iter = query.iterate(dc); iter.hasNext();) … … 247 248 for (File msFile : files) 248 249 { 249 log 250 .debug("Deleting features for file " + (++count) + " of " + nFiles); 250 log.debug("Deleting features for file " + (++count) + " of " + nFiles); 251 251 nDeleted += Feature.deleteAllFeatures(project, msFile, sessc); 252 252 } … … 254 254 return nDeleted; 255 255 } 256 257 258 /** 259 * Delete all cluster Ids for features in project. This is performed for one msFile at 260 * the time to avoid stalling. The deletions are committed to the database 261 * after each batch delete. 262 * 263 * @return the number of deleted rows 264 */ 265 public static int clearClusterIds(Project project, SessionControl sessc) 266 { 267 int nDeleted = 0; 268 DbControl dc = sessc.newDbControl(); 269 List<File> files = Feature.getUniqueMsFiles(project, dc); 270 int nFiles = files.size(); 271 int count = 0; 272 for (File msFile : files) 273 { 274 log.debug("Deleting features for file " + (++count) + " of " + nFiles); 275 nDeleted += clearClusterIds(project, msFile, sessc); 276 } 277 dc.close(); 278 return nDeleted; 279 } 280 281 282 /** 283 * Delete all cluster Ids for features from a msFile in a project 284 * 285 * @param project 286 * @param msFile File 287 * @param sessc Session Control 288 * @return number of updated rows 289 */ 290 public static int clearClusterIds(Project project, File msFile, 291 SessionControl sessc) 292 { 293 int nUpdated = 0; 294 DbControl dc = sessc.newDbControl(); 295 QueryFactory qf = new QueryFactory(); 296 ItemQuery<Feature> featureQuery = qf.select(Feature.class); 297 298 // Only features in project should be retrieved 299 // OBS! has hql object as input 300 featureQuery.restrictPermanent(Restrictions.eq(Hql.property("project"), 301 Hql.entity(project))); 302 featureQuery.restrict(Restrictions.eq(Hql.property("msFile"), 303 Hql.entity(msFile))); 304 featureQuery 305 .restrict(Restrictions.neq(Hql.property("clusterId"), null)); 306 307 for (Iterator<Feature> iter = featureQuery.iterate(dc); iter.hasNext();) 308 { 309 Feature feature = iter.next(); 310 dc.reattachItem(feature); 311 feature.setClusterId(null); 312 nUpdated++; 313 } 314 dc.commit(); 315 return nUpdated; 316 } 256 317 } -
trunk/plugin/src/org/proteios/plugins/FeatureHitMatcher.java
r4535 r4540 99 99 return new AboutImpl("Match features to hits", 100 100 "Match features to hits for a project", "0.5", 101 "2009-201 3, Marianne Sandin, Fredrik Levander", null, null,101 "2009-2014, Marianne Sandin, Fredrik Levander", null, null, 102 102 "http://www.proteios.org"); 103 103 } … … 123 123 // Start by removing previous matches 124 124 if (progress != null) { 125 progress.display( 5, "Removing previous matches");125 progress.display(2, "Removing previous matches"); 126 126 } 127 127 Project project = (Project) job.getValue("project"); … … 129 129 dc.commit(); 130 130 if (progress != null) { 131 progress.display( 5, "Removed aligned hits");131 progress.display(4, "Removed aligned hits"); 132 132 } 133 133 dc = sc.newDbControl(); … … 136 136 dc.commit(); 137 137 if (progress != null) { 138 progress.display( 5, "Removed feature and hits connections");138 progress.display(6, "Removed feature and hits connections"); 139 139 } 140 140 dc = sc.newDbControl(); … … 143 143 dc.commit(); 144 144 if (progress != null) { 145 progress.display(5, "Removed feature sequences"); 146 } 145 progress.display(8, "Removed feature sequences"); 146 } 147 ClearFeatures.clearClusterIds(project, sc); 148 if (progress != null) { 149 progress.display(10, "Removed feature cluster Ids"); 150 } 147 151 // Done with init 148 152 dc = sc.newDbControl(); … … 486 490 .getCombinedFDR()) 487 491 best = false; 488 if (hh.getCombinedFDR() == h.getCombinedFDR())492 if (hh.getCombinedFDR().equals(h.getCombinedFDR())) 489 493 if (hh.getExpectationValue()<=h.getExpectationValue()) 490 494 best = false; … … 713 717 hitQuery.order(Orders.asc(Hql.property("charge"))); 714 718 hitQuery.order(Orders.asc(Hql.property("experimentalMassInDaltons"))); 719 hitQuery.order(Orders.asc(Hql.property("combinedFDR"))); 720 hitQuery.order(Orders.asc(Hql.property("expectationValue"))); 715 721 ItemResultList<Hit> hitlist = hitQuery.list(dc); 716 722 for (Hit h : hitlist) { -
trunk/plugin/src/org/proteios/plugins/FeatureSequencePropagator.java
r4524 r4540 268 268 269 269 dc.commit(); 270 dc = sc.newDbControl(); 271 272 featureQuery.restrict(Restrictions.eq( 273 Hql.property("msFile"), Hql.entity(currentMsFile))); 274 featureQuery.restrict(Restrictions.neq( 275 Hql.property("clusterId"), null)); 276 277 List<Feature> allClusterIdFeatures = featureQuery.list(dc); 278 270 279 271 if (progress != null) { 280 272 progress.display((fileNbr + 1) / nbrOfFiles, … … 282 274 + (fileNbr + 1)); 283 275 } 284 285 for (Feature clusterF : allClusterIdFeatures) { 286 287 clusterF.setClusterId(null); 288 dc.reattachItem(clusterF); 289 290 } 291 292 dc.commit(); 276 277 ClearFeatures.clearClusterIds(project, currentMsFile, sc); 278 293 279 dc = sc.newDbControl(); 294 280
Note: See TracChangeset
for help on using the changeset viewer.