public GeneratedEntry addInteractorWithUniprotId(String uniprotId) { List<ProteinImpl> interactors = intactContext.getDataContext().getDaoFactory() .getProteinDao().getByUniprotId(uniprotId); if (interactors.isEmpty()) { throw new IntactException("No interactors found with uniprot ID: " + uniprotId); } for (Interactor interactor : interactors) { addInteractor(interactor); } return this; }
public GeneratedEntry addInteractorWithUniprotId(String uniprotId) { List<ProteinImpl> interactors = intactContext.getDataContext().getDaoFactory() .getProteinDao().getByUniprotId(uniprotId); if (interactors.isEmpty()) { throw new IntactException("No interactors found with uniprot ID: " + uniprotId); } for (Interactor interactor : interactors) { addInteractor(interactor); } return this; }
/** * Get a distinct set of Uniprot ID of the protein eligible to export in Swiss-Prot, * using a paginated query to avoid excessive memory usage. The pagination is done before * the selection of the distinct IDs, so the number of results obtained by this query * will be different than the number of maxResults if several rows for the same AC are * returned. * * @param firstResult First result of the page * @param maxResults Maximum number of results. * * @return a distinct set of Uniprot ID of the protein eligible to export in Swiss-Prot. */ public final Set<String> getEligibleProteins(int firstResult, int maxResults) throws SQLException, IntactException, DatabaseContentException { List<ProteinImpl> proteins = IntactContext.getCurrentInstance().getDataContext().getDaoFactory() .getProteinDao().getUniprotProteinsInvolvedInInteractions(firstResult, maxResults); getOut().println( proteins.size() + " UniProt protein(s) found in the database" ); return getEligibleProteins(proteins); }
/** * Get a distinct set of Uniprot ID of the protein eligible to export in Swiss-Prot, * using a paginated query to avoid excessive memory usage. The pagination is done before * the selection of the distinct IDs, so the number of results obtained by this query * will be different than the number of maxResults if several rows for the same AC are * returned. * * @param firstResult First result of the page * @param maxResults Maximum number of results. * * @return a distinct set of Uniprot ID of the protein eligible to export in Swiss-Prot. */ public final Set<String> getEligibleProteins(int firstResult, int maxResults) throws SQLException, DatabaseContentException { List<ProteinImpl> proteins = IntactContext.getCurrentInstance().getDataContext().getDaoFactory() .getProteinDao().getUniprotProteinsInvolvedInInteractions(firstResult, maxResults); getOut().println( proteins.size() + " UniProt protein(s) found in the database" ); return getEligibleProteins(proteins); }
proteins = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getProteinDao().getByAcLike(ac, false); } catch (IntactException e) { e.printStackTrace();
getOut().println("ERROR: The splice variant having the AC(" + protein.getAc() + ") doesn't have it's master AC."); } else { master = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getProteinDao().getByAc(masterAc);
getOut().println("ERROR: The splice variant having the AC(" + protein.getAc() + ") doesn't have it's master AC."); } else { master = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getProteinDao().getByAc(masterAc);
/** * Prints the most counts in the database. * @param ps The printStream to use * * @since 1.9.0 */ public static void printDatabaseCounts(PrintStream ps) { final DaoFactory daoFactory = IntactContext.getCurrentInstance().getDataContext().getDaoFactory(); ps.println("Publications: "+ daoFactory.getPublicationDao().countAll()); ps.println("\tXrefs: "+ daoFactory.getXrefDao(PublicationXref.class).countAll()); ps.println("\tAliases: "+ daoFactory.getAliasDao(PublicationAlias.class).countAll()); ps.println("Experiments: "+ daoFactory.getExperimentDao().countAll()); ps.println("\tXrefs: "+ daoFactory.getXrefDao(ExperimentXref.class).countAll()); ps.println("\tAliases: "+ daoFactory.getAliasDao(ExperimentAlias.class).countAll()); ps.println("Interactors: "+ daoFactory.getInteractorDao().countAll()); ps.println("\tInteractions: "+ daoFactory.getInteractionDao().countAll()); ps.println("\tPolymers: " + daoFactory.getPolymerDao().countAll()); ps.println("\t\tProteins: "+ daoFactory.getProteinDao().countAll()); ps.println("\t\tNucleic Acids: "+ daoFactory.getInteractorDao(NucleicAcidImpl.class).countAll()); ps.println("\tSmall molecules: " + daoFactory.getInteractorDao(SmallMoleculeImpl.class).countAll()); ps.println("\tInteractor Xrefs: "+ daoFactory.getXrefDao(InteractorXref.class).countAll()); ps.println("\tInteractor Aliases: "+ daoFactory.getAliasDao(InteractorAlias.class).countAll()); ps.println("Components: "+ daoFactory.getComponentDao().countAll()); ps.println("Features: "+ daoFactory.getFeatureDao().countAll()); ps.println("\tRanges: "+ daoFactory.getRangeDao().countAll()); ps.println("CvObjects: "+ daoFactory.getCvObjectDao().countAll()); ps.println("BioSources: "+ daoFactory.getBioSourceDao().countAll()); ps.println("Annotations: "+ daoFactory.getAnnotationDao().countAll()); ps.println("Institutions: "+ daoFactory.getInstitutionDao().countAll()); }
/** * Prints the most counts in the database. * @param ps The printStream to use * * @since 1.9.0 */ public static void printDatabaseCounts(PrintStream ps) { final DaoFactory daoFactory = IntactContext.getCurrentInstance().getDataContext().getDaoFactory(); ps.println("Publications: "+ daoFactory.getPublicationDao().countAll()); ps.println("\tXrefs: "+ daoFactory.getXrefDao(PublicationXref.class).countAll()); ps.println("\tAliases: "+ daoFactory.getAliasDao(PublicationAlias.class).countAll()); ps.println("Experiments: "+ daoFactory.getExperimentDao().countAll()); ps.println("\tXrefs: "+ daoFactory.getXrefDao(ExperimentXref.class).countAll()); ps.println("\tAliases: "+ daoFactory.getAliasDao(ExperimentAlias.class).countAll()); ps.println("Interactors: "+ daoFactory.getInteractorDao().countAll()); ps.println("\tInteractions: "+ daoFactory.getInteractionDao().countAll()); ps.println("\tPolymers: " + daoFactory.getPolymerDao().countAll()); ps.println("\t\tProteins: "+ daoFactory.getProteinDao().countAll()); ps.println("\t\tNucleic Acids: "+ daoFactory.getInteractorDao(NucleicAcidImpl.class).countAll()); ps.println("\tSmall molecules: " + daoFactory.getInteractorDao(SmallMoleculeImpl.class).countAll()); ps.println("\tInteractor Xrefs: "+ daoFactory.getXrefDao(InteractorXref.class).countAll()); ps.println("\tInteractor Aliases: "+ daoFactory.getAliasDao(InteractorAlias.class).countAll()); ps.println("Components: "+ daoFactory.getComponentDao().countAll()); ps.println("Features: "+ daoFactory.getFeatureDao().countAll()); ps.println("\tRanges: "+ daoFactory.getRangeDao().countAll()); ps.println("CvObjects: "+ daoFactory.getCvObjectDao().countAll()); ps.println("BioSources: "+ daoFactory.getBioSourceDao().countAll()); ps.println("Annotations: "+ daoFactory.getAnnotationDao().countAll()); ps.println("Institutions: "+ daoFactory.getInstitutionDao().countAll()); }
daoFactory.getProteinDao().update( prot ); accessionsToUpdate.add(accession);
@Test @Rollback(true) public void getByQuery_default() throws Exception { Assert.assertEquals(0, getDaoFactory().getProteinDao().countAll()); Protein prot1 = getMockBuilder().createProtein("A", "prot1"); Protein prot2 = getMockBuilder().createProtein("M", "pr0"); Protein prot3 = getMockBuilder().createProtein("Z", "prot2"); getPersisterHelper().save(prot1, prot2, prot3); SimpleSearchService searchService = new SimpleSearchService(); Collection<ProteinImpl> results = searchService.search(ProteinImpl.class, "prot*", null, null); Assert.assertEquals(2, results.size()); Assert.assertEquals(results.size(), searchService.count(ProteinImpl.class, "prot*")); }
@Test @Rollback(true) public void getByQuery_default() throws Exception { Assert.assertEquals(0, getDaoFactory().getProteinDao().countAll()); Protein prot1 = getMockBuilder().createProtein("A", "prot1"); Protein prot2 = getMockBuilder().createProtein("M", "pr0"); Protein prot3 = getMockBuilder().createProtein("Z", "prot2"); getPersisterHelper().save(prot1, prot2, prot3); SimpleSearchService searchService = new SimpleSearchService(); Collection<ProteinImpl> results = searchService.search(ProteinImpl.class, "prot*", null, null); Assert.assertEquals(2, results.size()); Assert.assertEquals(results.size(), searchService.count(ProteinImpl.class, "prot*")); }
proteins = daoFactory.getProteinDao().getByCrc(CRC64); proteins = daoFactory.getProteinDao().getByCrc(CRC64); proteins = daoFactory.getProteinDao().getByCrcAndTaxId(CRC64, context.getOrganism().getTaxId());
@Test @Rollback(true) public void count_default() throws Exception { Assert.assertEquals(0, getDaoFactory().getProteinDao().countAll()); Protein prot1 = getMockBuilder().createProtein("A", "prot1"); Protein prot2 = getMockBuilder().createProtein("M", "pr0"); Protein prot3 = getMockBuilder().createProtein("Z", "prot2"); getPersisterHelper().save(prot1, prot2, prot3); SimpleSearchService searchService = new SimpleSearchService(); Map<Class<? extends Searchable>,Integer> map = searchService.count(new Class[] {ProteinImpl.class, SmallMolecule.class}, "prot*"); int resultsCount = 0; for (Integer count : map.values()) { resultsCount += count; } Assert.assertEquals(2, resultsCount); }
@Test @Rollback(true) public void count_default() throws Exception { Assert.assertEquals(0, getDaoFactory().getProteinDao().countAll()); Protein prot1 = getMockBuilder().createProtein("A", "prot1"); Protein prot2 = getMockBuilder().createProtein("M", "pr0"); Protein prot3 = getMockBuilder().createProtein("Z", "prot2"); getPersisterHelper().save(prot1, prot2, prot3); SimpleSearchService searchService = new SimpleSearchService(); Map<Class<? extends Searchable>,Integer> map = searchService.count(new Class[] {ProteinImpl.class, SmallMolecule.class}, "prot*"); int resultsCount = 0; for (Integer count : map.values()) { resultsCount += count; } Assert.assertEquals(2, resultsCount); }
@Test @Rollback(true) public void getByQuery_sorted() throws Exception { Assert.assertEquals(0, getDaoFactory().getProteinDao().countAll()); Protein prot1 = getMockBuilder().createProtein("A", "prot1"); Protein prot2 = getMockBuilder().createProtein("M", "pr0"); Protein prot3 = getMockBuilder().createProtein("Z", "prot2"); getPersisterHelper().save(prot1, prot2, prot3); SimpleSearchService searchService = new SimpleSearchService("xrefs.primaryId", false); Collection<ProteinImpl> results = searchService.search(ProteinImpl.class, "pr*", null, null); Assert.assertEquals(3, results.size()); Assert.assertEquals(results.size(), searchService.count(ProteinImpl.class, "pr*")); int i=0; for (ProteinImpl prot : results) { if (i ==0) Assert.assertEquals("prot2", prot.getShortLabel()); // Z if (i ==1) Assert.assertEquals("pr0", prot.getShortLabel()); // M if (i ==2) Assert.assertEquals("prot1", prot.getShortLabel()); // A i++; } }
@Test @Rollback(true) public void getByQuery_sorted() throws Exception { Assert.assertEquals(0, getDaoFactory().getProteinDao().countAll()); Protein prot1 = getMockBuilder().createProtein("A", "prot1"); Protein prot2 = getMockBuilder().createProtein("M", "pr0"); Protein prot3 = getMockBuilder().createProtein("Z", "prot2"); getPersisterHelper().save(prot1, prot2, prot3); SimpleSearchService searchService = new SimpleSearchService("xrefs.primaryId", false); Collection<ProteinImpl> results = searchService.search(ProteinImpl.class, "pr*", null, null); Assert.assertEquals(3, results.size()); Assert.assertEquals(results.size(), searchService.count(ProteinImpl.class, "pr*")); int i=0; for (ProteinImpl prot : results) { if (i ==0) Assert.assertEquals("prot2", prot.getShortLabel()); // Z if (i ==1) Assert.assertEquals("pr0", prot.getShortLabel()); // M if (i ==2) Assert.assertEquals("prot1", prot.getShortLabel()); // A i++; } }