| 224 | |
| 225 | 9) Create the archive that will be read by GRITS |
| 226 | a) Populate the Scan Feature object |
| 227 | {{{ |
| 228 | protected void populateScanFeatureData(String glycanFilesPath) { |
| 229 | //define objects to gather the MS1 annotation while processing MS2 |
| 230 | AnnotationReader reader = new AnnotationReader(); // instantiate the reader, which will read the temp files created in Step 8 |
| 231 | GlycanScansAnnotation glycanAnnotation = new GlycanScansAnnotation(); |
| 232 | ScanFeatures scanFeatures = new ScanFeatures(); |
| 233 | for(Integer scanId : getTestData().getScans().keySet()){ |
| 234 | if( isCanceled() ) |
| 235 | return; |
| 236 | scanFeatures = new ScanFeatures(); // Create new ScanFeatures object to add features to the scan if it was annotated |
| 237 | scanFeatures.setScanId(scanId); |
| 238 | scanFeatures.setScanPeaks(new HashSet<Peak>(getTestData().getScans().get(scanId).getPeaklist())); |
| 239 | getTestData().getScanFeatures().put(scanId, scanFeatures); |
| 240 | if(getTestData().getAnnotatedScan().get(scanId) != null) { // this scan was annotated |
| 241 | for(String glycanId : getTestData().getAnnotatedScan().get(scanId)){ |
| 242 | glycanAnnotation = reader.readglycanAnnotation(glycanFilesPath, glycanId); // read the temp file for this particular glycan |
| 243 | if(glycanAnnotation != null && glycanAnnotation.getScanAnnotations().get(scanId) != null) { |
| 244 | for( GlycanFeature f : glycanAnnotation.getScanAnnotations().get(scanId) ) { |
| 245 | if( ! scanFeatures.getFeatures().contains(f) ) { |
| 246 | scanFeatures.getFeatures().add(f); // add each unique GlycanFeature (from ScanAnnotations) to the ScanFeatures list of features |
| 247 | } |
| 248 | } |
| 249 | } |
| 250 | } |
| 251 | } |
| 252 | } |
| 253 | } |
| 254 | }}} |