@Test(expected = IllegalArgumentException.class) @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) public void testUnregisterVcfFile() throws IOException, InterruptedException, NoSuchAlgorithmException, VcfReadingException { Resource resource = context.getResource(CLASSPATH_TEMPLATES_FELIS_CATUS_VCF); FeatureIndexedFileRegistrationRequest request = new FeatureIndexedFileRegistrationRequest(); request.setReferenceId(referenceId); request.setPath(resource.getFile().getAbsolutePath()); VcfFile vcfFile = vcfManager.registerVcfFile(request); Assert.assertNotNull(vcfFile); Assert.assertNotNull(vcfFile.getId()); VcfFile deletedVcfFile = vcfManager.unregisterVcfFile(vcfFile.getId()); Assert.assertNotNull(vcfFile); Assert.assertNotNull(vcfFile.getId()); Assert.assertEquals(vcfFile.getId(), deletedVcfFile.getId()); List<BiologicalDataItem> indexItems = biologicalDataItemDao.loadBiologicalDataItemsByIds( Arrays.asList(vcfFile.getIndex().getId(), vcfFile.getBioDataItemId())); Assert.assertTrue(indexItems.isEmpty()); testLoad(vcfFile, 1D, false); request = new FeatureIndexedFileRegistrationRequest(); request.setReferenceId(referenceIdGA4GH); request.setType(BiologicalDataItemResourceType.GA4GH); request.setPath(varSet); VcfFile vcfFileGA4GH = vcfManager.registerVcfFile(request); vcfFileGA4GH.setType(BiologicalDataItemResourceType.GA4GH); Assert.assertNotNull(vcfFileGA4GH); Assert.assertNotNull(vcfFileGA4GH.getId()); deletedVcfFile = vcfManager.unregisterVcfFile(vcfFileGA4GH.getId()); Assert.assertNotNull(vcfFileGA4GH); Assert.assertNotNull(vcfFileGA4GH.getId()); Assert.assertEquals(vcfFileGA4GH.getId(), deletedVcfFile.getId()); indexItems = biologicalDataItemDao.loadBiologicalDataItemsByIds( Arrays.asList(vcfFileGA4GH.getIndex().getId(), vcfFileGA4GH.getBioDataItemId())); Assert.assertTrue(indexItems.isEmpty()); testLoadGA4GH(vcfFileGA4GH, 1D, false, null); }
@Transactional(propagation = Propagation.REQUIRED) public VcfFile unregisterVcfFile(final Long vcfFileId) throws IOException { Assert.notNull(vcfFileId, MessagesConstants.ERROR_INVALID_PARAM); Assert.isTrue(vcfFileId > 0, MessagesConstants.ERROR_INVALID_PARAM); VcfFile vcfFile = vcfFileManager.load(vcfFileId); Assert.notNull(vcfFile, MessagesConstants.ERROR_NO_SUCH_FILE); vcfFileManager.deleteVcfFile(vcfFile); if (vcfFile.getType() == BiologicalDataItemResourceType.GA4GH) { return vcfFile; } fileManager.deleteFeatureFileDirectory(vcfFile); return vcfFile; }
VcfManager { @Transactional(propagation = Propagation.REQUIRED) public VcfFile unregisterVcfFile(final Long vcfFileId) throws IOException { Assert.notNull(vcfFileId, MessagesConstants.ERROR_INVALID_PARAM); Assert.isTrue(vcfFileId > 0, MessagesConstants.ERROR_INVALID_PARAM); VcfFile vcfFile = vcfFileManager.load(vcfFileId); Assert.notNull(vcfFile, MessagesConstants.ERROR_NO_SUCH_FILE); vcfFileManager.deleteVcfFile(vcfFile); if (vcfFile.getType() == BiologicalDataItemResourceType.GA4GH) { return vcfFile; } fileManager.deleteFeatureFileDirectory(vcfFile); return vcfFile; } }
VcfManager { @Transactional(propagation = Propagation.REQUIRED) public VcfFile unregisterVcfFile(final Long vcfFileId) throws IOException { Assert.notNull(vcfFileId, MessagesConstants.ERROR_INVALID_PARAM); Assert.isTrue(vcfFileId > 0, MessagesConstants.ERROR_INVALID_PARAM); VcfFile vcfFile = vcfFileManager.load(vcfFileId); Assert.notNull(vcfFile, MessagesConstants.ERROR_NO_SUCH_FILE); vcfFileManager.deleteVcfFile(vcfFile); if (vcfFile.getType() == BiologicalDataItemResourceType.GA4GH) { return vcfFile; } fileManager.deleteFeatureFileDirectory(vcfFile); return vcfFile; }  }
VcfManager { @Transactional(propagation = Propagation.REQUIRED) public VcfFile unregisterVcfFile(final Long vcfFileId) throws IOException { Assert.notNull(vcfFileId, MessagesConstants.ERROR_INVALID_PARAM); Assert.isTrue(vcfFileId > 0, MessagesConstants.ERROR_INVALID_PARAM); VcfFile vcfFile = vcfFileManager.load(vcfFileId); Assert.notNull(vcfFile, MessagesConstants.ERROR_NO_SUCH_FILE); vcfFileManager.deleteVcfFile(vcfFile); if (vcfFile.getType() == BiologicalDataItemResourceType.GA4GH) { return vcfFile; } fileManager.deleteFeatureFileDirectory(vcfFile); return vcfFile; }  VcfFile registerVcfFile(FeatureIndexedFileRegistrationRequest request); @Transactional(propagation = Propagation.REQUIRED) VcfFile unregisterVcfFile(final Long vcfFileId); Track<Variation> loadVariations(final Track<Variation> track, final Long sampleId, boolean loadInfo,
                                           final boolean collapse); Track<Variation> loadVariations(final Track<Variation> track, String fileUrl, String indexUrl,
                                           final Integer sampleIndex, final boolean loadInfo, final boolean collapse); Variation loadVariation(final VariationQuery query); Variation loadVariation(final VariationQuery query, String fileUrl, String indexUrl); Variation getNextOrPreviousVariation(final int fromPosition, final Long vcfFileId, final Long sampleId,
                                                final long chromosomeId, final boolean forward, String fileUrl,
                                                String indexUrl); VcfFilterInfo getFiltersInfo(Collection<Long> vcfFileIds); VcfFile reindexVcfFile(long vcfFileId, Boolean rewriteTabixIndex); InfoFieldParser getExtendedInfoParser(); void setIndexBufferSize(int indexBufferSize); }
VcfManager { @Transactional(propagation = Propagation.REQUIRED) public VcfFile unregisterVcfFile(final Long vcfFileId) throws IOException { Assert.notNull(vcfFileId, MessagesConstants.ERROR_INVALID_PARAM); Assert.isTrue(vcfFileId > 0, MessagesConstants.ERROR_INVALID_PARAM); VcfFile vcfFile = vcfFileManager.load(vcfFileId); Assert.notNull(vcfFile, MessagesConstants.ERROR_NO_SUCH_FILE); vcfFileManager.deleteVcfFile(vcfFile); if (vcfFile.getType() == BiologicalDataItemResourceType.GA4GH) { return vcfFile; } fileManager.deleteFeatureFileDirectory(vcfFile); return vcfFile; }  VcfFile registerVcfFile(FeatureIndexedFileRegistrationRequest request); @Transactional(propagation = Propagation.REQUIRED) VcfFile unregisterVcfFile(final Long vcfFileId); Track<Variation> loadVariations(final Track<Variation> track, final Long sampleId, boolean loadInfo,
                                           final boolean collapse); Track<Variation> loadVariations(final Track<Variation> track, String fileUrl, String indexUrl,
                                           final Integer sampleIndex, final boolean loadInfo, final boolean collapse); Variation loadVariation(final VariationQuery query); Variation loadVariation(final VariationQuery query, String fileUrl, String indexUrl); Variation getNextOrPreviousVariation(final int fromPosition, final Long vcfFileId, final Long sampleId,
                                                final long chromosomeId, final boolean forward, String fileUrl,
                                                String indexUrl); VcfFilterInfo getFiltersInfo(Collection<Long> vcfFileIds); VcfFile reindexVcfFile(long vcfFileId, Boolean rewriteTabixIndex); InfoFieldParser getExtendedInfoParser(); void setIndexBufferSize(int indexBufferSize); static final double HTSJDK_WRONG_QUALITY; }