private void setCrossReferences(Set<ProteinXref> crossReferences) { for (ProteinXref ProteinXref : crossReferences) { addCrossReference(ProteinXref); } }
/** * Utility method to add a List of cross references * * @param accessions */ public void addCrossReferences(String... accessions) { for (String accession : accessions) { addCrossReference(new ProteinXref(accession)); } }
public Protein build() { Protein protein = new Protein(sequence); if (!matches.isEmpty()) { for (Match m : matches) { protein.addMatch(m); } } if (!crossReferences.isEmpty()) { for (ProteinXref x : crossReferences) { protein.addCrossReference(x); } } return protein; }
protected void addToMoleculeCollection(String sequence, final String currentId, final Set<Protein> parsedMolecules) { sequence = WHITE_SPACE_PATTERN.matcher(sequence).replaceAll(""); Protein thisProtein = new Protein(sequence); // Check if this sequence is already in the Set. If it is, retrieve it. boolean isMoleculeAdded = parsedMolecules.add(thisProtein); if (!isMoleculeAdded) { for (Protein existing : parsedMolecules) { if (existing.getMd5().equals(thisProtein.getMd5())) { thisProtein = existing; break; } } } // Add the Xref to the Protein object. (Being added to a Set, so no risk of duplicates) thisProtein.addCrossReference(XrefParser.getProteinXref(currentId)); } }
/** * This method stores sequences with (optionally) cross references. * The method attempts to store them in batches by calling the addProteinToBatch(Protein protein) * method. This in turn calls persistBatch(), when the batch size has been reached. * <p/> * * @param sequence being the protein sequence to store * @param crossReferences being a set of Cross references. */ public void store(String sequence, Map<String, SignatureLibraryRelease> analysisJobMap, String... crossReferences) { if (sequence != null && sequence.length() > 0) { Protein protein = new Protein(sequence); if (crossReferences != null) { for (String crossReference : crossReferences) { ProteinXref xref = XrefParser.getProteinXref(crossReference); protein.addCrossReference(xref); } } proteinsAwaitingPrecalcLookup.add(protein); if (proteinsAwaitingPrecalcLookup.size() > proteinPrecalcLookupBatchSize) { lookupProteins(analysisJobMap); } } }
LOGGER.trace("Adding " + xref.getIdentifier() + " and setting updateRequired = true"); existingProtein.addCrossReference(xref); updateRequired = true;