protected Signature createSignature(String accession, String name, String description, SignatureLibraryRelease release, StringBuffer modelBuffer) { Model model = new Model(accession, name, description); modelBuffer.delete(0, modelBuffer.length()); return new Signature(accession, name, null, description, null, release, Collections.singleton(model)); }
/** * Returns key to use in, for example, HashMap. * TODO - Check if it is the correct decision to make this transient. * * @return Key to use in, for example, HashMap. */ @Transient @XmlTransient public String getKey() { // TODO: Use name, accession or MD5 as model key? return getAccession(); }
@Override public int hashCode() { return new HashCodeBuilder(19, 41) .append(accession) .append(name) .append(getSafeMd5(md5)) .append(getDescription()) .append(getDefinition()) .toHashCode(); }
public Model(String accession, String name, String description, String definition) { setAccession(accession); setName(name); setDescription(description); setDefinition(definition); }
public Model(String accession, String name, String description) { setAccession(accession); setName(name); setDescription(description); }
public Model build() { Model model = new Model(accession, name, description, definition); model.setSignature(signature); model.setMd5(md5); return model; }
public Model addModel(Model model) throws IllegalArgumentException { if (model == null) { throw new IllegalArgumentException("'Model' must not be null"); } if (model.getSignature() != null) { model.getSignature().removeModel(model); } model.setSignature(this); models.put(model.getKey(), model); return model; }
private Hmmer3MatchWithSites getMatch(Signature signature, Model model, String modelId, Map<String, Set<T>> matchesByModel, List<E> rawSites) { assert modelId.equals(model.getAccession()); Set<Hmmer3MatchWithSites.Hmmer3LocationWithSites> locations = new HashSet<>(); double score = 0, evalue = 0; for (T m : matchesByModel.get(modelId)) { // Score and evalue should be the same (repeated for each location) score = m.getScore(); evalue = m.getEvalue(); int hmmLength = model.getLength(); locations.add(getLocation(m, rawSites, hmmLength)); } return new Hmmer3MatchWithSites(signature, modelId, score, evalue, locations); }
public void removeModel(Model model) { models.remove(model.getKey()); model.setSignature(null); }
@Override public String toString() { return new ToStringBuilder(this) .append("accession", accession) .append("name", name) .append("description", getDescription()) .append("definition", getDefinition()) .append("signature-ac", (signature == null ? null : signature.getAccession())) .append("md5", md5) .toString(); }
public Model(String accession) { setAccession(accession); }
/** * Map XML type to Java */ @Override public Map<String, Model> unmarshal(ModelsType modelsType) { Map<String, Model> map = new HashMap<String, Model>(); for (Model m : modelsType.getModels()) { map.put(m.getKey(), m); } return map; }
final SignatureModelHolder holder = modelIdToSignatureMap.get(rawMatch.getModelId()); Model model = holder.getModel(); int hmmLength = model == null ? 0 : model.getLength();
/** * Creates and returns an instance of signature. */ private Signature createSignature(String accession, String name, SignatureLibraryRelease release) { Model model = new Model(accession, name, null); //TODO Also populate hmmLength from the panther.hmm now? Maybe for PANTHER 13.0+ return new Signature(accession, name, null, null, null, release, Collections.singleton(model)); } }
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Model)) return false; final Model m = (Model) o; return new EqualsBuilder() .append(accession, m.accession) .append(name, m.name) .append(getSafeMd5(md5), getSafeMd5(m.md5)) .append(getDescription(), m.getDescription()) .append(getDefinition(), m.getDefinition()) .isEquals(); }
Signature signature = (Signature) row[0]; Model model = (Model) row[1]; result.put(model.getAccession(), new SignatureModelHolder(signature, model)); modelCount ++; if (result.get(model.getAccession()) == null){ LOGGER.warn("SignatureModelHolder ERROR: model.getAccession(): " + model.getAccession() + " signature: " + signature);
/** * Creates and returns an instance of signature. */ private Signature createSignature(String accession, String name, SignatureLibraryRelease release) { Model model = new Model(accession, name, null); return new Signature(accession, name, null, null, null, release, Collections.singleton(model)); } }
private Signature createSignature(String accession, String name, String description, SignatureLibraryRelease release) { Model model = new Model(accession, name, description, null); return new Signature(accession, name, null, description, null, release, Collections.singleton(model)); } }
private Signature createSignature(String accession, String name, String description, SignatureLibraryRelease release) { Model model = new Model(accession, name, description); return new Signature(accession, name, null, description, null, release, Collections.singleton(model)); } }
protected Signature createSignature(String accession, String name, String description, SignatureLibraryRelease release, StringBuffer modelBuffer) { Model model = new Model(accession, name, description, null); modelBuffer.delete(0, modelBuffer.length()); return new Signature(accession, name, null, description, null, release, Collections.singleton(model)); }