@Ignore @Test @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) public void testRegisterDownloadFile() throws IOException, ClassNotFoundException, InterruptedException, ParseException, NoSuchAlgorithmException, VcfReadingException { FeatureIndexedFileRegistrationRequest request = new FeatureIndexedFileRegistrationRequest(); request.setReferenceId(referenceId); request.setType(BiologicalDataItemResourceType.DOWNLOAD); request.setPath(HTTP_VCF); VcfFile vcfFile = vcfManager.registerVcfFile(request); Assert.assertNotNull(vcfFile); Assert.assertNotNull(vcfFile.getId()); }
public VcfFile registerVcfFile(FeatureIndexedFileRegistrationRequest request) { final String requestPath = request.getPath(); Assert.isTrue(StringUtils.isNotBlank(requestPath), getMessage( MessagesConstants.ERROR_NULL_PARAM, "path")); Assert.notNull(request.getReferenceId(), getMessage(MessagesConstants.ERROR_NULL_PARAM, "referenceId")); VcfFile vcfFile; Reference reference = referenceGenomeManager.load(request.getReferenceId()); Map<String, Chromosome> chromosomeMap = reference.getChromosomes().stream().collect( Collectors.toMap(BaseEntity::getName, chromosome -> chromosome)); if (request.getType() == null) { request.setType(BiologicalDataItemResourceType.FILE); } switch (request.getType()) { case GA4GH: vcfFile = getVcfFileFromGA4GH(request, requestPath); break; case FILE: case S3: vcfFile = createVcfFromFile(request, chromosomeMap, reference, request.isDoIndex()); break; case DOWNLOAD: vcfFile = downloadVcfFile(request, requestPath, chromosomeMap, reference, request.isDoIndex()); break; case URL: vcfFile = createVcfFromUrl(request, chromosomeMap, reference); break; default: throw new IllegalArgumentException( getMessage(MessagesConstants.ERROR_INVALID_PARAM)); } return vcfFile; }
VcfManager { public VcfFile registerVcfFile(FeatureIndexedFileRegistrationRequest request) { final String requestPath = request.getPath(); Assert.isTrue(StringUtils.isNotBlank(requestPath), getMessage( MessagesConstants.ERROR_NULL_PARAM, "path")); Assert.notNull(request.getReferenceId(), getMessage(MessagesConstants.ERROR_NULL_PARAM, "referenceId")); VcfFile vcfFile; Reference reference = referenceGenomeManager.load(request.getReferenceId()); Map<String, Chromosome> chromosomeMap = reference.getChromosomes().stream().collect( Collectors.toMap(BaseEntity::getName, chromosome -> chromosome)); if (request.getType() == null) { request.setType(BiologicalDataItemResourceType.FILE); } switch (request.getType()) { case GA4GH: vcfFile = getVcfFileFromGA4GH(request, requestPath); break; case FILE: case S3: vcfFile = createVcfFromFile(request, chromosomeMap, reference, request.isDoIndex()); break; case DOWNLOAD: vcfFile = downloadVcfFile(request, requestPath, chromosomeMap, reference, request.isDoIndex()); break; case URL: vcfFile = createVcfFromUrl(request, chromosomeMap, reference); break; default: throw new IllegalArgumentException( getMessage(MessagesConstants.ERROR_INVALID_PARAM)); } return vcfFile; } }
VcfManager { public VcfFile registerVcfFile(FeatureIndexedFileRegistrationRequest request) { final String requestPath = request.getPath(); Assert.isTrue(StringUtils.isNotBlank(requestPath), getMessage( MessagesConstants.ERROR_NULL_PARAM, "path")); Assert.notNull(request.getReferenceId(), getMessage(MessagesConstants.ERROR_NULL_PARAM, "referenceId")); VcfFile vcfFile; Reference reference = referenceGenomeManager.load(request.getReferenceId()); Map<String, Chromosome> chromosomeMap = reference.getChromosomes().stream().collect( Collectors.toMap(BaseEntity::getName, chromosome -> chromosome)); if (request.getType() == null) { request.setType(BiologicalDataItemResourceType.FILE); } switch (request.getType()) { case GA4GH: vcfFile = getVcfFileFromGA4GH(request, requestPath); break; case FILE: case S3: vcfFile = createVcfFromFile(request, chromosomeMap, reference, request.isDoIndex()); break; case DOWNLOAD: vcfFile = downloadVcfFile(request, requestPath, chromosomeMap, reference, request.isDoIndex()); break; case URL: vcfFile = createVcfFromUrl(request, chromosomeMap, reference); break; default: throw new IllegalArgumentException( getMessage(MessagesConstants.ERROR_INVALID_PARAM)); } return vcfFile; }  }
VcfManager { public VcfFile registerVcfFile(FeatureIndexedFileRegistrationRequest request) { final String requestPath = request.getPath(); Assert.isTrue(StringUtils.isNotBlank(requestPath), getMessage( MessagesConstants.ERROR_NULL_PARAM, "path")); Assert.notNull(request.getReferenceId(), getMessage(MessagesConstants.ERROR_NULL_PARAM, "referenceId")); VcfFile vcfFile; Reference reference = referenceGenomeManager.load(request.getReferenceId()); Map<String, Chromosome> chromosomeMap = reference.getChromosomes().stream().collect( Collectors.toMap(BaseEntity::getName, chromosome -> chromosome)); if (request.getType() == null) { request.setType(BiologicalDataItemResourceType.FILE); } switch (request.getType()) { case GA4GH: vcfFile = getVcfFileFromGA4GH(request, requestPath); break; case FILE: case S3: vcfFile = createVcfFromFile(request, chromosomeMap, reference, request.isDoIndex()); break; case DOWNLOAD: vcfFile = downloadVcfFile(request, requestPath, chromosomeMap, reference, request.isDoIndex()); break; case URL: vcfFile = createVcfFromUrl(request, chromosomeMap, reference); break; default: throw new IllegalArgumentException( getMessage(MessagesConstants.ERROR_INVALID_PARAM)); } 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 { public VcfFile registerVcfFile(FeatureIndexedFileRegistrationRequest request) { final String requestPath = request.getPath(); Assert.isTrue(StringUtils.isNotBlank(requestPath), getMessage( MessagesConstants.ERROR_NULL_PARAM, "path")); Assert.notNull(request.getReferenceId(), getMessage(MessagesConstants.ERROR_NULL_PARAM, "referenceId")); VcfFile vcfFile; Reference reference = referenceGenomeManager.load(request.getReferenceId()); Map<String, Chromosome> chromosomeMap = reference.getChromosomes().stream().collect( Collectors.toMap(BaseEntity::getName, chromosome -> chromosome)); if (request.getType() == null) { request.setType(BiologicalDataItemResourceType.FILE); } switch (request.getType()) { case GA4GH: vcfFile = getVcfFileFromGA4GH(request, requestPath); break; case FILE: case S3: vcfFile = createVcfFromFile(request, chromosomeMap, reference, request.isDoIndex()); break; case DOWNLOAD: vcfFile = downloadVcfFile(request, requestPath, chromosomeMap, reference, request.isDoIndex()); break; case URL: vcfFile = createVcfFromUrl(request, chromosomeMap, reference); break; default: throw new IllegalArgumentException( getMessage(MessagesConstants.ERROR_INVALID_PARAM)); } 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; }