Changeset 3778
- Timestamp:
- Aug 18, 2010, 3:18:04 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/contrib/SpectrumLibraryExport/src/satoshi/LibraryExportPlugin.java
r3772 r3778 1 2 1 package satoshi; 3 2 … … 433 432 hitQuery.restrictPermanent(Restrictions.eq(Hql.property("project"), 434 433 Hql.entity(project))); 434 hitQuery.restrictPermanent(Restrictions.eq(Hql.property("protein"), 435 Expressions.parameter("protein"))); 436 hitQuery.setPermanentParameter("protein", false, null); 435 437 hitQuery.restrict(Restrictions.lteq(Hql.property("combinedFDR"), 436 438 Expressions.aFloat((float) fdrCutOff))); … … 446 448 { 447 449 Hit currentHit = hitit.next(); 448 if (!currentHit.isProtein()) 449 { 450 if (hitit.hasNext()) 451 { 452 // log.debug(">" + pklFile + "\t" + output + "\t" + 453 // output2 + "\t" + peptidelist + "\n"); 454 if (pklFile != null && currentHit.getPeakListFile() != pklFile) 455 { 456 // start retrieving all necessary info. 457 // including spectrum for each hit 458 retrieveMZAndTotalIntensity(pklFile, hitList, 459 output, output2, dc); 460 // empty hitList and store the currentHit 461 hitList.clear(); 462 hitList.add(currentHit); 463 pklFile = currentHit.getPeakListFile(); 464 } 465 else 466 { 467 hitList.add(currentHit); 468 pklFile = currentHit.getPeakListFile(); // get the 469 // file name 470 // even if it is the same as before 471 } 472 } 473 else 474 { 475 // log.debug(">2" + pklFile + "\t" + output + "\t" + 476 // output2 + "\t" + peptidelist + "\n"); 450 if (hitit.hasNext()) 451 { 452 // log.debug(">" + pklFile + "\t" + output + "\t" + 453 // output2 + "\t" + peptidelist + "\n"); 454 if (pklFile != null && currentHit.getPeakListFile() != pklFile) 455 { 456 // start retrieving all necessary info. 457 // including spectrum for each hit 477 458 retrieveMZAndTotalIntensity(pklFile, hitList, output, 478 459 output2, dc); 460 // empty hitList and store the currentHit 479 461 hitList.clear(); 480 462 hitList.add(currentHit); 481 } 463 pklFile = currentHit.getPeakListFile(); 464 } 465 else 466 { 467 hitList.add(currentHit); 468 pklFile = currentHit.getPeakListFile(); // get the 469 // file name 470 // even if it is the same as before 471 } 472 } 473 else 474 { 475 // log.debug(">2" + pklFile + "\t" + output + "\t" + 476 // output2 + "\t" + peptidelist + "\n"); 477 retrieveMZAndTotalIntensity(pklFile, hitList, output, 478 output2, dc); 479 hitList.clear(); 480 hitList.add(currentHit); 482 481 } 483 482 } … … 684 683 List<Integer> requestSpectraCharge = new ArrayList<Integer>(); 685 684 List<String> requestSpectraStartPosition = new ArrayList<String>(); 686 DecimalFormatSymbols dfs = 687 DecimalFormat fourDecimals = new DecimalFormat("####.0000", dfs);685 DecimalFormatSymbols dfs = new DecimalFormatSymbols(Locale.US); 686 DecimalFormat fourDecimals = new DecimalFormat("####.0000", dfs); 688 687 // correct only unique ones 689 688 int requestSpectraNr = 0; 690 689 for (Hit phit : peptideHits) 691 690 { 692 // ignore proteins 693 if (!phit.isProtein()) 694 { 695 // make sure the file format and its interface 696 if (!requestSpectraStringID.contains(phit 697 .getSpectrumStringId())) 698 { 699 requestSpectraStringID.add(phit.getSpectrumStringId()); 700 String[] s1 = phit.getDescription().split(" ", 2); 701 requestSpectraSEQ.add(s1[0]); // sequence 702 if (s1.length == 2) 691 // make sure the file format and its interface 692 if (!requestSpectraStringID 693 .contains(phit.getSpectrumStringId())) 694 { 695 requestSpectraStringID.add(phit.getSpectrumStringId()); 696 String[] s1 = phit.getDescription().split(" ", 2); 697 requestSpectraSEQ.add(s1[0]); // sequence 698 if (s1.length == 2) 699 { 700 requestSpectraModification.add(s1[1]); // modification 701 // if any 702 // log.debug(">" + s1[0] + "\t" + s1[1]); 703 } 704 else 705 { 706 requestSpectraModification.add(null); // put 707 // something 708 // so that 709 // the order 710 // is kept 711 // log.debug(">" + s1[0] + "\n"); 712 } 713 // expectation value 714 requestSpectraEXP.add(phit.getExpectationValue()); 715 // combinedFDR 716 requestSpectraFDR.add(phit.getCombinedFDR()); 717 // experimental mass 718 requestSpectraExperimentalMassD.add(phit 719 .getExperimentalMassInDaltons()); 720 // delta mass 721 requestSpectraDeltaMassD.add(phit.getDeltaMassInDaltons()); 722 // charge 723 requestSpectraCharge.add(phit.getCharge()); 724 725 // IPI IDs and get the appropriate Peptide for 726 // positional info for each hit 727 requestSpectraPeaklistFileName.add(phit.getPeakListFile()); 728 String[] s2 = phit.getExternalId().split(","); 729 730 // Start positions 731 String id = null; 732 List<String> idlist = new ArrayList<String>(); 733 if (mgfFormat) 734 { 735 for (int i = 0; i < s2.length; i++) 703 736 { 704 requestSpectraModification.add(s1[1]); // modification 705 // if any 706 // log.debug(">" + s1[0] + "\t" + s1[1]); 737 String id2 = s2[i] + "@" + getStartPosition(s2[i], 738 phit.getDescription(), dc); 739 idlist.add(id2); 740 id = id2; 707 741 } 708 else 709 { 710 requestSpectraModification.add(null); // put 711 // something 712 // so that 713 // the order 714 // is kept 715 // log.debug(">" + s1[0] + "\n"); 716 } 717 // expectation value 718 requestSpectraEXP.add(phit.getExpectationValue()); 719 // combinedFDR 720 requestSpectraFDR.add(phit.getCombinedFDR()); 721 // experimental mass 722 requestSpectraExperimentalMassD.add(phit 723 .getExperimentalMassInDaltons()); 724 // delta mass 725 requestSpectraDeltaMassD.add(phit 726 .getDeltaMassInDaltons()); 727 // charge 728 requestSpectraCharge.add(phit.getCharge()); 729 730 // IPI IDs and get the appropriate Peptide for 731 // positional info for each hit 732 requestSpectraPeaklistFileName.add(phit 733 .getPeakListFile()); 734 String[] s2 = phit.getExternalId().split(","); 735 736 // Start positions 737 String id = null; 738 List<String> idlist = new ArrayList<String>(); 739 if (mgfFormat) 740 { 741 for (int i = 0; i < s2.length; i++) 742 { 743 String id2 = s2[i] + "@" + getStartPosition( 744 s2[i], phit.getDescription(), dc); 745 idlist.add(id2); 746 id = id2; 747 } 748 } 749 requestSpectraNr++; 750 log.debug("Retrieved startpos:" + requestSpectraNr); 751 // log.debug(">query begin\n"); 752 // ItemQuery<Peptide> peptideQuery = Peptide.getQuery(); 753 // peptideQuery.restrict(Restrictions.eq(Hql 754 // .property("sequence"), Expressions 755 // .parameter("sequence"))); 756 // peptideQuery.setParameter("sequence", s1[0], null); 757 // peptideQuery.restrict(Restrictions.eq(Hql 758 // .property("accessionNumber"), Expressions 759 // .parameter("accessionNumber"))); 760 // peptideQuery.setParameter("accessionNumber", ipi, 761 // null); 762 763 // ItemResultIterator<Peptide> pepit = 764 // peptideQuery.iterate(dc); 765 // if (pepit.hasNext()) 766 // { 767 // String id2 = ipi + "@" + 768 // pepit.next().getStartPosition(); 769 // idlist.add(id2); 770 // id = id2; 771 // } 772 // log.debug(">query end\n"); 773 774 requestSpectraExternalID.add(idlist); 775 } 742 } 743 requestSpectraNr++; 744 log.debug("Retrieved startpos:" + requestSpectraNr); 745 // log.debug(">query begin\n"); 746 // ItemQuery<Peptide> peptideQuery = Peptide.getQuery(); 747 // peptideQuery.restrict(Restrictions.eq(Hql 748 // .property("sequence"), Expressions 749 // .parameter("sequence"))); 750 // peptideQuery.setParameter("sequence", s1[0], null); 751 // peptideQuery.restrict(Restrictions.eq(Hql 752 // .property("accessionNumber"), Expressions 753 // .parameter("accessionNumber"))); 754 // peptideQuery.setParameter("accessionNumber", ipi, 755 // null); 756 757 // ItemResultIterator<Peptide> pepit = 758 // peptideQuery.iterate(dc); 759 // if (pepit.hasNext()) 760 // { 761 // String id2 = ipi + "@" + 762 // pepit.next().getStartPosition(); 763 // idlist.add(id2); 764 // id = id2; 765 // } 766 // log.debug(">query end\n"); 767 768 requestSpectraExternalID.add(idlist); 776 769 } 777 770 }
Note: See TracChangeset
for help on using the changeset viewer.