Changeset 4977
- Timestamp:
- Sep 24, 2018, 9:37:40 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/GenotypeServlet.java
r4975 r4977 429 429 if (numChecked > 0) 430 430 { 431 jsonMessages.add(0, numChecked + " alignments havebeen checked and will be used for future genotype QC comparisons.");431 jsonMessages.add(0, countMessage(numChecked, "alignment has", "alignments have") + " been checked and will be used for future genotype QC comparisons."); 432 432 } 433 433 dc.commit(); … … 478 478 } 479 479 } 480 if (numReProcess > 0) jsonMessages.add( numReProcess + " items hasbeen scheduled for re-processing");481 if (numFlagged > 0) jsonMessages.add( numFlagged + " alignments havebeen flagged");482 if (numComments > 0) jsonMessages.add( numComments + " comments havebeen updated");480 if (numReProcess > 0) jsonMessages.add(countMessage(numReProcess, "item has", "items have") + " been scheduled for re-processing"); 481 if (numFlagged > 0) jsonMessages.add(countMessage(numFlagged, "alignment has", "alignments have") + " been flagged"); 482 if (numComments > 0) jsonMessages.add(countMessage(numComments, "comment has", "comments have") + " been updated"); 483 483 dc.commit(); 484 484 … … 500 500 ItemSubtype mergedType = Subtype.MERGED_SEQUENCES.get(dc); 501 501 ItemSubtype alignedType = Subtype.ALIGNED_SEQUENCES.get(dc); 502 ItemSubtype specimenType = Subtype.SPECIMEN.get(dc); 503 ItemSubtype lysateType = Subtype.LYSATE.get(dc); 504 ItemSubtype rnaType = Subtype.RNA.get(dc); 505 ItemSubtype libraryType = Subtype.LIBRARY.get(dc); 502 506 ItemList flaggedAlignments = BiomaterialList.FLAGGED_ALIGNMENT.get(dc); 503 507 … … 506 510 checker.preloadSpecimenData(dc); 507 511 512 // Items marked with DoNotUse - total and per item type 508 513 int numRootDoNotUse = 0; 514 int numSpecimen = 0; 515 int numLysate = 0; 516 int numRna = 0; 517 int numLibrary = 0; 518 509 519 int numTotalDoNotUse = 0; 510 520 int numUnflagged = 0; … … 562 572 jsonDebug.add("[Debug]Do not use: " + basicItem + " ["+doNotUse+"]"); 563 573 numTotalDoNotUse++; 564 if (basicItem == rootItem) numRootDoNotUse++; 574 if (basicItem == rootItem) 575 { 576 numRootDoNotUse++; 577 if (specimenType.equals(subtype)) numSpecimen++; 578 else if (lysateType.equals(subtype)) numLysate++; 579 else if (rnaType.equals(subtype)) numRna++; 580 else if (libraryType.equals(subtype)) numLibrary++; 581 } 565 582 } 566 583 … … 639 656 if (numRootDoNotUse > 0) 640 657 { 641 jsonMessages.add(numRootDoNotUse + " main items and " + (numTotalDoNotUse-numRootDoNotUse) + " related items marked as DoNotUse."); 658 StringBuilder msg = new StringBuilder(); 659 if (numSpecimen > 0) 660 { 661 msg.append(countMessage(numSpecimen, "specimen", "specimens")); 662 } 663 if (numLysate > 0) 664 { 665 if (msg.length() > 0) msg.append(", "); 666 msg.append(countMessage(numLysate, "lysate", "lysates")); 667 } 668 if (numRna > 0) 669 { 670 if (msg.length() > 0) msg.append(", "); 671 msg.append(countMessage(numRna, "RNA", "RNA")); 672 } 673 if (numLibrary > 0) 674 { 675 if (msg.length() > 0) msg.append(", "); 676 msg.append(countMessage(numLibrary, "library", "libraries")); 677 } 678 jsonMessages.add(msg + " and " + countMessage(numTotalDoNotUse-numRootDoNotUse, "related item", "related items") + " marked as DoNotUse."); 642 679 } 643 680 644 681 if (numDisabled > 0) 645 682 { 646 jsonMessages.add( numDisabled + " alignments havebeen disabled for future genotype checks.");683 jsonMessages.add(countMessage(numDisabled, "alignment has", "alignments have") + " been disabled for future genotype checks."); 647 684 } 648 685 649 686 if (numOkToUse > 0) 650 687 { 651 jsonMessages.add( numOkToUse + " alignments areok to use.");688 jsonMessages.add(countMessage(numOkToUse, "alignment is", "alignments are") + " ok to use."); 652 689 } 653 690 654 691 if (numAutoUnflagged > 0) 655 692 { 656 jsonMessages.add( numAutoUnflagged + " related alignments havebeen automatically unflagged.");693 jsonMessages.add(countMessage(numAutoUnflagged, "related alignment has", "related alignments have") + " been automatically unflagged."); 657 694 } 658 695 … … 958 995 } 959 996 997 private String countMessage(int count, String one, String more) 998 { 999 return count + " " + (count > 1 ? more : one); 1000 } 1001 960 1002 }
Note: See TracChangeset
for help on using the changeset viewer.