Skip to content

Commit

Permalink
app: update the CellBase loader for variation data according to the l…
Browse files Browse the repository at this point in the history
…atest changes, #TASK-6142, #TASK-5564
  • Loading branch information
jtarraga committed Aug 1, 2024
1 parent d693f57 commit 38400c1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import static org.opencb.cellbase.lib.builders.RefSeqGeneBuilder.REFSEQ_GENE_OUTPUT_FILENAME;
import static org.opencb.cellbase.lib.builders.RegulatoryFeatureBuilder.*;
import static org.opencb.cellbase.lib.builders.RepeatsBuilder.REPEATS_OUTPUT_FILENAME;
import static org.opencb.cellbase.lib.builders.VariationBuilder.VARIATION_CHR_PREFIX;
import static org.opencb.cellbase.lib.download.GenomeDownloadManager.GENOME_INFO_FILENAME;

/**
Expand Down Expand Up @@ -139,8 +140,7 @@ public void execute() throws CellBaseException {
break;
}
case EtlCommons.VARIATION_DATA: {
// Load data, create index and update release
loadVariationData();
loadVariation();
break;
}
case EtlCommons.VARIATION_FUNCTIONAL_SCORE_DATA: {
Expand Down Expand Up @@ -303,31 +303,15 @@ private void checkParameters() throws CellBaseException {
dataRelease = getDataReleaseForLoading(dataReleaseManager).getRelease();
}

private void loadVariationData() throws NoSuchMethodException, InterruptedException, ExecutionException,
private void loadVariation() throws NoSuchMethodException, InterruptedException, ExecutionException,
InstantiationException, IllegalAccessException, InvocationTargetException, ClassNotFoundException,
IOException, LoaderException, CellBaseException {
// First load data
// Common loading process from CellBase variation data models
if (field == null) {
DirectoryStream<Path> stream = Files.newDirectoryStream(input,
entry -> entry.getFileName().toString().startsWith("variation_chr"));

for (Path entry : stream) {
logger.info("Loading file '{}'", entry);
loadRunner.load(input.resolve(entry.getFileName()), "variation", dataRelease);
}

// Create index
createIndex("variation");

// Update release (collection and sources)
List<Path> sources = new ArrayList<>(Arrays.asList(
input.resolve("ensemblVariationVersion.json")
));
dataReleaseManager.update(dataRelease, "variation", sources);

// Custom update required e.g. population freqs loading
// First load data
// Common loading process from CellBase variation data models
loadData(input.resolve(VARIATION_DATA), VARIATION_DATA, VARIATION_CHR_PREFIX);
} else {
// Custom update required e.g. population freqs loading
logger.info("Loading file '{}'", input);
loadRunner.load(input, "variation", dataRelease, field, innerFields);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import static org.opencb.cellbase.lib.EtlCommons.HOMO_SAPIENS;

/**
* Created by jtarraga on 01/08/24
* Created by jtarraga on 01/08/24.
*/
public class VariationBuilder extends AbstractBuilder {

Expand Down

0 comments on commit 38400c1

Please sign in to comment.