Source:
private Map<String, TranscriptModelBuilder> loadTranscriptModels(String pathGFF) throws TranscriptParseException { LOGGER.info("Loading feature records"); GFFParser parser; try { parser = new GFFParser(new File(pathGFF)); } catch (IOException e) { throw new TranscriptParseException("Problem opening GFF file", e); } Map<String, TranscriptModelBuilder> parentIdToTranscriptModels = new HashMap<>(200000); Map<String, List<String>> transcriptIdToParentIds = new HashMap<>(parentIdToTranscriptModels.size()); Set<String> wantedTypes = Sets.newHashSet("exon", "CDS", "stop_codon"); boolean onlyCurated = onlyCurated(); int numRecords = 0; try { FeatureRecord record; while ((record = parser.next()) != null) { numRecords++; String transcriptId = record.getAttributes().get("transcript_id"); if (onlyCurated && (transcriptId != null && transcriptId.startsWith("X"))) { LOGGER.debug("Skipping non-curated transcript {}", transcriptId); continue; } String parentId = record.getAttributes().get("Parent"); if (parentId != null && contigDict.containsKey(record.getSeqID()) && wantedTypes.contains(record.getType())) { if (!parentIdToTranscriptModels.containsKey(parentId)) { TranscriptModelBuilder builder = createNewTranscriptModelBuilder(record, transcriptId); parentIdToTranscriptModels.put(parentId, builder); updateTransciptIdToParentIds(transcriptIdToParentIds, transcriptId, parentId); } else { TranscriptModelBuilder builder = parentIdToTranscriptModels.get(parentId); updateExonsTxRegionsAndCds(record, builder); } } } } catch (IOException e) { throw new TranscriptParseException("Problem parsing GFF file", e); } Map<String, TranscriptModelBuilder> transcriptIdToTranscriptModelBuilders = mapTranscriptIdsToTranscriptModels(parentIdToTranscriptModels, transcriptIdToParentIds); LOGGER.info("Parsed GFF records as TranscriptModels", numRecords, transcriptIdToTranscriptModelBuilders.size()); return transcriptIdToTranscriptModelBuilders; }

Target:
private Map<String, TranscriptModelBuilder> loadTranscriptModels(String pathGFF) throws TranscriptParseException { LOGGER.info("Loading feature records"); GFFParser parser; try { parser = new GFFParser(new File(pathGFF)); } catch (IOException e) { throw new TranscriptParseException("Problem opening GFF file", e); } Map<String, TranscriptModelBuilder> parentIdToTranscriptModels = new HashMap<>(200000); Map<String, List<String>> transcriptIdToParentIds = new HashMap<>(parentIdToTranscriptModels.size()); Set<String> wantedTypes = Sets.newHashSet("exon", "CDS", "stop_codon"); boolean onlyCurated = onlyCurated(); int numRecords = 0; try { FeatureRecord record; while ((record = parser.next()) != null) { numRecords++; String transcriptId = record.getAttributes().get("transcript_id"); if (onlyCurated && transcriptId != null && transcriptId.startsWith("X")) { LOGGER.debug("Skipping non-curated transcript {}", transcriptId); continue; } String parentId = record.getAttributes().get("Parent"); if (parentId != null && contigDict.containsKey(record.getSeqID()) && wantedTypes.contains(record.getType())) { if (!parentIdToTranscriptModels.containsKey(parentId)) { TranscriptModelBuilder builder = createNewTranscriptModelBuilder(record, transcriptId); parentIdToTranscriptModels.put(parentId, builder); updateTransciptIdToParentIds(transcriptIdToParentIds, transcriptId, parentId); } else { TranscriptModelBuilder builder = parentIdToTranscriptModels.get(parentId); updateExonsTxRegionsAndCds(record, builder); } } } } catch (IOException e) { throw new TranscriptParseException("Problem parsing GFF file", e); } Map<String, TranscriptModelBuilder> transcriptIdToTranscriptModelBuilders = mapTranscriptIdsToTranscriptModels(parentIdToTranscriptModels, transcriptIdToParentIds); LOGGER.info("Parsed GFF records as TranscriptModels", numRecords, transcriptIdToTranscriptModelBuilders.size()); return transcriptIdToTranscriptModelBuilders; }