public static File create(String resourceName, boolean indexed) throws IOException, CatalogException {
File file;
URI uri = getResourceUri(resourceName);
file = fileMetadataReader.create(studyId, uri, "data/vcfs/", "", true, null, sessionId).first();
catalogFileUtils.upload(uri, file, null, sessionId, false, false, true, false, Long.MAX_VALUE);
if (indexed) {
FileIndex fileIndex = new FileIndex("user", "today", new FileIndex.IndexStatus(FileIndex.IndexStatus.READY), 1234,
Collections.emptyMap());
catalogManager.getFileManager().setFileIndex(studyId, file.getPath(), fileIndex, sessionId);
indexedFiles.add((int) file.getUid());
List<String> samples = catalogManager.getCohortManager().getSamples(studyId, cohortId, null, sessionId).getResult().stream().map(Sample::getId).collect(Collectors.toList());
samples.addAll(file.getSamples().stream().map(Sample::getId).collect(Collectors.toList()));
catalogManager.getCohortManager().update(studyId, cohortId, new ObjectMap(CohortDBAdaptor.QueryParams.SAMPLES.key(), samples), true, null, sessionId);
}
return catalogManager.getFileManager().get(studyId, file.getId(), null, sessionId).first();
}