Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python312Packages.humann: init at 3.0.0 #340539

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions pkgs/by-name/hu/humann-db/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
lib,
runCommand,
fetchzip,
}:

let
db_version = "201901b";
in
runCommand "humann-db"
(rec {
version = "0-${db_version}";

nucleotide = fetchzip {
name = "full_chocophlan.v296_${db_version}";
url = "http://huttenhower.sph.harvard.edu/humann_data/chocophlan/full_chocophlan.v296_${db_version}.tar.gz";
Pandapip1 marked this conversation as resolved.
Show resolved Hide resolved
stripRoot = false;
hash = "sha256-+wMnQowBlQ3PNAHFNa1Z27cvHOGZrh1p6032IuWEanQ=";
};

protein = fetchzip {
name = "uniref90_annotated_v${db_version}_full";
url = "http://huttenhower.sph.harvard.edu/humann_data/uniprot/uniref_annotated/uniref90_annotated_v${db_version}_full.tar.gz";
stripRoot = false;
hash = "sha256-69ENV/Ff0NojKaaVr7n7OYuRzaGWAr+VCDpSKezY8XA=";
};

utilityMapping = fetchzip {
name = "full_mapping_v${db_version}";
url = "http://huttenhower.sph.harvard.edu/humann_data/full_mapping_v${db_version}.tar.gz";
stripRoot = false;
hash = "sha256-0IvLEe6CPGn0IVG//lJbuozD/K2LRxWnEAvCYxPtt7o=";
};

meta = {
description = "Database files for Humann";
homepage = "https://github.com/biobakery/humann";
license = lib.licenses.free; # These are raw data files not covered under copyright law
maintainers = with lib.maintainers; [ pandapip1 ];
platforms = lib.platforms.all;
hydraPlatforms = [ ]; # Exceeds Hydra's maximum build size
};
})
''
mkdir -p $out

ln -s $nucleotide $out/nucleotide_database
ln -s $protein $out/protein_database
ln -s $utilityMapping $out/utility_mapping
''
66 changes: 66 additions & 0 deletions pkgs/development/python-modules/humann/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
lib,
python,
buildPythonPackage,
callPackage,
fetchzip,
fetchFromGitHub,
setuptools,
biom-format,
bowtie2,
diamond,
samtools,
humann-db,
Pandapip1 marked this conversation as resolved.
Show resolved Hide resolved
nix-update-script,
}:

buildPythonPackage rec {
pname = "humann";
version = "3.0.0";
pyproject = true;

src = fetchFromGitHub {
owner = "biobakery";
repo = "humann";
rev = "refs/tags/${version}";
hash = "sha256-EieeZ9nnVCTgm7WZ+mYT99KnB3PtgjiK7HfCjHwNw8g=";
};

build-system = [ setuptools ];

dependencies = [ biom-format ];

postInstall =
''
for program in $out/bin/*; do
wrapProgram $out/bin/$(basename $program) \
--prefix PATH : ${
lib.makeBinPath [
bowtie2
diamond
samtools
]
}
done
''
+ lib.optionalString (humann-db != null) ''
rm -rf $out/${python.sitePackages}/humann/data
substituteInPlace $out/${python.sitePackages}/humann/humann.cfg \
--replace-fail "data/chocophlan_DEMO" "${humann-db}/nucleotide_database" \
--replace-fail "data/uniref_DEMO" "${humann-db}/protein_database" \
--replace-fail "data/misc" "${humann-db}/utility_mapping"
'';

passthru = {
updateScript = nix-update-script { };
tests = callPackage ./tests.nix { };
};

meta = {
description = "Pipeline for metagenomic functional profiling";
homepage = "https://github.com/biobakery/humann";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ pandapip1 ];
mainProgram = "humann";
};
}
25 changes: 25 additions & 0 deletions pkgs/development/python-modules/humann/tests.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{ runCommand, python3Packages }:

{
humann-tests =
runCommand "humann-tests" { nativeBuildInputs = with python3Packages; [ humann ]; }
''
humann_test --run-functional-tests-tools
echo "SUCCESS" > $out
'';
humann-tests-full =
runCommand "humann-tests-full" { nativeBuildInputs = with python3Packages; [ humann ]; }
''
humann_test --run-functional-tests-tools --run-functional-tests-end-to-end
echo "SUCCESS" > $out
'';
humann-demos =
runCommand "humann-demos" { nativeBuildInputs = with python3Packages; [ humann ]; }
''
mkdir -p $out/fasta $out/fastq $out/sam $out/blastm8
humann --input ${python3Packages.humann.src}/examples/demo.fasta --output $out/fasta
humann --input ${python3Packages.humann.src}/examples/demo.fastq --output $out/fastq
humann --input ${python3Packages.humann.src}/examples/demo.sam --output $out/sam
humann --input ${python3Packages.humann.src}/examples/demo.m8 --output $out/blastm8
'';
}
4 changes: 4 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27718,6 +27718,10 @@ with pkgs;

humanity-icon-theme = callPackage ../data/icons/humanity-icon-theme { };

humann = python3Packages.humann.override {
inherit humann-db;
};

hyperscrypt-font = callPackage ../data/fonts/hyperscrypt { };

ia-writer-duospace = callPackage ../data/fonts/ia-writer-duospace { };
Expand Down
6 changes: 6 additions & 0 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5816,6 +5816,10 @@ self: super: with self; {

humanize = callPackage ../development/python-modules/humanize { };

humann = callPackage ../development/python-modules/humann {
humann-db = null;
};

human-readable = callPackage ../development/python-modules/human-readable { };

humblewx = callPackage ../development/python-modules/humblewx { };
Expand Down Expand Up @@ -7878,6 +7882,8 @@ self: super: with self; {

miniupnpc = callPackage ../development/python-modules/miniupnpc { };

minpath = callPackage ../development/python-modules/minpath { };

mip = callPackage ../development/python-modules/mip { };

mir-eval = callPackage ../development/python-modules/mir-eval { };
Expand Down