/** * 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; }
log.debug( "Could not find Biosource having taxid: " + taxid ); } else { log.debug( "Found 1 biosource: " + biosource.getShortLabel() + " [" + biosource.getAc() + "]" );
/** * Search the IntAct database and retreive a BioSource having the given taxid and no CvCellType or CvTissue. * * @param taxid a non null taxid. * @return a BioSource or null if none is found. */ private BioSource searchIntactByTaxid(String taxid) throws BioSourceServiceException { log.debug("Searching in the database for BioSource(" + taxid + ")"); DataContext dataContext = IntactContext.getCurrentInstance().getDataContext(); TransactionStatus transactionStatus = dataContext.beginTransaction(); BioSourceDao bsDao = dataContext.getDaoFactory().getBioSourceDao(); BioSource biosource = bsDao.getByTaxonIdUnique(taxid); try { dataContext.commitTransaction(transactionStatus); } catch (IntactTransactionException e) { throw new BioSourceServiceException("Problem committing", e); } if (log.isDebugEnabled()) { if (biosource == null) { log.debug("Could not find Biosource having taxid: " + taxid); } else { log.debug("Found 1 biosource: " + biosource.getShortLabel() + " [" + biosource.getAc() + "]"); } } return biosource; }
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);