public void store(String sequence, Map<String, SignatureLibraryRelease> analysisJobMap, String... crossReferences) { if (sequence != null && sequence.length() > 0) { NucleotideSequence nucleotideSequence = new NucleotideSequence(sequence); if (crossReferences != null) { for (String crossReference : crossReferences) { NucleotideSequenceXref xref = XrefParser.getNucleotideSequenceXref(crossReference); nucleotideSequence.addCrossReference(xref); } } else { LOGGER.error("Have a nucleotide sequence with no associated Xrefs. There must be at least one xref associated with the nucleotide sequence"); } sequencesAwaitingInsertion.add(nucleotideSequence); if (sequencesAwaitingInsertion.size() > sequenceInsertBatchSize) { persistBatch(); } } }
protected void addToMoleculeCollection(String sequence, String currentId, Set<NucleotideSequence> parsedMolecules) { sequence = WHITE_SPACE_PATTERN.matcher(sequence).replaceAll(""); NucleotideSequence thisMolecule = new NucleotideSequence(sequence); // Check if this sequence is already in the Set. If it is, retrieve it. boolean alreadyExists = false; for (NucleotideSequence existing : parsedMolecules) { if (existing.getMd5().equals(thisMolecule.getMd5())) { thisMolecule = existing; alreadyExists = true; break; } } // New sequence - add it to the collection. if (!alreadyExists) { parsedMolecules.add(thisMolecule); } // Add the identifier to the Protein object. (Being added to a Set, so no risk of duplicates) thisMolecule.addCrossReference(XrefParser.getNucleotideSequenceXref(currentId)); } }
existingSequence.addCrossReference(xref); updateRequired = true;