protected boolean areInteractionsEqual(Interaction source, Interaction target) { CrcCalculator calculator = new CrcCalculator(); return calculator.crc64(source).equals(calculator.crc64(target)); }
public int compare(CvObject o1, CvObject o2) { return createUniquenessString(o1).toString() .compareTo(createUniquenessString(o2).toString()); } }
protected UniquenessStringBuilder createUniquenessString(Annotation annotation) { if (keyExists(annotation)) { UniquenessStringBuilder builder = getKey(annotation); if (builder != null){ return builder; } else{ identityToCrc.remove(System.identityHashCode(annotation)); } } UniquenessStringBuilder sb = new UniquenessStringBuilder(); putKey(annotation, sb); if (annotation == null) return sb; sb.append(createUniquenessString(annotation.getCvTopic())); sb.append(annotation.getAnnotationText()); return sb; }
protected UniquenessStringBuilder createUniquenessString(CvObject cvObject) { if (keyExists(cvObject)) { UniquenessStringBuilder builder = getKey(cvObject); if (builder != null){ return builder; } else{ identityToCrc.remove(System.identityHashCode(cvObject)); } } UniquenessStringBuilder sb = new UniquenessStringBuilder(); putKey(cvObject, sb); if (cvObject == null) return sb; // psi-mi String miIdentifier = cvObject.getIdentifier(); if (miIdentifier != null) { sb.append(miIdentifier); } else { sb.append(cvObject.getShortLabel()); } return sb; }
protected UniquenessStringBuilder createUniquenessString(Annotation annotation) { if (keyExists(annotation)) { UniquenessStringBuilder builder = getKey(annotation); if (builder != null){ return builder; } else{ identityToCrc.remove(System.identityHashCode(annotation)); } } UniquenessStringBuilder sb = new UniquenessStringBuilder(); putKey(annotation, sb); if (annotation == null) return sb; sb.append(createUniquenessString(annotation.getCvTopic())); sb.append(annotation.getAnnotationText()); return sb; }
protected UniquenessStringBuilder createUniquenessString(CvObject cvObject) { if (keyExists(cvObject)) { UniquenessStringBuilder builder = getKey(cvObject); if (builder != null){ return builder; } else{ identityToCrc.remove(System.identityHashCode(cvObject)); } } UniquenessStringBuilder sb = new UniquenessStringBuilder(); putKey(cvObject, sb); if (cvObject == null) return sb; // psi-mi String miIdentifier = cvObject.getIdentifier(); if (miIdentifier != null) { sb.append(miIdentifier); } else { sb.append(cvObject.getShortLabel()); } return sb; }
protected UniquenessStringBuilder createUniquenessString(BioSource bioSource) { if (keyExists(bioSource)) { UniquenessStringBuilder builder = getKey(bioSource); if (builder != null){ return builder; } else{ identityToCrc.remove(System.identityHashCode(bioSource)); } } UniquenessStringBuilder sb = new UniquenessStringBuilder(); putKey(bioSource, sb); if (bioSource == null) return sb; // tax id sb.append(bioSource.getTaxId()); // tissue sb.append(createUniquenessString(bioSource.getCvTissue())); // cell type sb.append(createUniquenessString(bioSource.getCvCellType())); return sb; }
protected boolean areInteractionsEqual(Interaction source, Interaction target) { CrcCalculator calculator = new CrcCalculator(); return calculator.crc64(source).equals(calculator.crc64(target)); }
public int compare(Component o1, Component o2) { return createUniquenessString(o1).toString() .compareTo(createUniquenessString(o2).toString()); } }
protected UniquenessStringBuilder createUniquenessString(BioSource bioSource) { if (keyExists(bioSource)) { UniquenessStringBuilder builder = getKey(bioSource); if (builder != null){ return builder; } else{ identityToCrc.remove(System.identityHashCode(bioSource)); } } UniquenessStringBuilder sb = new UniquenessStringBuilder(); putKey(bioSource, sb); if (bioSource == null) return sb; // tax id sb.append(bioSource.getTaxId()); // tissue sb.append(createUniquenessString(bioSource.getCvTissue())); // cell type sb.append(createUniquenessString(bioSource.getCvCellType())); return sb; }
protected Key keyForInteraction(Interaction interaction) { final Key key = new Key(new CrcCalculator().crc64(interaction)); // pre-calculate the keys for the components here and put them in a map int n = 0; for (Component component : interaction.getComponents()) { Key compKey = new Key(key.getUniqueString() + ":" + component.getShortLabel() + "[" + n + "]"); keyCache.put(Component.class.getSimpleName() + ":" + System.identityHashCode(component), compKey); n++; } return key; }
public int compare(Range o1, Range o2) { return createUniquenessString(o1).toString() .compareTo(createUniquenessString(o2).toString()); } }
protected UniquenessStringBuilder createUniquenessString(Range range) { if (keyExists(range)) { UniquenessStringBuilder builder = getKey(range); if (builder != null){ return builder; } else{ identityToCrc.remove(System.identityHashCode(range)); } } UniquenessStringBuilder sb = new UniquenessStringBuilder(); putKey(range, sb); if (range == null) return sb; // type from sb.append(createUniquenessString(range.getFromCvFuzzyType())); // interval from sb.append(range.getFromIntervalStart() + "-" + range.getFromIntervalEnd()); // type to sb.append(createUniquenessString(range.getToCvFuzzyType())); // interval end sb.append(range.getToIntervalStart() + "-" + range.getToIntervalEnd()); return sb; }
/** * Finds an interaction based on its properties. * * @param interaction the object we are searching an AC for. * @return an AC or null if it couldn't be found. */ protected String findAcForInteraction( Interaction interaction ) { CrcCalculator crcCalculator = new CrcCalculator(); String interactionCrc = crcCalculator.crc64( interaction ); Query query = getEntityManager().createQuery("select i.ac from InteractionImpl i where i.crc = :crc"); query.setParameter("crc", interactionCrc); Set<String> acs = new HashSet<String>(query.getResultList()); if (acs.isEmpty()) { return null; } if (acs.size() > 1) { log.error("More than one interaction found using the CRC ("+interactionCrc+"). Returning the first one"); } return acs.iterator().next(); }
public int compare(CvObject o1, CvObject o2) { return createUniquenessString(o1).toString() .compareTo(createUniquenessString(o2).toString()); } }
protected UniquenessStringBuilder createUniquenessString(Range range) { if (keyExists(range)) { UniquenessStringBuilder builder = getKey(range); if (builder != null){ return builder; } else{ identityToCrc.remove(System.identityHashCode(range)); } } UniquenessStringBuilder sb = new UniquenessStringBuilder(); putKey(range, sb); if (range == null) return sb; // type from sb.append(createUniquenessString(range.getFromCvFuzzyType())); // interval from sb.append(range.getFromIntervalStart() + "-" + range.getFromIntervalEnd()); // type to sb.append(createUniquenessString(range.getToCvFuzzyType())); // interval end sb.append(range.getToIntervalStart() + "-" + range.getToIntervalEnd()); return sb; }
/** * Finds an interaction based on its properties. * * @param interaction the object we are searching an AC for. * @return an AC or null if it couldn't be found. */ protected String findAcForInteraction( Interaction interaction ) { CrcCalculator crcCalculator = new CrcCalculator(); String interactionCrc = crcCalculator.crc64( interaction ); Query query = getEntityManager().createQuery("select i.ac from InteractionImpl i where i.crc = :crc"); query.setParameter("crc", interactionCrc); Set<String> acs = new HashSet<String>(query.getResultList()); if (acs.isEmpty()) { return null; } if (acs.size() > 1) { log.error("More than one interaction found using the CRC ("+interactionCrc+"). Returning the first one"); } return acs.iterator().next(); }
public int compare(Feature o1, Feature o2) { return createUniquenessString(o1).toString() .compareTo(createUniquenessString(o2).toString()); } }