protected Key keyForBioSource(BioSource bioSource) { StringBuilder sb = new StringBuilder(256); sb.append("BioSource:").append(bioSource.getTaxId()); if (bioSource.getCvCellType() != null) { sb.append("|").append(bioSource.getCvCellType().getIdentifier()); } if (bioSource.getCvTissue() != null) { sb.append("|").append(bioSource.getCvTissue().getIdentifier()); } return new Key(sb.toString()); }
private static void displayFoundMessage( BioSource bioSource ) { StringBuffer sb = new StringBuffer( 128 ); sb.append( "Found BioSource by taxid " ).append( bioSource.getTaxId() ); sb.append( ". Shortlabel is " ).append( bioSource.getShortLabel() ); if ( null != bioSource.getCvCellType() ) { sb.append( ", Celltype shortlabel: " ).append( bioSource.getCvCellType().getShortLabel() ); } else { sb.append( ", No CellType" ); } if ( null != bioSource.getCvTissue() ) { sb.append( ", Tissue shortlabel: " ).append( bioSource.getCvTissue().getShortLabel() ); } else { sb.append( ", No Tissue" ); } System.out.println( sb.toString() ); }
public BioSource cloneBioSource(BioSource bioSource) throws IntactClonerException { if (bioSource == null) return null; BioSource clone = new BioSource(); clonerManager.addClone(bioSource, clone); clone.setTaxId(bioSource.getTaxId()); clone.setCvCellType(clone(bioSource.getCvCellType())); clone.setCvTissue(clone(bioSource.getCvTissue())); return clone; }
private SimpleBioSource(BioSource bioSource) { this.label = bioSource.getShortLabel(); this.taxId = bioSource.getTaxId(); }
private void synchronizeBioSource( BioSource bioSource, boolean synchronizeAnnotatedAttributes ) { bioSource.setCvCellType( synchronize( bioSource.getCvCellType() ) ); bioSource.setCvTissue( synchronize( bioSource.getCvTissue() ) ); if (synchronizeAnnotatedAttributes){ synchronizeAnnotatedObjectCommons( bioSource ); } }
final String shortlabel = bs.getShortLabel(); final String fullname = bs.getFullName(); final String taxid = bs.getTaxId(); final CvCellType cellType = bs.getCvCellType(); final CvTissue tissue = bs.getCvTissue(); String log = bs.getAc() + "\t" + bs.getTaxId() + "\t" + bs.getShortLabel() + "\t" + bs.getFullName() + "\t" + (tissue==null?"-":tissue.getShortLabel()) + "\t" + (cellType==null?"-":cellType.getShortLabel()) + "\t"; System.err.println( "WARNING: Biosource with both tissue and cell type set: " + bs.getAc() ); final TaxonomyTerm taxon = taxonomy.getTaxonomyTerm( Integer.parseInt( bs.getTaxId() ) ); if( ! bs.getTaxId().equals(String.valueOf( taxon.getTaxid() ) ) ) { bs.setTaxId( String.valueOf( taxon.getTaxid() ) ); bs.setShortLabel( taxon.getMnemonic().toLowerCase() ); updatedShortlabel = true; } else if( taxon.hasCommonName() ) { bs.setShortLabel( taxon.getCommonName() ); updatedShortlabel = true; bs.setShortLabel( bs.getShortLabel() + '-' + tissue.getShortLabel() );
/** * Search a protein in the cache * * @param id * @param bioSource * * @return */ public static ProteinHolder getProtein( String id, String db, BioSource bioSource ) { String taxid = null; if ( null != bioSource ) { taxid = bioSource.getTaxId(); } // System.out.println( "Search cache using: " + buildID( id, db, taxid ) ); return (ProteinHolder) cache.get( buildID( id, db, taxid ) ); }
String label = null; if ( templateBioSource != null ) { label = templateBioSource.getShortLabel(); } else { label = taxid; BioSource bs = new BioSource( institution, label, taxid ); IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getCurrentInstance(IntactContext.getCurrentInstance()).getBioSourceDao().persist( bs ); bs.setCvTissue( bsTissue ); needUpdate = true; bs.setCvCellType( bsCellType ); needUpdate = true;
/** * Select a BioSource that has neither CvCellType nor CvTissue. * * @param bioSources the Collection of BioSource that potentially contains some having CvCellType or CvTissue. * * @return the unique BioSource that has neither CvCellType nor CvTissue * * @throws BioSourceServiceException if several of such BioSource are found in the database. */ private BioSource getOriginalBioSource( Collection<BioSource> bioSources ) throws BioSourceServiceException { BioSource original = null; for ( BioSource bioSource : bioSources ) { if ( bioSource.getCvTissue() == null && bioSource.getCvCellType() == null ) { if ( original == null ) { // first one is found original = bioSource; } else { // multiple bioSource found String msg = "More than one BioSource with this taxId " + original.getTaxId() + "and CvTissue/CvCellType were found: " + original.getAc() + " and " + "" + bioSource.getAc(); log.error( msg ); throw new BioSourceServiceException( msg ); } } } return original; }
public BioSource getByTaxonIdUnique( String taxonId ) { if ( taxonId == null ) { throw new NullPointerException( "taxonId must not be null." ); } Collection<BioSource> biosources = getByTaxonId( taxonId ); // Get the biosource with null values for cell type and tisse // (there is only one of them exists). for ( BioSource biosrc : biosources ) { if ( ( biosrc.getCvCellType() == null ) && ( biosrc.getCvTissue() == null ) ) { return biosrc; } } // None found. return null; }
public Organism intactToMitab(BioSource organism){ if (organism != null && organism.getTaxId() != null){ Organism mitabOrganism = new OrganismImpl(); String name = organism.getShortLabel(); String fullName = organism.getFullName(); String taxId = organism.getTaxId(); if (name != null){ mitabOrganism.addIdentifier(new CrossReferenceImpl(TAXID, organism.getTaxId(), name)); } if (fullName != null){ mitabOrganism.addIdentifier(new CrossReferenceImpl(TAXID, organism.getTaxId(), fullName)); } return mitabOrganism; } return null; } }
private static void printBiosource( BioSource bs, CvCellType cellType, CvTissue tissue ) { System.out.println( "Updating biosource: " + bs.getShortLabel() + "(taxid: " + bs.getTaxId() + " | CellType: " + (cellType != null ? cellType.getShortLabel() : "-") + " | Tissue: " + (tissue != null ? tissue.getShortLabel() : "-") + " | #alias: "+ bs.getAliases().size() +")" ); }
public BioSource psiToIntact(Organism psiObject) { if (psiObject == null) return null; psiStartConversion(psiObject); int taxId = psiObject.getNcbiTaxId(); BioSource bioSource = new BioSource(); bioSource.setTaxId(String.valueOf(taxId)); bioSource.setOwner(getInstitution()); IntactConverterUtils.populateNames(psiObject.getNames(), bioSource, aliasConverter); // cell type final CellType cellType = psiObject.getCellType(); if (cellType != null) { CvCellType intactCellType = cellTypeConverter.psiToIntact(cellType); bioSource.setCvCellType(intactCellType); } // tissue final Tissue tissue = psiObject.getTissue(); if (tissue != null) { CvTissue intactTissue = tissueConverter.psiToIntact(tissue); bioSource.setCvTissue(intactTissue); } if (psiObject.getCompartment() != null){ log.warn("Organism having a compartment : "+psiObject.getNcbiTaxId()+". Compartment is not converted in IntAct and is ignored."); } psiEndConversion(psiObject); return bioSource; }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("BioSource [ac: ").append(ac).append(", "); sb.append("taxId: ").append(taxId).append(", "); sb.append("shortLabel: ").append(getShortLabel()).append("]"); return sb.toString(); }
String newtTaxid = newtBioSource.getTaxId(); if ( false == bioSource.getTaxId().equals( newtTaxid ) ) { bioSource.setTaxId( newtTaxid ); log.debug( "Obsolete taxid: taxid " + bioSource.getTaxId() + " becomes " + newtTaxid ); needUpdate = true; for ( Iterator iterator = bioSource.getXrefs().iterator(); iterator.hasNext() && foundNewtIdentityXref == false; ) if ( false == xref.getPrimaryId().equals( newtBioSource.getTaxId() ) ) { xref.setPrimaryId( newtBioSource.getTaxId() ); BioSourceXref xref = new BioSourceXref( institution, newt, newtBioSource.getTaxId(), null, null, identity ); bioSource.addXref( xref ); log.info( "update biosource (taxid=" + bioSource.getTaxId() + ")" ); IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getBioSourceDao().update( bioSource );
if (!protein1.getBioSource().equals( biosource2 )) { buffer.append(" Organism="); buffer.append( biosource2.getFullName() ).append( " [NCBI_TaxID=" ).append( biosource2.getTaxId() ).append( "]" ); buffer.append(';');
public BioSource createBioSource(int taxId, String shortLabel) { BioSource bioSource = new BioSource(getInstitution(), shortLabel, String.valueOf(taxId)); CvDatabase newt = createCvObject(CvDatabase.class, CvDatabase.NEWT_MI_REF, CvDatabase.NEWT); BioSourceXref newtXref = createIdentityXref(bioSource, String.valueOf(taxId), newt); bioSource.addXref(newtXref); return bioSource; }
public static String getSpeciesName(InteractionImpl complex) { if (!complex.getExperiments().isEmpty()) { Experiment exp = complex.getExperiments().iterator().next(); BioSource bioSource = exp.getBioSource(); if (bioSource != null) { return bioSource.getFullName() != null ? bioSource.getFullName() : bioSource.getShortLabel(); } } return null; }
BioSource bioSource = new BioSource( institution, term.getCommonName(), String.valueOf( term.getTaxid() ) ); bioSource.setFullName( term.getScientificName() ); bioSource.addXref( xref );
if (interactorBiosource.getTaxId() != null){ if (organism.equals(interactorBiosource.getTaxId())){ interactorsAc.add(interactor.getAc()); report.addWarning("The interactor " + interactor.getAc() + " was matching the name " + name + " but its organism " + interactorBiosource.getAc() + " is not matching " + organism); report.addWarning("The interactor " + interactor.getAc() + " was matching the name " + name + " but its organism ("+interactorBiosource.getAc()+") doesn't have a valid taxId and is not matching " + organism);