org.opencb.cellbase.lib.download.CaddDownloadManager Maven / Gradle / Ivy
/*
* Copyright 2015-2020 OpenCB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.opencb.cellbase.lib.download;
import org.opencb.cellbase.core.config.CellBaseConfiguration;
import org.opencb.cellbase.core.exception.CellBaseException;
import org.opencb.cellbase.lib.EtlCommons;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Collections;
import java.util.List;
public class CaddDownloadManager extends AbstractDownloadManager {
private static final String CADD_NAME = "CADD";
public CaddDownloadManager(String species, String assembly, Path targetDirectory, CellBaseConfiguration configuration)
throws IOException, CellBaseException {
super(species, assembly, targetDirectory, configuration);
}
@Override
public List download() throws IOException, InterruptedException {
return Collections.singletonList(downloadCaddScores());
}
public DownloadFile downloadCaddScores() throws IOException, InterruptedException {
if (!speciesHasInfoToDownload(speciesConfiguration, "variation_functional_score")) {
return null;
}
if (speciesConfiguration.getScientificName().equals("Homo sapiens")) {
logger.info("Downloading CADD scores information ...");
Path variationFunctionalScoreFolder = downloadFolder.resolve("variation_functional_score");
Files.createDirectories(variationFunctionalScoreFolder);
// Downloads CADD scores
String url = configuration.getDownload().getCadd().getHost();
saveVersionData(EtlCommons.VARIATION_FUNCTIONAL_SCORE_DATA, CADD_NAME, url.split("/")[5], getTimeStamp(),
Collections.singletonList(url), variationFunctionalScoreFolder.resolve("caddVersion.json"));
return downloadFile(url, variationFunctionalScoreFolder.resolve("whole_genome_SNVs.tsv.gz").toString());
}
return null;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy