aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Bedo <cu@cua0.org>2020-02-14 08:09:08 +1100
committerJustin Bedo <cu@cua0.org>2020-02-14 08:09:08 +1100
commit57ccba7da6feb46475f1ad58126a663356efe358 (patch)
tree82fe378fefe8940f3c240ee41055087f51317034
parentb8caa245cb6bb4616318173b81e9207aee414859 (diff)
add gdrive downloader
- fetch dbNSFP automatically via gdrive.pl
-rw-r--r--default.nix1
-rw-r--r--lib/google.nix20
-rw-r--r--lib/references.nix20
3 files changed, 29 insertions, 12 deletions
diff --git a/default.nix b/default.nix
index 12ca5b3..ad8cecc 100644
--- a/default.nix
+++ b/default.nix
@@ -14,6 +14,7 @@ let
callBionixE = p: exec (callBionix p);
types = callBionix ./lib/types.nix {};
+ fetchgdrive = callBionix ./lib/google.nix {};
bowtie = callBionix ./tools/bowtie.nix {};
bwa = callBionix ./tools/bwa.nix {};
diff --git a/lib/google.nix b/lib/google.nix
new file mode 100644
index 0000000..354b5c5
--- /dev/null
+++ b/lib/google.nix
@@ -0,0 +1,20 @@
+{ bionix }:
+
+{ url, sha256 }:
+
+with bionix.pkgs;
+
+let
+ gdown = fetchurl {
+ url =
+ "https://raw.githubusercontent.com/circulosmeos/gdown.pl/master/gdown.pl";
+ sha256 = "1pw3vg70bgf33akbbphpr6zn3jndv0khmsa3k0m877hgzg1v52qv";
+ };
+in runCommand "gdown" {
+ nativeBuildInputs = [ perl wget ];
+ outputHashAlgo = "sha256";
+ outputHash = sha256;
+ outputHashMode = "flat";
+} ''
+ perl ${gdown} "${url}" $out
+''
diff --git a/lib/references.nix b/lib/references.nix
index c56ad0f..333888c 100644
--- a/lib/references.nix
+++ b/lib/references.nix
@@ -60,14 +60,12 @@ rec {
'';
};
dbnsfp = {
- db = pkgs.requireFile {
- name = "dbNSFP.txt.gz";
- message = "download the dbNSFP database manually from https://drive.google.com/uc?export=download&id=0B7Ms5xMSFMYlSTY5dDJjcHVRZ3M and add to nix store";
+ db = fetchgdrive {
+ url = "https://drive.google.com/uc?export=download&id=0B7Ms5xMSFMYlSTY5dDJjcHVRZ3M";
sha256 = "0gfzbid3pc10zds7ya50w4qfynsxgpyh7dx35vhm5f3h64mw75pm";
};
- index = pkgs.requireFile {
- name = "dbNSFP.txt.gz.tbi";
- message = "download the dbNSFP index manually from https://drive.google.com/uc?export=download&id=0B7Ms5xMSFMYlOTV5RllpRjNHU2s and add to nix store";
+ index = fetchgdrive {
+ url = "https://drive.google.com/uc?export=download&id=0B7Ms5xMSFMYlOTV5RllpRjNHU2s";
sha256 = "0bwwigbnz32mmc8bczidjf68vv8x8i28zwkl2kgcbpj542zk5q86";
};
};
@@ -146,14 +144,12 @@ rec {
'';
};
dbnsfp = {
- db = pkgs.requireFile {
- name = "dbNSFP.txt.gz";
- message = "download the dbNSFP database manually from https://drive.google.com/uc?export=download&id=0B7Ms5xMSFMYlbTZodjlGUDZnTGc and add to nix store";
+ db = fetchgdrive {
+ url = "https://drive.google.com/uc?export=download&id=0B7Ms5xMSFMYlbTZodjlGUDZnTGc";
sha256 = "0gahnwkc7v2q6p6ixkhvsgqvvm6xf0c3bdh4nf0alih83h3wffd0";
};
- index = pkgs.requireFile {
- name = "dbNSFP.txt.gz.tbi";
- message = "download the dbNSFP index manually from https://drive.google.com/uc?export=download&id=0B7Ms5xMSFMYlNVBJdFA5cFZRYkE and add to nix store";
+ index = fetchgdrive {
+ url = "https://drive.google.com/uc?export=download&id=0B7Ms5xMSFMYlNVBJdFA5cFZRYkE";
sha256 = "18blkly6gvg7r0sx968xlb1zl2kqg5j1kpbrm2r7ajlxlfyvrx3w";
};
};