/*** * This method will copy properties of organism source in organism target and will override all the other properties of Target organism. * @param source * @param target */ public static void copyAndOverrideOrganismProperties(Organism source, Organism target){ if (source != null && target != null){ target.setCommonName(source.getCommonName()); target.setScientificName(source.getScientificName()); target.setCellType(source.getCellType()); target.setTissue(source.getTissue()); target.setCompartment(source.getCompartment()); target.setTaxId(source.getTaxId()); // copy collections target.getAliases().clear(); target.getAliases().addAll(source.getAliases()); } } }
CvTerm cellType1 = organism1.getCellType(); CvTerm cellType2 = organism2.getCellType(); CvTerm tissue1 = organism1.getTissue(); CvTerm tissue2 = organism2.getTissue(); CvTerm compartment1 = organism1.getCompartment(); CvTerm compartment2 = organism2.getCompartment();
writer.write(Integer.toString(organism.getTaxId())); if (organism.getCommonName() != null){ writer.write("("); escapeAndWriteString(organism.getCommonName()); writer.write(")"); if (organism.getScientificName() != null){ writer.write(MitabUtils.FIELD_SEPARATOR); writer.write(MitabUtils.TAXID); writer.write(MitabUtils.XREF_SEPARATOR); writer.write(Integer.toString(organism.getTaxId())); writer.write("("); escapeAndWriteString(organism.getScientificName()); writer.write(")"); else if (organism.getScientificName() != null){ writer.write("("); escapeAndWriteString(organism.getScientificName()); writer.write(")");
/** * * @param organism * @return the hashcode consistent with the equals method for this comparator */ public static int hashCode(Organism organism){ if (unambiguousOrganismComparator == null){ unambiguousOrganismComparator = new UnambiguousOrganismComparator(); } if (organism == null){ return 0; } int hashcode = 31; hashcode = 31*hashcode + organism.getTaxId(); CvTerm cellType = organism.getCellType(); hashcode = 31*hashcode + UnambiguousCvTermComparator.hashCode(cellType); CvTerm tissue = organism.getTissue(); hashcode = 31*hashcode + UnambiguousCvTermComparator.hashCode(tissue); CvTerm compartment = organism.getCompartment(); hashcode = 31*hashcode + UnambiguousCvTermComparator.hashCode(compartment); return hashcode; } }
/** * Maps the provided protein to a uniprot identifier. * @param proteinToMap the protein to be Mapped */ public void map(Protein proteinToMap) throws BridgeFailedException { if(proteinToMap == null){ throw new IllegalArgumentException("Cannot remap a null protein"); } clear(); IdentificationContext context = new IdentificationContext(); if( proteinToMap.getOrganism() != null ) context.setOrganism(new BioSource(proteinToMap.getOrganism().getCommonName() != null ? proteinToMap.getOrganism().getCommonName() : "not specified", Integer.toString(proteinToMap.getOrganism().getTaxId()))); if(priorityIdentifiers == prioritySequence) mapWithBothPriorities(proteinToMap, context); else if(priorityIdentifiers) mapWithPriorityToIdentifiers(proteinToMap, context); else if(prioritySequence) mapWithPriorityToSequence(proteinToMap, context); }
public static psidev.psi.mi.jami.model.Organism createOrganismFromEntry(UniProtEntry entity){ if(entity.getNcbiTaxonomyIds() == null || entity.getNcbiTaxonomyIds().isEmpty()){ return OrganismUtils.createUnknownOrganism(); } else if(entity.getNcbiTaxonomyIds().size() > 1){ throw new IllegalArgumentException( "Uniprot entry ["+entity.getPrimaryUniProtAccession().getValue()+"] " +"has multiple organisms."); } else { String id = entity.getNcbiTaxonomyIds().get(0).getValue(); try{ psidev.psi.mi.jami.model.Organism o = new DefaultOrganism( Integer.parseInt( id ) ); if(entity.getOrganism().hasCommonName()) o.setCommonName(entity.getOrganism().getCommonName().getValue()); if(entity.getOrganism().getScientificName() != null) o.setScientificName(entity.getOrganism().getScientificName().getValue()); if(entity.getOrganism().hasSynonym()) o.getAliases().add(AliasUtils.createAlias(Alias.SYNONYM, Alias.SYNONYM_MI, entity.getOrganism().getSynonym().getValue())); return o; }catch(NumberFormatException n){ throw new IllegalArgumentException("Uniprot entry ["+entity.getPrimaryUniProtAccession().getValue()+"] " + "has a TaxonomyID which could not be cast to an integer: ("+id+").",n); } } } }
public void onCommonNameUpdate(Organism organism, String oldCommonName) { if (oldCommonName == null){ organismChangeListener.log(Level.INFO, "The common name has been initialised for the organism " + organism.toString()); } else if (organism.getCommonName() == null){ organismChangeListener.log(Level.INFO, "The common name has been reset for the organism " + organism.toString()); } else { organismChangeListener.log(Level.INFO, "The common name "+oldCommonName+" has been updated with " + organism.getCommonName() + " in the organism " + organism.toString()); } }
case -1: organism = new DefaultOrganism( -1 ); organism.setScientificName( "In vitro" ); organism.setCommonName( "In vitro" ); return organism; case -2: organism = new DefaultOrganism( -2 ); organism.setScientificName( "Chemical synthesis" ); organism.setCommonName( "Chemical synthesis" ); return organism; case -3: organism = new DefaultOrganism( -3 ); organism.setScientificName( "Unknown" ); organism.setCommonName( "Unknown" ); return organism; case -4: organism = new DefaultOrganism( -4 ); organism.setScientificName( "In vivo" ); organism.setCommonName( "In vivo" ); return organism; case -5: organism = new DefaultOrganism( -5 ); organism.setScientificName( "In Silico" ); organism.setCommonName( "In Silico" ); return organism; default:
public void onCellTypeUpdate(Organism organism, CvTerm oldType) { if (oldType == null){ organismChangeListener.log(Level.INFO, "The cell type has been initialised for the organism " + organism.toString()); } else if (organism.getCellType() == null){ organismChangeListener.log(Level.INFO, "The cell type has been reset for the organism " + organism.toString()); } else { organismChangeListener.log(Level.INFO, "The cell type "+oldType.toString()+" has been replaced with " + organism.getCellType().toString() + " in the organism " + organism.toString()); } }
public void onTissueUpdate(Organism organism, CvTerm oldType) { if (oldType == null){ organismChangeListener.log(Level.INFO, "The tissue has been initialised for the organism " + organism.toString()); } else if (organism.getTissue() == null){ organismChangeListener.log(Level.INFO, "The tissue has been reset for the organism " + organism.toString()); } else { organismChangeListener.log(Level.INFO, "The tissue "+oldType.toString()+" has been replaced with " + organism.getTissue().toString() + " in the organism " + organism.toString()); } }
public void onScientificNameUpdate(Organism organism, String oldScientificName) { if (oldScientificName == null){ organismChangeListener.log(Level.INFO, "The scientific name has been initialised for the organism " + organism.toString()); } else if (organism.getScientificName() == null){ organismChangeListener.log(Level.INFO, "The scientific name has been reset for the organism " + organism.toString()); } else { organismChangeListener.log(Level.INFO, "The scientific name "+oldScientificName+" has been updated with " + organism.getScientificName() + " in the organism " + organism.toString()); } }
private void checkOrganism(Collection<ValidatorMessage> messages, Organism o, Object parent, String label ) throws ValidatorException { // run the organism specialized rules Collection<ValidatorMessage> organismMessages = (this.organismRuleWrapper.check(o)); // validate with other rules if any if (!getObjectRules().isEmpty()){ messages.addAll(super.validate(o)); } // add context for (ValidatorMessage message : organismMessages){ ((MiContext)message.getContext()).addAssociatedContext(RuleUtils.buildContext(parent, label)); messages.add(message); } // validate aliases for (Alias alias : o.getAliases()){ checkAlias(messages, alias, o, "organism"); } }
public void onCompartmentUpdate(Organism organism, CvTerm oldType) { if (oldType == null){ organismChangeListener.log(Level.INFO, "The compartment has been initialised for the organism " + organism.toString()); } else if (organism.getCompartment() == null){ organismChangeListener.log(Level.INFO, "The compartment has been reset for the organism " + organism.toString()); } else { organismChangeListener.log(Level.INFO, "The compartment "+oldType.toString()+" has been replaced with " + organism.getCompartment().toString() + " in the organism " + organism.toString()); } }
public void write(Organism object) throws IOException { MIJsonUtils.writeStartObject(writer); MIJsonUtils.writeProperty("taxid", Integer.toString(object.getTaxId()), writer); if (object.getCommonName() != null){ MIJsonUtils.writeSeparator(writer); MIJsonUtils.writeProperty("common", JSONValue.escape(object.getCommonName()), writer); } if (object.getScientificName() != null){ MIJsonUtils.writeSeparator(writer); MIJsonUtils.writeProperty("scientific", JSONValue.escape(object.getScientificName()), writer); } writeOtherProperties(object); MIJsonUtils.writeEndObject(writer); }
public void onTaxidUpdate(Organism organism, String oldTaxid) { organismChangeListener.log(Level.INFO, "The taxid "+oldTaxid+" has been updated with " + organism.getTaxId() + " in the organism " + organism.toString()); }
CvTerm cellType1 = organism1.getCellType(); CvTerm cellType2 = organism2.getCellType(); CvTerm tissue1 = organism1.getTissue(); CvTerm tissue2 = organism2.getTissue(); CvTerm compartment1 = organism1.getCompartment(); CvTerm compartment2 = organism2.getCompartment();
if (organism.getCellType() == null){ return Collections.EMPTY_LIST; CvTerm cellType = organism.getCellType();
/** * * @param organism * @return the hashcode consistent with the equals method for this comparator */ public static int hashCode(Organism organism){ if (organismTaxIdComparator == null){ organismTaxIdComparator = new OrganismTaxIdComparator(); } if (organism == null){ return 0; } int hashcode = 31; hashcode = 31*hashcode + organism.getTaxId(); return hashcode; } }