@Test @Transactional(propagation = Propagation.REQUIRES_NEW) public void testBookmarkSearch() throws IOException, InterruptedException, FeatureIndexException { Bookmark bookmark = new Bookmark(); bookmark.setChromosome(testChromosome); bookmark.setStartIndex(1); bookmark.setEndIndex(testChromosome.getSize()); bookmark.setName("testBookmark"); bookmarkManager.create(bookmark); Bookmark loadedBookmark = bookmarkManager.load(bookmark.getId()); Assert.assertNotNull(loadedBookmark); IndexSearchResult<FeatureIndexEntry> result = featureIndexManager.searchFeaturesInProject(bookmark.getName(), testProject.getId()); Assert.assertFalse(result.getEntries().isEmpty()); Assert.assertEquals(result.getEntries().get(0).getFeatureType(), FeatureType.BOOKMARK); Assert.assertNotNull(((BookmarkIndexEntry) result.getEntries().get(0)).getBookmark()); Assert.assertEquals(result.getEntries().size(), result.getTotalResultsCount()); }
public IndexSearchResult searchFeaturesInProject(String featureId, long projectId) throws IOException { if (featureId == null || featureId.length() < 2) { return new IndexSearchResult(Collections.emptyList(), false, 0); } IndexSearchResult<FeatureIndexEntry> bookmarkSearchRes = bookmarkManager.searchBookmarks(featureId, maxFeatureSearchResultsCount); Project project = projectManager.load(projectId); Optional<Reference> opt = project.getItems().stream() .filter(i -> i.getBioDataItem().getFormat() == BiologicalDataItemFormat.REFERENCE) .map(i -> (Reference) i.getBioDataItem()).findFirst(); if (opt.isPresent() && opt.get().getGeneFile() != null) { IndexSearchResult<FeatureIndexEntry> res = featureIndexDao.searchFeatures(featureId, geneFileManager.load(opt.get().getGeneFile().getId()), maxFeatureSearchResultsCount); bookmarkSearchRes.mergeFrom(res); return bookmarkSearchRes; } return bookmarkSearchRes; }
FeatureIndexManager { public IndexSearchResult searchFeaturesInProject(String featureId, long projectId) throws IOException { if (featureId == null || featureId.length() < 2) { return new IndexSearchResult(Collections.emptyList(), false, 0); } IndexSearchResult<FeatureIndexEntry> bookmarkSearchRes = bookmarkManager.searchBookmarks(featureId, maxFeatureSearchResultsCount); Project project = projectManager.load(projectId); Optional<Reference> opt = project.getItems().stream() .filter(i -> i.getBioDataItem().getFormat() == BiologicalDataItemFormat.REFERENCE) .map(i -> (Reference) i.getBioDataItem()).findFirst(); if (opt.isPresent() && opt.get().getGeneFile() != null) { IndexSearchResult<FeatureIndexEntry> res = featureIndexDao.searchFeatures(featureId, geneFileManager.load(opt.get().getGeneFile().getId()), maxFeatureSearchResultsCount); bookmarkSearchRes.mergeFrom(res); return bookmarkSearchRes; } return bookmarkSearchRes; } }
FeatureIndexManager { public IndexSearchResult searchFeaturesInProject(String featureId, long projectId) throws IOException { if (featureId == null || featureId.length() < 2) { return new IndexSearchResult(Collections.emptyList(), false, 0); } IndexSearchResult<FeatureIndexEntry> bookmarkSearchRes = bookmarkManager.searchBookmarks(featureId, maxFeatureSearchResultsCount); Project project = projectManager.load(projectId); Optional<Reference> opt = project.getItems().stream() .filter(i -> i.getBioDataItem().getFormat() == BiologicalDataItemFormat.REFERENCE) .map(i -> (Reference) i.getBioDataItem()).findFirst(); if (opt.isPresent() && opt.get().getGeneFile() != null) { IndexSearchResult<FeatureIndexEntry> res = featureIndexDao.searchFeatures(featureId, geneFileManager.load(opt.get().getGeneFile().getId()), maxFeatureSearchResultsCount); bookmarkSearchRes.mergeFrom(res); return bookmarkSearchRes; } return bookmarkSearchRes; }  }
FeatureIndexManager { public IndexSearchResult searchFeaturesInProject(String featureId, long projectId) throws IOException { if (featureId == null || featureId.length() < 2) { return new IndexSearchResult(Collections.emptyList(), false, 0); } IndexSearchResult<FeatureIndexEntry> bookmarkSearchRes = bookmarkManager.searchBookmarks(featureId, maxFeatureSearchResultsCount); Project project = projectManager.load(projectId); Optional<Reference> opt = project.getItems().stream() .filter(i -> i.getBioDataItem().getFormat() == BiologicalDataItemFormat.REFERENCE) .map(i -> (Reference) i.getBioDataItem()).findFirst(); if (opt.isPresent() && opt.get().getGeneFile() != null) { IndexSearchResult<FeatureIndexEntry> res = featureIndexDao.searchFeatures(featureId, geneFileManager.load(opt.get().getGeneFile().getId()), maxFeatureSearchResultsCount); bookmarkSearchRes.mergeFrom(res); return bookmarkSearchRes; } return bookmarkSearchRes; }  void deleteFromIndexByFileId(final long projectId, List<Pair<FeatureType, Long>> fileIds); Set<String> searchGenesInVcfFilesInProject(long projectId, String gene, List<Long> vcfFileIds); Set<String> searchGenesInVcfFiles(String gene, List<Long> vcfFileIds); List<Chromosome> filterChromosomes(VcfFilterForm filterForm, long projectId); List<Chromosome> filterChromosomes(VcfFilterForm filterForm); IndexSearchResult<VcfIndexEntry> filterVariations(VcfFilterForm filterForm, long projectId); int getTotalPagesCount(VcfFilterForm filterForm); int getTotalPagesCount(VcfFilterForm filterForm, long projectId); List<Group> groupVariations(VcfFilterForm filterForm, long projectId, String groupByField); List<Group> groupVariations(VcfFilterForm filterForm, String groupByField); IndexSearchResult<VcfIndexEntry> filterVariations(VcfFilterForm filterForm); IndexSearchResult searchFeaturesInProject(String featureId, long projectId); IndexSearchResult searchFeaturesByReference(String featureId, long referenceId); VcfFilterInfo loadVcfFilterInfoForProject(long projectId); void buildIndexForFile(FeatureFile featureFile); Set<String> fetchGeneIds(int start, int end, List<GeneFile> geneFiles, Chromosome chromosome); void writeLuceneIndexForFile(final FeatureFile featureFile,
            final List<? extends FeatureIndexEntry> entries,
            VcfFilterInfo vcfFilterInfo); void makeIndexForBedReader(BedFile bedFile, AbstractFeatureReader<NggbBedFeature, LineIterator> reader,
                                      Map<String, Chromosome> chromosomeMap); void makeIndexForVcfReader(VcfFile vcfFile, FeatureReader<VariantContext> reader, List<GeneFile> geneFiles,
                                       Map<String, Chromosome> chromosomeMap, VcfFilterInfo info); void processGeneFile(GeneFile geneFile, final Map<String, Chromosome> chromosomeMap,
            boolean full); void addGeneFeatureToIndex(List<FeatureIndexEntry> allEntries, GeneFeature feature,
                                     Map<String, Chromosome> chromosomeMap); }
FeatureIndexManager { public IndexSearchResult searchFeaturesInProject(String featureId, long projectId) throws IOException { if (featureId == null || featureId.length() < 2) { return new IndexSearchResult(Collections.emptyList(), false, 0); } IndexSearchResult<FeatureIndexEntry> bookmarkSearchRes = bookmarkManager.searchBookmarks(featureId, maxFeatureSearchResultsCount); Project project = projectManager.load(projectId); Optional<Reference> opt = project.getItems().stream() .filter(i -> i.getBioDataItem().getFormat() == BiologicalDataItemFormat.REFERENCE) .map(i -> (Reference) i.getBioDataItem()).findFirst(); if (opt.isPresent() && opt.get().getGeneFile() != null) { IndexSearchResult<FeatureIndexEntry> res = featureIndexDao.searchFeatures(featureId, geneFileManager.load(opt.get().getGeneFile().getId()), maxFeatureSearchResultsCount); bookmarkSearchRes.mergeFrom(res); return bookmarkSearchRes; } return bookmarkSearchRes; }  void deleteFromIndexByFileId(final long projectId, List<Pair<FeatureType, Long>> fileIds); Set<String> searchGenesInVcfFilesInProject(long projectId, String gene, List<Long> vcfFileIds); Set<String> searchGenesInVcfFiles(String gene, List<Long> vcfFileIds); List<Chromosome> filterChromosomes(VcfFilterForm filterForm, long projectId); List<Chromosome> filterChromosomes(VcfFilterForm filterForm); IndexSearchResult<VcfIndexEntry> filterVariations(VcfFilterForm filterForm, long projectId); int getTotalPagesCount(VcfFilterForm filterForm); int getTotalPagesCount(VcfFilterForm filterForm, long projectId); List<Group> groupVariations(VcfFilterForm filterForm, long projectId, String groupByField); List<Group> groupVariations(VcfFilterForm filterForm, String groupByField); IndexSearchResult<VcfIndexEntry> filterVariations(VcfFilterForm filterForm); IndexSearchResult searchFeaturesInProject(String featureId, long projectId); IndexSearchResult searchFeaturesByReference(String featureId, long referenceId); VcfFilterInfo loadVcfFilterInfoForProject(long projectId); void buildIndexForFile(FeatureFile featureFile); Set<String> fetchGeneIds(int start, int end, List<GeneFile> geneFiles, Chromosome chromosome); void writeLuceneIndexForFile(final FeatureFile featureFile,
            final List<? extends FeatureIndexEntry> entries,
            VcfFilterInfo vcfFilterInfo); void makeIndexForBedReader(BedFile bedFile, AbstractFeatureReader<NggbBedFeature, LineIterator> reader,
                                      Map<String, Chromosome> chromosomeMap); void makeIndexForVcfReader(VcfFile vcfFile, FeatureReader<VariantContext> reader, List<GeneFile> geneFiles,
                                       Map<String, Chromosome> chromosomeMap, VcfFilterInfo info); void processGeneFile(GeneFile geneFile, final Map<String, Chromosome> chromosomeMap,
            boolean full); void addGeneFeatureToIndex(List<FeatureIndexEntry> allEntries, GeneFeature feature,
                                     Map<String, Chromosome> chromosomeMap);  }