fileManager.matchUpVariantFiles(study, files, sessionId);
private File getOriginalFromTransformed(String study, File file, String sessionId) throws URISyntaxException, CatalogException { // Look for the vcf file String vcfId = null; // Matchup variant files, if missing if (file.getRelatedFiles() == null || file.getRelatedFiles().isEmpty()) { catalogManager.getFileManager().matchUpVariantFiles(null, Collections.singletonList(file), sessionId); } for (File.RelatedFile relatedFile : file.getRelatedFiles()) { if (File.RelatedFile.Relation.PRODUCED_FROM.equals(relatedFile.getRelation())) { long fileUid = relatedFile.getFileId(); // FIXME!!! vcfId = catalogManager.getFileManager().get(study, new Query(UID.key(), fileUid), new QueryOptions(QueryOptions.INCLUDE, ID.key()), sessionId).first().getId(); break; } } if (vcfId == null) { logger.error("This code should never be executed. Every transformed avro file should come from a registered vcf file"); throw new CatalogException("Internal error. No vcf file could be found for file " + file.getPath()); } QueryResult<File> vcfQueryResult = fileManager.get(study, vcfId, FILE_GET_QUERY_OPTIONS, sessionId); if (vcfQueryResult.getNumResults() != 1) { logger.error("This code should never be executed. No vcf file could be found for vcf id " + vcfId); throw new CatalogException("Internal error. No vcf file could be found under id " + vcfId); } file = vcfQueryResult.first(); return file; }
matchUpVariantFiles(study.getFqn(), Arrays.asList(file), sessionId); matchUpVariantFiles(study.getFqn(), transformedFiles, sessionId);
if (isTransformedFile(file.getName())) { if (file.getRelatedFiles() == null || file.getRelatedFiles().isEmpty()) { catalogManager.getFileManager().matchUpVariantFiles(studyStr, Collections.singletonList(file), sessionId);
@Test public void testIndexByStepsExternallyTransformed() throws Exception { QueryOptions queryOptions = new QueryOptions(VariantFileIndexerStorageOperation.TRANSFORM, true) // TODO: Should work without isolating transformation? .append(VariantStorageEngine.Options.ISOLATE_FILE_FROM_STUDY_CONFIGURATION.key(), true); // File transformFile = transformFile(getFile(0), queryOptions); String outdir = opencga.createTmpOutdir(studyId, "_TRANSFORM_", sessionId); List<StoragePipelineResult> etlResults = variantManager.index(studyId, getFile(0).getPath(), outdir, queryOptions, sessionId); File transformFile = null; create(studyId2, catalogManager.getFileManager().getUri(getFile(0))); for (java.io.File file : Paths.get(UriUtils.createUri(outdir)).toFile().listFiles()) { File f = create(studyId2, file.toURI()); if (VariantReaderUtils.isTransformedVariants(file.toString())) { assertNull(transformFile); transformFile = f; } } assertNotNull(transformFile); catalogManager.getFileManager().matchUpVariantFiles(studyId2, singletonList(transformFile), sessionId); queryOptions = new QueryOptions().append(VariantStorageEngine.Options.ANNOTATE.key(), false) .append(VariantStorageEngine.Options.CALCULATE_STATS.key(), true); loadFile(transformFile, queryOptions, outputId2); }
matchUpVariantFiles(study.getFqn(), queryResult.getResult(), sessionId);