@Test @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) public void testLoadExtendedSummaryUrl() throws Exception { final String path = "/Felis_catus.vcf"; String vcfUrl = UrlTestingUtils.TEST_FILE_SERVER_URL + path; String indexUrl = UrlTestingUtils.TEST_FILE_SERVER_URL + "/Felis_catus.idx"; Resource resource = context.getResource("classpath:templates/genes_sorted.gtf"); FeatureIndexedFileRegistrationRequest request = new FeatureIndexedFileRegistrationRequest(); request.setReferenceId(referenceId); request.setPath(resource.getFile().getAbsolutePath()); GeneFile geneFile = gffManager.registerGeneFile(request); Assert.assertNotNull(geneFile); Assert.assertNotNull(geneFile.getId()); referenceGenomeManager.updateReferenceGeneFileId(testReference.getId(), geneFile.getId()); Server server = UrlTestingUtils.getFileServer(context); try { server.start(); final VariationQuery query = new VariationQuery(); query.setPosition(GENE_POSTION); query.setChromosomeId(testChromosome.getId()); Variation variation = vcfManager.loadVariation(query, vcfUrl, indexUrl); Assert.assertFalse(variation.getInfo().isEmpty()); Assert.assertFalse(variation.getInfo().isEmpty()); Assert.assertNotNull(variation.getGeneNames()); Assert.assertFalse(variation.getGeneNames().isEmpty()); } finally { server.stop(); } }
public Variation loadVariation(final VariationQuery query) throws FeatureFileReadingException { final Track<Variation> track = new Track<>(); track.setScaleFactor(1D); track.setId(query.getId()); track.setEndIndex(query.getPosition()); track.setStartIndex(query.getPosition()); track.setChromosome(referenceGenomeManager.loadChromosome(query.getChromosomeId())); loadVariations(track, query.getSampleId(), true, false); Assert.notEmpty(track.getBlocks(), getMessage(MessagesConstants.ERROR_NO_SUCH_VARIATION, query.getPosition())); Variation variation = track.getBlocks().get(0); extendInfoFields(variation); VcfFile vcfFile = vcfFileManager.load(query.getId()); Reference reference = referenceGenomeManager.load(vcfFile.getReferenceId()); if (reference.getGeneFile() != null) { Set<String> geneIds = featureIndexManager.fetchGeneIds(variation.getStartIndex(), variation.getEndIndex(), Collections.singletonList(reference.getGeneFile()), track.getChromosome()); variation.setGeneNames(geneIds); } return variation; }
VcfManager { public Variation loadVariation(final VariationQuery query) throws FeatureFileReadingException { final Track<Variation> track = new Track<>(); track.setScaleFactor(1D); track.setId(query.getId()); track.setEndIndex(query.getPosition()); track.setStartIndex(query.getPosition()); track.setChromosome(referenceGenomeManager.loadChromosome(query.getChromosomeId())); loadVariations(track, query.getSampleId(), true, false); Assert.notEmpty(track.getBlocks(), getMessage(MessagesConstants.ERROR_NO_SUCH_VARIATION, query.getPosition())); Variation variation = track.getBlocks().get(0); extendInfoFields(variation); VcfFile vcfFile = vcfFileManager.load(query.getId()); Reference reference = referenceGenomeManager.load(vcfFile.getReferenceId()); if (reference.getGeneFile() != null) { Set<String> geneIds = featureIndexManager.fetchGeneIds(variation.getStartIndex(), variation.getEndIndex(), Collections.singletonList(reference.getGeneFile()), track.getChromosome()); variation.setGeneNames(geneIds); } return variation; } }
VcfManager { public Variation loadVariation(final VariationQuery query) throws FeatureFileReadingException { final Track<Variation> track = new Track<>(); track.setScaleFactor(1D); track.setId(query.getId()); track.setEndIndex(query.getPosition()); track.setStartIndex(query.getPosition()); track.setChromosome(referenceGenomeManager.loadChromosome(query.getChromosomeId())); loadVariations(track, query.getSampleId(), true, false); Assert.notEmpty(track.getBlocks(), getMessage(MessagesConstants.ERROR_NO_SUCH_VARIATION, query.getPosition())); Variation variation = track.getBlocks().get(0); extendInfoFields(variation); VcfFile vcfFile = vcfFileManager.load(query.getId()); Reference reference = referenceGenomeManager.load(vcfFile.getReferenceId()); if (reference.getGeneFile() != null) { Set<String> geneIds = featureIndexManager.fetchGeneIds(variation.getStartIndex(), variation.getEndIndex(), Collections.singletonList(reference.getGeneFile()), track.getChromosome()); variation.setGeneNames(geneIds); } return variation; }  }
VcfManager { public Variation loadVariation(final VariationQuery query) throws FeatureFileReadingException { final Track<Variation> track = new Track<>(); track.setScaleFactor(1D); track.setId(query.getId()); track.setEndIndex(query.getPosition()); track.setStartIndex(query.getPosition()); track.setChromosome(referenceGenomeManager.loadChromosome(query.getChromosomeId())); loadVariations(track, query.getSampleId(), true, false); Assert.notEmpty(track.getBlocks(), getMessage(MessagesConstants.ERROR_NO_SUCH_VARIATION, query.getPosition())); Variation variation = track.getBlocks().get(0); extendInfoFields(variation); VcfFile vcfFile = vcfFileManager.load(query.getId()); Reference reference = referenceGenomeManager.load(vcfFile.getReferenceId()); if (reference.getGeneFile() != null) { Set<String> geneIds = featureIndexManager.fetchGeneIds(variation.getStartIndex(), variation.getEndIndex(), Collections.singletonList(reference.getGeneFile()), track.getChromosome()); variation.setGeneNames(geneIds); } return variation; }  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 Variation loadVariation(final VariationQuery query) throws FeatureFileReadingException { final Track<Variation> track = new Track<>(); track.setScaleFactor(1D); track.setId(query.getId()); track.setEndIndex(query.getPosition()); track.setStartIndex(query.getPosition()); track.setChromosome(referenceGenomeManager.loadChromosome(query.getChromosomeId())); loadVariations(track, query.getSampleId(), true, false); Assert.notEmpty(track.getBlocks(), getMessage(MessagesConstants.ERROR_NO_SUCH_VARIATION, query.getPosition())); Variation variation = track.getBlocks().get(0); extendInfoFields(variation); VcfFile vcfFile = vcfFileManager.load(query.getId()); Reference reference = referenceGenomeManager.load(vcfFile.getReferenceId()); if (reference.getGeneFile() != null) { Set<String> geneIds = featureIndexManager.fetchGeneIds(variation.getStartIndex(), variation.getEndIndex(), Collections.singletonList(reference.getGeneFile()), track.getChromosome()); variation.setGeneNames(geneIds); } return variation; }  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; }