Changeset 4281
- Timestamp:
- Feb 8, 2012, 12:51:13 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/api/core/conf/common-queries.xml
r4280 r4281 243 243 </query> 244 244 245 <query id="GET_HIT_FOR_FEATURE_MSFILE_FOR_PROJECT" type="HQL"> 246 <sql> 247 SELECT h 248 FROM HitData h 249 WHERE h.feature.msFile = :msFile AND h.project = :project 250 </sql> 251 <description> 252 Load all hits which have features with the given msFile in the Feature table for a project 253 </description> 254 </query> 255 245 256 <query id="GET_UNIQUE_MSFILES_IN_FEATURES_FOR_PROJECT" type="HQL"> 246 257 <sql> -
trunk/api/core/src/org/proteios/core/Hit.java
r4269 r4281 28 28 package org.proteios.core; 29 29 30 import org.proteios.core.data.FeatureData;31 30 import org.proteios.core.data.HitData; 32 31 import org.proteios.core.data.ProjectData; … … 35 34 36 35 import java.util.Date; 36 import java.util.Iterator; 37 37 import java.util.List; 38 38 … … 112 112 113 113 @SuppressWarnings("unchecked") 114 public static List<Integer> getUniqueCharges(Project project, 115 DbControl dc) 114 public static List<Integer> getUniqueCharges(Project project, DbControl dc) 116 115 { 117 116 org.hibernate.Query query = HibernateUtil.getPredefinedQuery(dc 118 .getHibernateSession(), 119 "GET_UNIQUE_CHARGES_IN_HITS_FOR_PROJECT"); 117 .getHibernateSession(), "GET_UNIQUE_CHARGES_IN_HITS_FOR_PROJECT"); 120 118 query.setEntity("project", project.getData()); 121 119 return query.list(); … … 124 122 125 123 @SuppressWarnings("unchecked") 126 public static List<String> getUniqueExternalIds(Project project, DbControl dc) 124 public static List<String> getUniqueExternalIds(Project project, 125 DbControl dc) 127 126 { 128 127 org.hibernate.Query query = HibernateUtil.getPredefinedQuery(dc … … 134 133 135 134 135 @SuppressWarnings("unchecked") 136 public static Hit getHitForFeatureMsFile(Project project, File msFile, 137 DbControl dc) 138 { 139 org.hibernate.Query query = HibernateUtil.getPredefinedQuery(dc 140 .getHibernateSession(), "GET_HIT_FOR_FEATURE_MSFILE_FOR_PROJECT"); 141 query.setEntity("project", project.getData()); 142 query.setEntity("msFile", msFile.getData()); 143 Iterator<HitData> hitIt = query.iterate(); 144 if (hitIt.hasNext()) 145 { 146 HitData data = hitIt.next(); 147 return new Hit(data); 148 } 149 return null; 150 } 151 152 136 153 public String getGelExternalId() 137 154 { … … 269 286 270 287 /** 271 * The maximum length of the replicate ID that can be stored in the database. 288 * The maximum length of the replicate ID that can be stored in the 289 * database. 272 290 * 273 291 * @see #setReplicateId(String) … … 771 789 } 772 790 791 773 792 /** 774 793 * Best matching feature, source for precursor quantity … … 776 795 public void setFeature(Feature feature) 777 796 { 778 if (feature !=null)797 if (feature != null) 779 798 { 780 799 getData().setFeature(feature.getData()); … … 785 804 } 786 805 } 787 806 788 807 } -
trunk/client/servlet/src/content/about.html
r4247 r4281 14 14 Fredrik Levander<br> 15 15 Olle Månsson<br> 16 Marianne Sandin<br> 16 17 <span style="color: #777">Gregory Vincic(inactive) Lead developer until 2011-01-01</span><br> 17 18 <br> -
trunk/plugin/src/org/proteios/plugins/HitsComparisonQuantitativeReportPlugin.java
r4265 r4281 617 617 // 618 618 // Get hit selection 1 sequence list 619 //values = (List<?>) job.getValues("hitSelection1Sequence"); 620 //List<String> hitSelection1SequenceList = pruneStringList(values); 621 List<String> hitSelection1SequenceList = Hit.getUniquePeptideSequences(hitSelection1Project, dc); 619 // values = (List<?>) job.getValues("hitSelection1Sequence"); 620 // List<String> hitSelection1SequenceList = 621 // pruneStringList(values); 622 List<String> hitSelection1SequenceList = Hit 623 .getUniquePeptideSequences(hitSelection1Project, dc); 622 624 hitSelection1SequenceList = pruneStringList(hitSelection1SequenceList); 623 625 log … … 625 627 // 626 628 // Get hit selection 1 charge list 627 //values = (List<?>) job.getValues("hitSelection1Charge"); 628 //List<Integer> hitSelection1ChargeList = pruneIntegerList(values); 629 List<Integer> hitSelection1ChargeList = Hit.getUniqueCharges(hitSelection1Project, dc); 629 // values = (List<?>) job.getValues("hitSelection1Charge"); 630 // List<Integer> hitSelection1ChargeList = 631 // pruneIntegerList(values); 632 List<Integer> hitSelection1ChargeList = Hit.getUniqueCharges( 633 hitSelection1Project, dc); 630 634 hitSelection1ChargeList = pruneIntegerList(hitSelection1ChargeList); 631 635 log … … 633 637 // 634 638 // Get hit selection 1 external id list 635 //values = (List<?>) job.getValues("hitSelection1ExternalId"); 636 //List<String> hitSelection1ExternalIdList = pruneStringList(values); 637 List<String> hitSelection1ExternalIdList = Hit.getUniqueExternalIds(hitSelection1Project, dc); 639 // values = (List<?>) job.getValues("hitSelection1ExternalId"); 640 // List<String> hitSelection1ExternalIdList = 641 // pruneStringList(values); 642 List<String> hitSelection1ExternalIdList = Hit 643 .getUniqueExternalIds(hitSelection1Project, dc); 638 644 hitSelection1ExternalIdList = pruneStringList(hitSelection1ExternalIdList); 639 645 log … … 684 690 // 685 691 // Get hit selection 2 sequence list 686 //values = (List<?>) job.getValues("hitSelection2Sequence"); 687 //List<String> hitSelection2SequenceList = pruneStringList(values); 688 List<String> hitSelection2SequenceList = Hit.getUniquePeptideSequences(hitSelection2Project, dc); 692 // values = (List<?>) job.getValues("hitSelection2Sequence"); 693 // List<String> hitSelection2SequenceList = 694 // pruneStringList(values); 695 List<String> hitSelection2SequenceList = Hit 696 .getUniquePeptideSequences(hitSelection2Project, dc); 689 697 hitSelection2SequenceList = pruneStringList(hitSelection2SequenceList); 690 698 log … … 692 700 // 693 701 // Get hit selection 2 charge list 694 //values = (List<?>) job.getValues("hitSelection2Charge"); 695 //List<Integer> hitSelection2ChargeList = pruneIntegerList(values); 696 List<Integer> hitSelection2ChargeList = Hit.getUniqueCharges(hitSelection2Project, dc); 702 // values = (List<?>) job.getValues("hitSelection2Charge"); 703 // List<Integer> hitSelection2ChargeList = 704 // pruneIntegerList(values); 705 List<Integer> hitSelection2ChargeList = Hit.getUniqueCharges( 706 hitSelection2Project, dc); 697 707 hitSelection2ChargeList = pruneIntegerList(hitSelection2ChargeList); 698 708 log … … 700 710 // 701 711 // Get hit selection 2 external id list 702 //values = (List<?>) job.getValues("hitSelection2ExternalId"); 703 //List<String> hitSelection2ExternalIdList = pruneStringList(values); 704 List<String> hitSelection2ExternalIdList = Hit.getUniqueExternalIds(hitSelection2Project, dc); 712 // values = (List<?>) job.getValues("hitSelection2ExternalId"); 713 // List<String> hitSelection2ExternalIdList = 714 // pruneStringList(values); 715 List<String> hitSelection2ExternalIdList = Hit 716 .getUniqueExternalIds(hitSelection2Project, dc); 705 717 hitSelection2ExternalIdList = pruneStringList(hitSelection2ExternalIdList); 706 718 log … … 717 729 // 718 730 // Get quantityVariable (precursorQuantity/totalIntensity) 719 String quantityVariable = (String) job.getValue("quantityVariable"); 731 String quantityVariable = (String) job 732 .getValue("quantityVariable"); 720 733 log.debug("quantityVariable = \"" + quantityVariable + "\""); 721 734 // … … 1124 1137 log.debug("hitSelection2ExternalIdList = " + hcd 1125 1138 .getHitSelection2ExternalIdList()); 1126 log.debug("quantitativeComparison = " + hcd.isQuantitativeComparison()); 1139 log.debug("quantitativeComparison = " + hcd 1140 .isQuantitativeComparison()); 1127 1141 log.debug("comparisonType = \"" + hcd.getComparisonType() + "\""); 1128 1142 log.debug("project = " + hcd.getProject()); 1129 1143 log.debug("comparisonMode = \"" + hcd.getComparisonMode() + "\""); 1130 log.debug("quantityVariable = \"" + hcd.getQuantityVariable() + "\""); 1144 log 1145 .debug("quantityVariable = \"" + hcd.getQuantityVariable() + "\""); 1131 1146 log.debug("quantityEntry = \"" + hcd.getQuantityEntry() + "\""); 1132 1147 log.debug("ignoreFdrCutoff = " + hcd.isIgnoreFdrCutoff()); … … 1223 1238 .println("Hit selection 1 FDR upper cutoff = " + hitSelection1FdrCutoff); 1224 1239 /* 1225 writer1226 .println("Hit selection 1 Sequence list = " + hitSelection1SequenceList);1227 writer1228 .println("Hit selection 1 Charge list = " + hitSelection1ChargeList);1229 writer1230 .println("Hit selection 1 External id list = " +hitSelection1ExternalIdList);1231 */1240 * writer .println("Hit selection 1 Sequence list = " + 1241 * hitSelection1SequenceList); writer 1242 * .println("Hit selection 1 Charge list = " + 1243 * hitSelection1ChargeList); writer 1244 * .println("Hit selection 1 External id list = " + 1245 * hitSelection1ExternalIdList); 1246 */ 1232 1247 writer.println(""); 1233 1248 writer … … 1243 1258 .println("Hit selection 2 FDR upper cutoff = " + hitSelection2FdrCutoff); 1244 1259 /* 1245 writer1246 .println("Hit selection 2 Sequence list = " + hitSelection2SequenceList);1247 writer1248 .println("Hit selection 2 Charge list = " + hitSelection2ChargeList);1249 writer1250 .println("Hit selection 2 External id list = " +hitSelection2ExternalIdList);1251 */1260 * writer .println("Hit selection 2 Sequence list = " + 1261 * hitSelection2SequenceList); writer 1262 * .println("Hit selection 2 Charge list = " + 1263 * hitSelection2ChargeList); writer 1264 * .println("Hit selection 2 External id list = " + 1265 * hitSelection2ExternalIdList); 1266 */ 1252 1267 writer.println(""); 1253 1268 writer … … 1283 1298 hitSelection2FdrCutoff = null; 1284 1299 } 1285 // Reset peptide comparison only parameters if not peptide comparison 1300 // Reset peptide comparison only parameters if not peptide 1301 // comparison 1286 1302 modificationsIncluded = false; 1287 1303 } 1288 1304 else 1289 1305 { 1290 // Reset protein comparison only parameters if not protein comparison 1306 // Reset protein comparison only parameters if not protein 1307 // comparison 1291 1308 ignoreFdrCutoff = false; 1292 1309 scoreType = null; … … 1313 1330 .size()); 1314 1331 // 1315 // Combine sequence lists and charge lists into one list of each type 1332 // Combine sequence lists and charge lists into one list of each 1333 // type 1316 1334 List<String> sequenceList = new ArrayList<String>(); 1317 for (int i =0; i < hitSelection1SequenceList.size(); i++)1335 for (int i = 0; i < hitSelection1SequenceList.size(); i++) 1318 1336 { 1319 1337 String sequence = hitSelection1SequenceList.get(i); 1320 String compareSequence = pruneCompareString(sequence, comparisonType, modificationsIncluded); 1321 if (compareSequence != null && !sequenceList.contains(compareSequence)) 1338 String compareSequence = pruneCompareString(sequence, 1339 comparisonType, modificationsIncluded); 1340 if (compareSequence != null && !sequenceList 1341 .contains(compareSequence)) 1322 1342 { 1323 1343 sequenceList.add(compareSequence); 1324 1344 } 1325 1345 } 1326 for (int i =0; i < hitSelection2SequenceList.size(); i++)1346 for (int i = 0; i < hitSelection2SequenceList.size(); i++) 1327 1347 { 1328 1348 String sequence = hitSelection2SequenceList.get(i); 1329 String compareSequence = pruneCompareString(sequence, comparisonType, modificationsIncluded); 1330 if (compareSequence != null && !sequenceList.contains(compareSequence)) 1349 String compareSequence = pruneCompareString(sequence, 1350 comparisonType, modificationsIncluded); 1351 if (compareSequence != null && !sequenceList 1352 .contains(compareSequence)) 1331 1353 { 1332 1354 sequenceList.add(compareSequence); … … 1338 1360 // 1339 1361 List<Integer> chargeList = new ArrayList<Integer>(); 1340 for (int i =0; i < hitSelection1ChargeList.size(); i++)1362 for (int i = 0; i < hitSelection1ChargeList.size(); i++) 1341 1363 { 1342 1364 Integer charge = hitSelection1ChargeList.get(i); … … 1346 1368 } 1347 1369 } 1348 for (int i =0; i < hitSelection2ChargeList.size(); i++)1370 for (int i = 0; i < hitSelection2ChargeList.size(); i++) 1349 1371 { 1350 1372 Integer charge = hitSelection2ChargeList.get(i); … … 1360 1382 // Combine external id lists into one list 1361 1383 List<String> externalIdList = new ArrayList<String>(); 1362 for (int i =0; i < hitSelection1ExternalIdList.size(); i++)1384 for (int i = 0; i < hitSelection1ExternalIdList.size(); i++) 1363 1385 { 1364 1386 String externalId = hitSelection1ExternalIdList.get(i); … … 1368 1390 } 1369 1391 } 1370 for (int i =0; i < hitSelection2ExternalIdList.size(); i++)1392 for (int i = 0; i < hitSelection2ExternalIdList.size(); i++) 1371 1393 { 1372 1394 String externalId = hitSelection2ExternalIdList.get(i); … … 1387 1409 if (comparisonType.equals("peptide")) 1388 1410 { 1389 writer.println("Hit selection 1 sequence list size (including modifications) = " + hitSelection1SequenceList.size()); 1390 writer.println("Hit selection 2 sequence list size (including modifications) = " + hitSelection2SequenceList.size()); 1391 writer.println("Combined sequence list size = " + sequenceList.size()); 1392 writer.println("Hit selection 1 charge list size = " + hitSelection1ChargeList.size()); 1393 writer.println("Hit selection 2 charge list size = " + hitSelection2ChargeList.size()); 1394 writer.println("Combined charge list size = " + chargeList.size()); 1411 writer 1412 .println("Hit selection 1 sequence list size (including modifications) = " + hitSelection1SequenceList 1413 .size()); 1414 writer 1415 .println("Hit selection 2 sequence list size (including modifications) = " + hitSelection2SequenceList 1416 .size()); 1417 writer 1418 .println("Combined sequence list size = " + sequenceList 1419 .size()); 1420 writer 1421 .println("Hit selection 1 charge list size = " + hitSelection1ChargeList 1422 .size()); 1423 writer 1424 .println("Hit selection 2 charge list size = " + hitSelection2ChargeList 1425 .size()); 1426 writer 1427 .println("Combined charge list size = " + chargeList 1428 .size()); 1395 1429 } 1396 1430 else if (comparisonType.equals("protein")) 1397 1431 { 1398 writer.println("Hit selection 1 external id list size = " + hitSelection1ExternalIdList.size()); 1399 writer.println("Hit selection 2 external id list size = " + hitSelection2ExternalIdList.size()); 1400 writer.println("Combined external id list size = " + externalIdList.size()); 1401 } 1402 writer.println("Hit selection 1 hit list size = " + hitSelection1HitList.size()); 1403 writer.println("Hit selection 2 hit list size = " + hitSelection2HitList.size()); 1432 writer 1433 .println("Hit selection 1 external id list size = " + hitSelection1ExternalIdList 1434 .size()); 1435 writer 1436 .println("Hit selection 2 external id list size = " + hitSelection2ExternalIdList 1437 .size()); 1438 writer 1439 .println("Combined external id list size = " + externalIdList 1440 .size()); 1441 } 1442 writer 1443 .println("Hit selection 1 hit list size = " + hitSelection1HitList 1444 .size()); 1445 writer 1446 .println("Hit selection 2 hit list size = " + hitSelection2HitList 1447 .size()); 1404 1448 writer.println(""); 1405 writer.println("Prefix for local sample id for hit selection 1 = HS1:"); 1406 writer.println("Prefix for local sample id for hit selection 2 = HS2:"); 1449 writer 1450 .println("Prefix for local sample id for hit selection 1 = HS1:"); 1451 writer 1452 .println("Prefix for local sample id for hit selection 2 = HS2:"); 1407 1453 writer.println(""); 1408 1454 // … … 1410 1456 // 1411 1457 String header = fetchTabDelimitedHitTableHeaderForQuantitativeReport( 1412 comparisonType, 1413 hitSelection 1LocalSampleIdList, hitSelection2LocalSampleIdList);1458 comparisonType, hitSelection1LocalSampleIdList, 1459 hitSelection2LocalSampleIdList); 1414 1460 writer.println(header); 1415 1461 // … … 1418 1464 if (comparisonType.equals("peptide")) 1419 1465 { 1420 1421 createQuantitativeReportPeptideTable( 1422 writer, 1423 sequenceList, chargeList, 1424 modificationsIncluded, 1466 1467 createQuantitativeReportPeptideTable(writer, sequenceList, 1468 chargeList, modificationsIncluded, hitSelection1HitList, 1469 hitSelection2HitList, quantityVariable, quantityEntry, 1470 hitSelection1LocalSampleIdList, 1471 hitSelection2LocalSampleIdList); 1472 } 1473 else if (comparisonType.equals("protein")) 1474 { 1475 1476 createQuantitativeReportProteinTable(writer, externalIdList, 1425 1477 hitSelection1HitList, hitSelection2HitList, 1426 1478 quantityVariable, quantityEntry, … … 1428 1480 hitSelection2LocalSampleIdList); 1429 1481 } 1430 else if (comparisonType.equals("protein"))1431 {1432 1433 createQuantitativeReportProteinTable(1434 writer,1435 externalIdList,1436 hitSelection1HitList, hitSelection2HitList,1437 quantityVariable, quantityEntry,1438 hitSelection1LocalSampleIdList,1439 hitSelection2LocalSampleIdList);1440 }1441 1482 // 1442 1483 // Close PrintWriter … … 1451 1492 1452 1493 1453 1454 private void createQuantitativeReportPeptideTable( 1455 PrintWriter writer, 1494 private void createQuantitativeReportPeptideTable(PrintWriter writer, 1456 1495 List<String> sequenceList, List<Integer> chargeList, 1457 Boolean modificationsIncluded, 1458 List<Hit> hitSelection1HitList, List<Hit> hitSelection2HitList, 1459 String quantityVariable, String quantityEntry, 1460 List<String> hitSelection1LocalSampleIdList, 1496 Boolean modificationsIncluded, List<Hit> hitSelection1HitList, 1497 List<Hit> hitSelection2HitList, String quantityVariable, 1498 String quantityEntry, List<String> hitSelection1LocalSampleIdList, 1461 1499 List<String> hitSelection2LocalSampleIdList) 1462 1500 { … … 1466 1504 boolean gelBasedComparison = false; 1467 1505 String comparisonType = new String("peptide"); 1468 for (int i =0; i < sequenceList.size(); i++)1506 for (int i = 0; i < sequenceList.size(); i++) 1469 1507 { 1470 1508 String sequence = sequenceList.get(i); 1471 String compareSequence = pruneCompareString(sequence, comparisonType, modificationsIncluded); 1472 //log.debug("sequenceList: compareSequence = \"" + compareSequence + "\""); 1473 for (Integer charge: chargeList) 1474 { 1475 //log.debug(" chargeList: charge = " + charge); 1476 // Collect hits with current local sample id and charge 1509 String compareSequence = pruneCompareString(sequence, 1510 comparisonType, modificationsIncluded); 1511 // log.debug("sequenceList: compareSequence = \"" + compareSequence 1512 // + "\""); 1513 for (Integer charge : chargeList) 1514 { 1515 // log.debug(" chargeList: charge = " + charge); 1516 // Collect hits with current local sample id and charge 1477 1517 List<Hit> hitList = new ArrayList<Hit>(); 1478 for (Hit hit: hitSelection1HitList) 1479 { 1480 String hitSequence = fetchCompareString(hit, gelBasedComparison, comparisonType, modificationsIncluded); 1518 for (Hit hit : hitSelection1HitList) 1519 { 1520 String hitSequence = fetchCompareString(hit, 1521 gelBasedComparison, comparisonType, 1522 modificationsIncluded); 1481 1523 if (hitSequence.equals(compareSequence)) 1482 1524 { 1483 //log.debug(" hitSelection1HitList: compareSequence = \"" + compareSequence + "\" hitSequence = \"" + hitSequence + "\" hitCharge = " + hit.getCharge()); 1525 // log.debug(" hitSelection1HitList: compareSequence = \"" 1526 // + compareSequence + "\" hitSequence = \"" + 1527 // hitSequence + "\" hitCharge = " + hit.getCharge()); 1484 1528 // Check if charge is selected 1485 if (hit.getCharge() != null && hit.getCharge().equals(charge)) 1529 if (hit.getCharge() != null && hit.getCharge().equals( 1530 charge)) 1486 1531 { 1487 1532 if (!hitList.contains(hit)) … … 1492 1537 } 1493 1538 } 1494 for (Hit hit: hitSelection2HitList) 1495 { 1496 String hitSequence = fetchCompareString(hit, gelBasedComparison, comparisonType, modificationsIncluded); 1539 for (Hit hit : hitSelection2HitList) 1540 { 1541 String hitSequence = fetchCompareString(hit, 1542 gelBasedComparison, comparisonType, 1543 modificationsIncluded); 1497 1544 if (hitSequence.equals(compareSequence)) 1498 1545 { 1499 //log.debug(" hitSelection2HitList: compareSequence = \"" + compareSequence + "\" hitSequence = \"" + hitSequence + "\" hitCharge = " + hit.getCharge()); 1546 // log.debug(" hitSelection2HitList: compareSequence = \"" 1547 // + compareSequence + "\" hitSequence = \"" + 1548 // hitSequence + "\" hitCharge = " + hit.getCharge()); 1500 1549 // Check if charge is selected 1501 if (hit.getCharge() != null && hit.getCharge().equals(charge)) 1550 if (hit.getCharge() != null && hit.getCharge().equals( 1551 charge)) 1502 1552 { 1503 1553 if (!hitList.contains(hit)) … … 1512 1562 { 1513 1563 log.debug(" hitList.size() = " + hitList.size()); 1514 // Check if unique external id value can be found in hit list 1564 // Check if unique external id value can be found in hit 1565 // list 1515 1566 String tmpExternalId = null; 1516 for (Hit hit : hitList)1567 for (Hit hit : hitList) 1517 1568 { 1518 1569 if (hit.getExternalId() != null) … … 1523 1574 tmpExternalId = hit.getExternalId(); 1524 1575 } 1525 // Retain the longest string (most external ids) to avoid singling out proteins at this stage 1526 else if (!hit.getExternalId().equals(tmpExternalId) && hit.getExternalId().length()>tmpExternalId.length()) 1576 // Retain the longest string (most external ids) to 1577 // avoid singling out proteins at this stage 1578 else if (!hit.getExternalId().equals(tmpExternalId) && hit 1579 .getExternalId().length() > tmpExternalId 1580 .length()) 1527 1581 { 1528 1582 tmpExternalId = hit.getExternalId(); … … 1530 1584 } 1531 1585 } 1532 1586 externalId = tmpExternalId; 1533 1587 } 1534 1588 // Print one table row 1535 1589 printQuantitativeReportTableRow(writer, hitList, 1536 hitSelection1HitList, 1537 hitSelection2HitList, 1538 sequence, charge, externalId, 1539 quantityVariable, quantityEntry, 1590 hitSelection1HitList, hitSelection2HitList, sequence, 1591 charge, externalId, quantityVariable, quantityEntry, 1540 1592 hitSelection1LocalSampleIdList, 1541 1593 hitSelection2LocalSampleIdList); … … 1545 1597 1546 1598 1547 private void createQuantitativeReportProteinTable( 1548 PrintWriter writer, 1549 List<String> externalIdList, 1550 List<Hit> hitSelection1HitList, List<Hit> hitSelection2HitList, 1551 String quantityVariable, String quantityEntry, 1552 List<String> hitSelection1LocalSampleIdList, 1599 private void createQuantitativeReportProteinTable(PrintWriter writer, 1600 List<String> externalIdList, List<Hit> hitSelection1HitList, 1601 List<Hit> hitSelection2HitList, String quantityVariable, 1602 String quantityEntry, List<String> hitSelection1LocalSampleIdList, 1553 1603 List<String> hitSelection2LocalSampleIdList) 1554 1604 { … … 1559 1609 String comparisonType = new String("protein"); 1560 1610 Boolean modificationsIncluded = null; 1561 for (int i =0; i < externalIdList.size(); i++)1611 for (int i = 0; i < externalIdList.size(); i++) 1562 1612 { 1563 1613 String externalId = externalIdList.get(i); 1564 // log.debug("externalIdList: externalId = \"" + externalId + "\"");1565 // Collect hits with current external id 1614 // log.debug("externalIdList: externalId = \"" + externalId + "\""); 1615 // Collect hits with current external id 1566 1616 List<Hit> hitList = new ArrayList<Hit>(); 1567 for (Hit hit: hitSelection1HitList) 1568 { 1569 String hitExternalId = fetchCompareString(hit, gelBasedComparison, comparisonType, modificationsIncluded); 1617 for (Hit hit : hitSelection1HitList) 1618 { 1619 String hitExternalId = fetchCompareString(hit, 1620 gelBasedComparison, comparisonType, modificationsIncluded); 1570 1621 if (hitExternalId.equals(externalId)) 1571 1622 { 1572 //log.debug(" hitSelection1HitList: externalId = \"" + externalId + "\" hitExternalId = \"" + hitExternalId + "\""); 1623 // log.debug(" hitSelection1HitList: externalId = \"" + 1624 // externalId + "\" hitExternalId = \"" + hitExternalId + 1625 // "\""); 1573 1626 if (!hitList.contains(hit)) 1574 1627 { … … 1577 1630 } 1578 1631 } 1579 for (Hit hit: hitSelection2HitList) 1580 { 1581 String hitExternalId = fetchCompareString(hit, gelBasedComparison, comparisonType, modificationsIncluded); 1632 for (Hit hit : hitSelection2HitList) 1633 { 1634 String hitExternalId = fetchCompareString(hit, 1635 gelBasedComparison, comparisonType, modificationsIncluded); 1582 1636 if (hitExternalId.equals(externalId)) 1583 1637 { 1584 //log.debug(" hitSelection2HitList: externalId = \"" + externalId + "\" hitExternalId = \"" + hitExternalId + "\""); 1638 // log.debug(" hitSelection2HitList: externalId = \"" + 1639 // externalId + "\" hitExternalId = \"" + hitExternalId + 1640 // "\""); 1585 1641 if (!hitList.contains(hit)) 1586 1642 { … … 1597 1653 boolean isHitSequenceUnique = true; 1598 1654 String tmpSequence = null; 1599 for (Hit hit : hitList)1655 for (Hit hit : hitList) 1600 1656 { 1601 1657 if (hit.getDescription() != null) … … 1620 1676 boolean isHitChargeUnique = true; 1621 1677 Integer tmpCharge = null; 1622 for (Hit hit : hitList)1678 for (Hit hit : hitList) 1623 1679 { 1624 1680 if (hit.getCharge() != null) … … 1643 1699 // Print one table row 1644 1700 printQuantitativeReportTableRow(writer, hitList, 1645 hitSelection1HitList, 1646 hitSelection2HitList, 1647 sequence, charge, externalId, 1648 quantityVariable, quantityEntry, 1649 hitSelection1LocalSampleIdList, 1650 hitSelection2LocalSampleIdList); 1651 } 1652 } 1653 1654 1655 private void printQuantitativeReportTableRow( 1656 PrintWriter writer, List<Hit> hitList, 1657 List<Hit> hitSelection1HitList, 1658 List<Hit> hitSelection2HitList, 1659 String sequence, Integer charge, String externalId, 1660 String quantityVariable, String quantityEntry, 1701 hitSelection1HitList, hitSelection2HitList, sequence, charge, 1702 externalId, quantityVariable, quantityEntry, 1703 hitSelection1LocalSampleIdList, hitSelection2LocalSampleIdList); 1704 } 1705 } 1706 1707 1708 private void printQuantitativeReportTableRow(PrintWriter writer, 1709 List<Hit> hitList, List<Hit> hitSelection1HitList, 1710 List<Hit> hitSelection2HitList, String sequence, Integer charge, 1711 String externalId, String quantityVariable, String quantityEntry, 1661 1712 List<String> hitSelection1LocalSampleIdList, 1662 1713 List<String> hitSelection2LocalSampleIdList) … … 1682 1733 } 1683 1734 sb.append(sequenceStr); 1684 // log.debug(" sequence = " + sequence);1735 // log.debug(" sequence = " + sequence); 1685 1736 // 1686 1737 // Charge … … 1692 1743 sb.append("\t"); 1693 1744 sb.append(chargeStr); 1694 // log.debug(" charge = " + charge);1745 // log.debug(" charge = " + charge); 1695 1746 // 1696 1747 // External Id … … 1702 1753 sb.append("\t"); 1703 1754 sb.append(externalIdStr); 1704 // log.debug(" hit.getExternalID() = " + hit.getExternalId());1755 // log.debug(" hit.getExternalID() = " + hit.getExternalId()); 1705 1756 // 1706 1757 // Hit selection 1 local sample id values 1707 for (int j =0; j < hitSelection1LocalSampleIdList.size(); j++)1758 for (int j = 0; j < hitSelection1LocalSampleIdList.size(); j++) 1708 1759 { 1709 1760 String localSampleId = hitSelection1LocalSampleIdList.get(j); 1710 //log.debug(" hitSelection1: hitSelection1LocalSampleIdList.get(" + j + ") = \"" + hitSelection1LocalSampleIdList.get(j)); 1761 // log.debug(" hitSelection1: hitSelection1LocalSampleIdList.get(" 1762 // + j + ") = \"" + hitSelection1LocalSampleIdList.get(j)); 1711 1763 Double columnValue = null; 1712 1764 int columnEntries = 0; 1713 for (Hit hit: hitList) 1714 { 1715 if (hit.getLocalSampleId().equals(localSampleId) 1716 && hitSelection1HitList.contains(hit)) 1717 { 1718 Double newValue = fetchHitQuantityValue(hit, quantityVariable); 1765 for (Hit hit : hitList) 1766 { 1767 if (hit.getLocalSampleId().equals(localSampleId) && hitSelection1HitList 1768 .contains(hit)) 1769 { 1770 Double newValue = fetchHitQuantityValue(hit, 1771 quantityVariable); 1719 1772 // Check if new value is valid 1720 1773 if (newValue != null) 1721 1774 { 1722 1775 columnEntries++; 1723 columnValue = updateColumnValue(columnValue, newValue, quantityEntry); 1776 columnValue = updateColumnValue(columnValue, newValue, 1777 quantityEntry); 1724 1778 } 1725 1779 } … … 1729 1783 if (columnValue != null) 1730 1784 { 1731 columnValueStr = 1785 columnValueStr = new String("" + columnValue); 1732 1786 ssa.addValue(columnValue); 1733 1787 } … … 1742 1796 // 1743 1797 // Hit selection 2 local sample id values 1744 for (int j =0; j < hitSelection2LocalSampleIdList.size(); j++)1798 for (int j = 0; j < hitSelection2LocalSampleIdList.size(); j++) 1745 1799 { 1746 1800 String localSampleId = hitSelection2LocalSampleIdList.get(j); 1747 //log.debug(" hitSelection2: hitSelection2LocalSampleIdList.get(" + j + ") = \"" + hitSelection2LocalSampleIdList.get(j)); 1801 // log.debug(" hitSelection2: hitSelection2LocalSampleIdList.get(" 1802 // + j + ") = \"" + hitSelection2LocalSampleIdList.get(j)); 1748 1803 Double columnValue = null; 1749 1804 int columnEntries = 0; 1750 for (Hit hit: hitList) 1751 { 1752 if (hit.getLocalSampleId().equals(localSampleId) 1753 && hitSelection2HitList.contains(hit)) 1754 { 1755 Double newValue = fetchHitQuantityValue(hit, quantityVariable); 1805 for (Hit hit : hitList) 1806 { 1807 if (hit.getLocalSampleId().equals(localSampleId) && hitSelection2HitList 1808 .contains(hit)) 1809 { 1810 Double newValue = fetchHitQuantityValue(hit, 1811 quantityVariable); 1756 1812 // Check if new value is valid 1757 1813 if (newValue != null) 1758 1814 { 1759 1815 columnEntries++; 1760 columnValue = updateColumnValue(columnValue, newValue, quantityEntry); 1816 columnValue = updateColumnValue(columnValue, newValue, 1817 quantityEntry); 1761 1818 } 1762 1819 } … … 1766 1823 if (columnValue != null) 1767 1824 { 1768 columnValueStr = 1825 columnValueStr = new String("" + columnValue); 1769 1826 ssb.addValue(columnValue); 1770 1827 } … … 1786 1843 if (ssb.getN() > 0 && ssb.getMean() != 0) 1787 1844 { 1788 ratio = ssa.getMean() /ssb.getMean();1845 ratio = ssa.getMean() / ssb.getMean(); 1789 1846 ratioStr = new String("" + ratio); 1790 1847 } … … 1794 1851 ratioStr = new String("-"); 1795 1852 } 1796 //log.debug("ssa.getN() = " + ssa.getN() + " ssa.getMean() = " + ssa.getMean()); 1797 //log.debug("ssb.getN() = " + ssb.getN() + " ssb.getMean() = " + ssb.getMean()); 1798 //log.debug(" ratio = " + ratio + " ratioStr = \"" + ratioStr + "\""); 1853 // log.debug("ssa.getN() = " + ssa.getN() + " ssa.getMean() = " + 1854 // ssa.getMean()); 1855 // log.debug("ssb.getN() = " + ssb.getN() + " ssb.getMean() = " + 1856 // ssb.getMean()); 1857 // log.debug(" ratio = " + ratio + " ratioStr = \"" + ratioStr + 1858 // "\""); 1799 1859 sb.append("\t"); 1800 1860 sb.append(ratioStr); … … 1850 1910 else 1851 1911 { 1852 log.error("quantityVariable value unknown = \"" + quantityVariable + "\""); 1912 log 1913 .error("quantityVariable value unknown = \"" + quantityVariable + "\""); 1853 1914 } 1854 1915 // Return quantity value for hit … … 1858 1919 1859 1920 /** 1860 * Updates a column value with a new entry, 1861 * if the new value differs fromnull.1921 * Updates a column value with a new entry, if the new value differs from 1922 * null. 1862 1923 * 1863 1924 * @param columnValue Double Current column value to be updated. 1864 1925 * @param newValue Double The new value to add, if a valid entry. 1865 * @param quantityEntry String Specification of how the update the column value. 1926 * @param quantityEntry String Specification of how the update the column 1927 * value. 1866 1928 * @return Double The possibly updated column value. 1867 1929 */ 1868 private Double updateColumnValue(Double columnValue, 1869 Double newValue,String quantityEntry)1930 private Double updateColumnValue(Double columnValue, Double newValue, 1931 String quantityEntry) 1870 1932 { 1871 1933 // Update current column value with new data value … … 1900 1962 else 1901 1963 { 1902 log.error("quantityEntry value unknown = \"" + quantityEntry + "\""); 1964 log 1965 .error("quantityEntry value unknown = \"" + quantityEntry + "\""); 1903 1966 } 1904 1967 } … … 2140 2203 * @param comparisonType String A string indicating protein/peptide 2141 2204 * comparison type. 2142 * @param modificationsIncluded Flag indicating that modifications 2143 * should beincluded for peptide comparison type.2205 * @param modificationsIncluded Flag indicating that modifications should be 2206 * included for peptide comparison type. 2144 2207 */ 2145 2208 private String fetchCompareString(Hit hit, boolean gelBasedComparison, … … 2164 2227 hitCompareStr = hit.getDescription(); 2165 2228 } 2166 hitCompareStr = pruneCompareString(hitCompareStr, comparisonType, modificationsIncluded); 2229 hitCompareStr = pruneCompareString(hitCompareStr, comparisonType, 2230 modificationsIncluded); 2167 2231 } 2168 2232 return hitCompareStr; … … 2176 2240 * @param comparisonType String A string indicating protein/peptide 2177 2241 * comparison type. 2178 * @param modificationsIncluded Flag indicating that modifications 2179 * should beincluded for peptide comparison type.2242 * @param modificationsIncluded Flag indicating that modifications should be 2243 * included for peptide comparison type. 2180 2244 */ 2181 private String pruneCompareString(String compareStr, 2182 String comparisonType,Boolean modificationsIncluded)2245 private String pruneCompareString(String compareStr, String comparisonType, 2246 Boolean modificationsIncluded) 2183 2247 { 2184 2248 if (comparisonType != null && comparisonType.equals("peptide")) … … 2220 2284 * 2221 2285 * @param comparisonType String Comparison type used (protein or peptide). 2222 * @param hitSelection1LocalSampleIdList List<String> Hit selection 1 local sample id list. 2223 * @param hitSelection2LocalSampleIdList List<String> Hit selection 2 local sample id list. 2224 * @return String The tab-delimited hit table header string for quantitative report. 2286 * @param hitSelection1LocalSampleIdList List<String> Hit selection 1 local 2287 * sample id list. 2288 * @param hitSelection2LocalSampleIdList List<String> Hit selection 2 local 2289 * sample id list. 2290 * @return String The tab-delimited hit table header string for quantitative 2291 * report. 2225 2292 */ 2226 2293 private String fetchTabDelimitedHitTableHeaderForQuantitativeReport( 2227 String comparisonType, 2228 List<String> hitSelection 1LocalSampleIdList, List<String> hitSelection2LocalSampleIdList)2294 String comparisonType, List<String> hitSelection1LocalSampleIdList, 2295 List<String> hitSelection2LocalSampleIdList) 2229 2296 { 2230 2297 StringBuilder sb = new StringBuilder(); … … 2250 2317 // 2251 2318 // Hit selection 1 local sample id values 2252 for (int i =0; i < hitSelection1LocalSampleIdList.size(); i++)2319 for (int i = 0; i < hitSelection1LocalSampleIdList.size(); i++) 2253 2320 { 2254 2321 String localSampleId = hitSelection1LocalSampleIdList.get(i); … … 2264 2331 // 2265 2332 // Hit selection 2 local sample id values 2266 for (int i =0; i < hitSelection2LocalSampleIdList.size(); i++)2333 for (int i = 0; i < hitSelection2LocalSampleIdList.size(); i++) 2267 2334 { 2268 2335 String localSampleId = hitSelection2LocalSampleIdList.get(i); … … 2300 2367 * @return String Constructed timestamp string. 2301 2368 */ 2302 public String fetchTimestamp(Calendar inputCal, int secondsToAdd)2369 public static String fetchTimestamp(Calendar inputCal, int secondsToAdd) 2303 2370 { 2304 2371 String timestamp = fetchTimestamp(inputCal, secondsToAdd, null, null, … … 2330 2397 * @return String Constructed timestamp string. 2331 2398 */ 2332 public String fetchTimestamp(Calendar inputCal, int secondsToAdd,2399 public static String fetchTimestamp(Calendar inputCal, int secondsToAdd, 2333 2400 Boolean includeDatePart, Boolean includeTimePart, 2334 2401 Boolean includeSeconds, String dateElementSeparator, … … 2429 2496 * 'minChars' characters. 2430 2497 */ 2431 private String leftPaddedString(String inStr, int minChars, char padChar) 2498 private static String leftPaddedString(String inStr, int minChars, 2499 char padChar) 2432 2500 { 2433 2501 String startStr = null;
Note: See TracChangeset
for help on using the changeset viewer.