Changeset 3912
- Timestamp:
- Oct 21, 2010, 3:10:49 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/plugin/src/org/proteios/plugins/ProteiosProteinAssembly.java
r3910 r3912 141 141 }; 142 142 private int label_index = 0; 143 143 private List<String> problems = new ArrayList<String>(); 144 144 145 145 public ProteiosProteinAssembly() … … 614 614 .write("" + f.getId() + " - " + f.getName() + "\n"); 615 615 } 616 } 617 if (!problems.isEmpty()) 618 { 619 output.write("WARNING!!! Problems in report generation:\n"); 620 for (String s:problems) 621 { 622 output.write(s+"\n"); 623 } 624 output.write("======================================\n"); 616 625 } 617 626 output … … 1167 1176 protein.scores.add(peptide.getExpectationValue()); 1168 1177 } 1169 if (prot.getTotalIntensity() !=null && peptide.getTotalIntensity()!=null)1178 if (prot.getTotalIntensity() != null && peptide.getTotalIntensity() != null) 1170 1179 { 1171 1180 prot.setTotalIntensity(prot.getTotalIntensity() + peptide 1172 .getTotalIntensity());1181 .getTotalIntensity()); 1173 1182 } 1174 1183 log.debug("Added sequence to protein"); … … 1323 1332 .debug("Spectrum:" + requestSpectraNr + ", id:" + nextSpectrum); 1324 1333 SpectrumInterface spec = specit.next(); 1325 double[] intensities = spec.listIntensities(); 1326 double[] mzs = spec.listMass(); 1327 /* 1328 * If the mz values starts higher than the labels we might have 1329 * to check in the next spectrum in the special case of mixed 1330 * CID and HCD spectra...Only try this for mzData files. 1331 */ 1332 if (checknext && (hcdOnly || (mzs[0] > reporterMasses[label_index][reporterMasses[label_index].length - 1]))) 1333 { 1334 if (spec.getPrecursors() != null && spec.getPrecursors() 1335 .size() > 0 && (pklFile.getFileType().getSystemId() 1336 .equals(FileType.MZDATA) || pklFile.getFileType() 1337 .getSystemId().equals(FileType.MZML))) 1338 { 1339 if (spec.getPrecursors().get(0).getFragmentationType() == FragmentationType.CID) 1340 { 1341 log 1342 .debug("Checking next spectrum for spectrum id:" + nextSpectrum); 1343 needNewCheck = true; 1344 try 1334 double[] reporterInt = new double[reporterMasses[label_index].length]; 1335 double[] reporterMz = new double[reporterMasses[label_index].length]; 1336 if (spec != null) 1337 { 1338 double[] intensities = spec.listIntensities(); 1339 double[] mzs = spec.listMass(); 1340 /* 1341 * If the mz values starts higher than the labels we might 1342 * have to check in the next spectrum in the special case of 1343 * mixed CID and HCD spectra...Only try this for mzData 1344 * files. 1345 */ 1346 if (checknext && (hcdOnly || (mzs[0] > reporterMasses[label_index][reporterMasses[label_index].length - 1]))) 1347 { 1348 if (spec.getPrecursors() != null && spec 1349 .getPrecursors().size() > 0 && (pklFile 1350 .getFileType().getSystemId() 1351 .equals(FileType.MZDATA) || pklFile.getFileType() 1352 .getSystemId().equals(FileType.MZML))) 1353 { 1354 if (spec.getPrecursors().get(0) 1355 .getFragmentationType() == FragmentationType.CID) 1345 1356 { 1346 nextSpectrum = String.valueOf(Integer 1347 .parseInt(nextSpectrum) + 1); 1348 } 1349 catch (NumberFormatException e) 1350 { 1351 if (nextSpectrum.contains("scan=")) 1357 log 1358 .debug("Checking next spectrum for spectrum id:" + nextSpectrum); 1359 needNewCheck = true; 1360 try 1352 1361 { 1353 String oldScan = nextSpectrum 1354 .substring(nextSpectrum 1355 .indexOf("scan=") + "scan=" 1356 .length()); 1357 if (oldScan.contains(" ")) 1362 nextSpectrum = String.valueOf(Integer 1363 .parseInt(nextSpectrum) + 1); 1364 } 1365 catch (NumberFormatException e) 1366 { 1367 if (nextSpectrum.contains("scan=")) 1358 1368 { 1359 oldScan = oldScan.substring(0, oldScan 1360 .indexOf(" ")); 1369 String oldScan = nextSpectrum 1370 .substring(nextSpectrum 1371 .indexOf("scan=") + "scan=" 1372 .length()); 1373 if (oldScan.contains(" ")) 1374 { 1375 oldScan = oldScan.substring(0, 1376 oldScan.indexOf(" ")); 1377 } 1378 String newScan = Integer 1379 .toString(Integer.parseInt(oldScan) + 1); 1380 nextSpectrum = nextSpectrum.replace( 1381 oldScan, newScan); 1382 log 1383 .debug("Next spectrum id:" + nextSpectrum); 1361 1384 } 1362 String newScan = Integer.toString(Integer1363 .parseInt(oldScan) + 1);1364 nextSpectrum = nextSpectrum.replace(1365 oldScan, newScan);1366 log1367 .debug("Next spectrum id:" + nextSpectrum);1368 1385 } 1369 1386 } 1370 } 1371 else if (spec.getPrecursors().get(0) 1372 .getFragmentationType() == FragmentationType.HCD) 1373 { 1374 log.debug("HCD spectrum:" + nextSpectrum); 1375 } 1376 } 1377 } 1378 double[] reporterInt = new double[reporterMasses[label_index].length]; 1379 double[] reporterMz = new double[reporterMasses[label_index].length]; 1380 for (int i = 0; i < mzs.length; i++) 1381 { 1382 for (int j = 0; j < reporterMasses[label_index].length; j++) 1383 { 1384 if (Math.abs(reporterMasses[label_index][j] - mzs[i]) < matchTolerance) 1385 { 1386 // Use the closest match (Maybe better with most 1387 // intense?) 1387 else if (spec.getPrecursors().get(0) 1388 .getFragmentationType() == FragmentationType.HCD) 1389 { 1390 log.debug("HCD spectrum:" + nextSpectrum); 1391 } 1392 } 1393 } 1394 1395 for (int i = 0; i < mzs.length; i++) 1396 { 1397 for (int j = 0; j < reporterMasses[label_index].length; j++) 1398 { 1388 1399 if (Math 1389 .abs(reporterMasses[label_index][j] - mzs[i]) < Math 1390 .abs(reporterMz[j] - reporterMasses[label_index][j])) 1400 .abs(reporterMasses[label_index][j] - mzs[i]) < matchTolerance) 1391 1401 { 1392 reporterMz[j] = mzs[i]; 1393 reporterInt[j] = intensities[i]; 1402 // Use the closest match (Maybe better with most 1403 // intense?) 1404 if (Math 1405 .abs(reporterMasses[label_index][j] - mzs[i]) < Math 1406 .abs(reporterMz[j] - reporterMasses[label_index][j])) 1407 { 1408 reporterMz[j] = mzs[i]; 1409 reporterInt[j] = intensities[i]; 1410 } 1394 1411 } 1395 1412 } 1396 1413 } 1414 } 1415 else 1416 { 1417 String prob="Couldn't retrieve reporters from spectrum:" + nextSpectrum + "from file:"+pklFile.getName(); 1418 problems.add(prob); 1419 log.warn(prob); 1397 1420 } 1398 1421 String reporterString = new String();
Note: See TracChangeset
for help on using the changeset viewer.