Changeset 4277
- Timestamp:
- Jan 24, 2012, 9:51:45 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/plugin/src/org/proteios/plugins/TandemImportPlugin.java
r4261 r4277 133 133 { 134 134 return new AboutImpl("X!Tandem results importer", 135 "SpectrumSearch import from X!Tandem xml", "1. 01",136 "2006-20 09, Protein Technology, Lund University", null, null,135 "SpectrumSearch import from X!Tandem xml", "1.1", 136 "2006-2011, Protein Technology, Lund University", null, null, 137 137 "http://www.proteios.org "); 138 138 } … … 318 318 hit.setMatchedPeaks(new Integer(0)); 319 319 hit.setRMSError(new Float(0.0)); 320 } 321 else if (hit.getDescription().contains("@")) 322 { 323 removeFixedMod(hit, ss); 320 324 } 321 325 } … … 381 385 382 386 387 private void removeFixedMod(AHit hit, SpectrumSearch ss) 388 // This function will remove fixed modifications from the hit description. 389 { 390 String desc = hit.getDescription(); 391 for (SearchModification sm : ss.getSearchModifications()) 392 { 393 if (sm.isFixed()) 394 { 395 log.debug("Checking for " + sm.getName()); 396 if (desc.contains("@" + sm.getAminoAcidSpecificity())) 397 { 398 String[] parts = hit.getDescription().split(" "); 399 String newdesc = parts[0]; 400 boolean writeDelta = false; 401 for (int i = 1; i < parts.length; i++) 402 { 403 if (parts[i].contains("@")) 404 { 405 int index = parts[i].indexOf('@'); 406 float mass = Float.parseFloat(parts[i].substring(0, 407 index)); 408 String aa = parts[i] 409 .substring(index + 1, index + 2); 410 if (sm.getAminoAcidSpecificity().contains(aa) && Math 411 .abs(mass - sm.getMonoisotopicDeltaMass()) < 0.0002) 412 {} 413 else 414 { 415 newdesc += " " + parts[i]; 416 writeDelta = true; 417 } 418 } 419 else if (writeDelta && parts[i].startsWith("delta:")) 420 { 421 newdesc += " " + parts[i]; 422 } 423 } 424 log.debug("Old desc:" + desc + " new desc:" + newdesc); 425 desc = newdesc; 426 hit.setDescription(desc); 427 } 428 } 429 } 430 } 431 432 383 433 public String getInputFileName() 384 434 { … … 787 837 public ProgressReporter progress; 788 838 private AHit current_protein; 789 private int current_spectrum_id, current_charge; 839 private int current_spectrum_id, current_charge, current_start; 840 private float delta = 0; 790 841 private AHit current_peptide; 791 842 private StringBuffer buffer = null; … … 867 918 current_peptide.setDescription(sequence); 868 919 current_peptide.setExternalId(current_accession); 920 current_start = Integer.valueOf(attrs.getValue(attrs 921 .getIndex("start"))); 869 922 // Does this peptide result exist? 870 923 boolean existed = false; … … 899 952 .valueOf(exp_mass)); 900 953 current_peptide.setCharge(Integer.valueOf(current_charge)); 954 delta = current_peptide.getScore() - Float.parseFloat(attrs 955 .getValue(attrs.getIndex("nextscore"))); 901 956 peptide_results.add(current_peptide); 902 957 } … … 905 960 { 906 961 // om.setPosition(Integer.valueOf(attrs.getValue(attrs.getIndex("at"))).intValue()); 962 int pos = Integer.valueOf(attrs.getValue(attrs.getIndex("at"))) - current_start + 1; 907 963 String modifiedAminoAcid = attrs.getValue(attrs 908 964 .getIndex("modified")) + "@" + attrs.getValue( 909 attrs.getIndex("type")).charAt(0); 965 attrs.getIndex("type")).charAt(0) + "" + pos; 966 log 967 .debug("Sequence:" + current_peptide.getDescription() + " current_start:" + current_start + " pos:" + pos + " mod:" + modifiedAminoAcid); 910 968 current_peptide 911 969 .setDescription(current_peptide.getDescription() + " " + modifiedAminoAcid); … … 948 1006 throws SAXException 949 1007 { 950 if (qName.equals("score_record")) 951 { 952 // spectrumSearch.addSearchResult(current_result); 953 // current_result.addPolyPeptide(current_protein); 1008 if (qName.equals("domain")) 1009 { 1010 if (current_peptide.getDescription().contains("@") && !current_peptide 1011 .getDescription().contains("delta:")) 1012 { 1013 current_peptide.setDescription(current_peptide 1014 .getDescription() + " delta:" + delta); 1015 } 954 1016 } 955 1017 else if (qName.equals("note") && !inside_parameters)
Note: See TracChangeset
for help on using the changeset viewer.