Skip to content

Commit

Permalink
Merge branch 'latest' into release/v4.8.6
Browse files Browse the repository at this point in the history
  • Loading branch information
ctb committed Feb 10, 2024
2 parents d7829ac + 7edcf14 commit b644174
Show file tree
Hide file tree
Showing 17 changed files with 608 additions and 64 deletions.
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Pre-commit updates (#2427)
fee62922d8857ce93f1d4e90fd7240629d606997
20 changes: 9 additions & 11 deletions .github/workflows/dev_envs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,23 @@ on:
branches: [latest]
jobs:
nix:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-14]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: cachix/install-nix-action@v25
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v14
with:
name: sourmash-bio
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v4
- name: Run the Magic Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@v1

- run: nix run .# -- --version

- run: nix-shell --command "tox -e py310"
- run: nix develop --command bash -c "tox -e py310"

mamba:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions doc/command-line.md
Original file line number Diff line number Diff line change
Expand Up @@ -551,8 +551,8 @@ The sourmash `tax` or `taxonomy` commands integrate taxonomic
`gather` command (we cannot combine separate `gather` runs for the
same query). For supported databases (e.g. GTDB, NCBI), we provide
taxonomy csv files, but they can also be generated for user-generated
databases. As of v4.8, some sourmash taxonomy commands can also use `LIN`
lineage information. For more information, see [databases](databases.md).
databases. As of v4.8 and 4.8.6, respectively, some sourmash taxonomy
commands can also use `LIN` or `ICTV` lineage information.

`tax` commands rely upon the fact that `gather` provides both the total
fraction of the query matched to each database matched, as well as a
Expand Down
18 changes: 9 additions & 9 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 32 additions & 13 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,40 +30,55 @@
rustc = rustVersion;
};

inherit (pkgs) lib;

python = pkgs.python311Packages;

stdenv = if pkgs.stdenv.isDarwin then pkgs.overrideSDK pkgs.stdenv "11.0" else pkgs.stdenv;

commonArgs = {
src = ./.;
stdenv = stdenv;
preConfigure = lib.optionalString stdenv.isDarwin ''
export MACOSX_DEPLOYMENT_TARGET=10.14
'';

# Work around https://github.com/NixOS/nixpkgs/issues/166205.
env = lib.optionalAttrs stdenv.cc.isClang {
NIX_LDFLAGS = "-l${stdenv.cc.libcxx.cxxabi.libName}";
};

buildInputs = lib.optionals stdenv.isDarwin [ pkgs.libiconv pkgs.darwin.apple_sdk.frameworks.Security ];

nativeBuildInputs = with rustPlatform; [ cargoSetupHook maturinBuildHook bindgenHook ];
};

in

with pkgs;
{
packages = {

lib = rustPlatform.buildRustPackage {
lib = rustPlatform.buildRustPackage ( commonArgs // {
name = "libsourmash";
src = lib.cleanSource ./.;
copyLibs = true;
cargoLock.lockFile = ./Cargo.lock;
nativeBuildInputs = with rustPlatform; [ bindgenHook ];
};
});

sourmash = python.buildPythonPackage rec {
sourmash = python.buildPythonPackage ( commonArgs // rec {
pname = "sourmash";
version = "4.8.6";
format = "pyproject";

src = ./.;

cargoDeps = rustPlatform.importCargoLock {
lockFile = ./Cargo.lock;
};

nativeBuildInputs = with rustPlatform; [ cargoSetupHook maturinBuildHook bindgenHook ];

buildInputs = lib.optionals stdenv.isDarwin [ libiconv ];
propagatedBuildInputs = with python; [ cffi deprecation cachetools bitstring numpy scipy matplotlib screed ];

DYLD_LIBRARY_PATH = "${self.packages.${system}.lib}/lib";
};
});

docker =
let
Expand All @@ -83,7 +98,7 @@

defaultPackage = self.packages.${system}.sourmash;

devShell = mkShell {
devShells.default = pkgs.mkShell.override { stdenv = stdenv; } (commonArgs // {
nativeBuildInputs = with rustPlatform; [ bindgenHook ];

buildInputs = [
Expand Down Expand Up @@ -113,15 +128,19 @@
cargo-outdated
cargo-udeps
cargo-deny
cargo-semver-checks
#cargo-semver-checks
nixpkgs-fmt
];

shellHook = ''
export MACOSX_DEPLOYMENT_TARGET=10.14
'';

# Needed for matplotlib
LD_LIBRARY_PATH = lib.makeLibraryPath [ pkgs.stdenv.cc.cc.lib ];

# workaround for https://github.com/NixOS/nixpkgs/blob/48dfc9fa97d762bce28cc8372a2dd3805d14c633/doc/languages-frameworks/python.section.md#python-setuppy-bdist_wheel-cannot-create-whl
SOURCE_DATE_EPOCH = 315532800; # 1980
};
});
});
}
2 changes: 1 addition & 1 deletion src/core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sourmash"
version = "0.12.0"
version = "0.12.1"
authors = ["Luiz Irber <luiz.irber@gmail.com>"]
description = "MinHash sketches for genomic data"
repository = "https://github.com/sourmash-bio/sourmash"
Expand Down
7 changes: 7 additions & 0 deletions src/sourmash/cli/tax/annotate.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ def subparser(subparsers):
default=False,
help="use LIN taxonomy in place of standard taxonomic ranks. Note that the taxonomy CSV must contain LIN lineage information.",
)
subparser.add_argument(
"--ictv",
"--ictv-taxonomy",
action="store_true",
default=False,
help="use ICTV taxonomy in place of standard taxonomic ranks. Note that the taxonomy CSV must contain ICTV ranks.",
)


def main(args):
Expand Down
7 changes: 7 additions & 0 deletions src/sourmash/cli/tax/genome.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ def subparser(subparsers):
default=None,
help="CSV containing 'name', 'lin' columns, where 'lin' is the lingroup prefix. Will restrict classification to these groups.",
)
subparser.add_argument(
"--ictv",
"--ictv-taxonomy",
action="store_true",
default=False,
help="use ICTV taxonomy in place of standard taxonomic ranks. Note that the taxonomy CSV must contain ICTV ranks.",
)
add_tax_threshold_arg(subparser, 0.1)
add_rank_arg(subparser)

Expand Down
7 changes: 7 additions & 0 deletions src/sourmash/cli/tax/metagenome.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ def subparser(subparsers):
default=None,
help="CSV containing 'name', 'lin' columns, where 'lin' is the lingroup prefix. Will produce a 'lingroup' report containing taxonomic summarization for each group.",
)
subparser.add_argument(
"--ictv",
"--ictv-taxonomy",
action="store_true",
default=False,
help="use ICTV taxonomy in place of standard taxonomic ranks. Note that the taxonomy CSV must contain ICTV ranks.",
)
add_rank_arg(subparser)


Expand Down
7 changes: 7 additions & 0 deletions src/sourmash/cli/tax/summarize.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ def subparser(subparsers):
default=False,
help="use LIN taxonomy in place of standard taxonomic ranks.",
)
subparser.add_argument(
"--ictv",
"--ictv-taxonomy",
action="store_true",
default=False,
help="use ICTV taxonomy in place of standard taxonomic ranks. Note that the taxonomy CSV must contain ICTV ranks.",
)


def main(args):
Expand Down
10 changes: 10 additions & 0 deletions src/sourmash/tax/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
RankLineageInfo,
LINLineageInfo,
AnnotateTaxResult,
ICTVRankLineageInfo,
)

usage = """
Expand Down Expand Up @@ -82,6 +83,7 @@ def metagenome(args):
keep_identifier_versions=args.keep_identifier_versions,
force=args.force,
lins=args.lins,
ictv=args.ictv,
)
available_ranks = tax_assign.available_ranks
except ValueError as exc:
Expand Down Expand Up @@ -113,6 +115,7 @@ def metagenome(args):
keep_full_identifiers=args.keep_full_identifiers,
keep_identifier_versions=args.keep_identifier_versions,
lins=args.lins,
ictv=args.ictv,
)
except ValueError as exc:
error(f"ERROR: {str(exc)}")
Expand Down Expand Up @@ -258,6 +261,7 @@ def genome(args):
keep_identifier_versions=args.keep_identifier_versions,
force=args.force,
lins=args.lins,
ictv=args.ictv,
)
available_ranks = tax_assign.available_ranks

Expand Down Expand Up @@ -297,6 +301,7 @@ def genome(args):
keep_full_identifiers=args.keep_full_identifiers,
keep_identifier_versions=args.keep_identifier_versions,
lins=args.lins,
ictv=args.ictv,
)

except ValueError as exc:
Expand Down Expand Up @@ -402,6 +407,7 @@ def annotate(args):
keep_identifier_versions=args.keep_identifier_versions,
force=args.force,
lins=args.lins,
ictv=args.ictv,
)

except ValueError as exc:
Expand Down Expand Up @@ -466,6 +472,7 @@ def annotate(args):
raw=row,
id_col=id_col,
lins=args.lins,
ictv=args.ictv,
keep_full_identifiers=args.keep_full_identifiers,
keep_identifier_versions=args.keep_identifier_versions,
)
Expand Down Expand Up @@ -591,6 +598,7 @@ def summarize(args):
keep_full_identifiers=args.keep_full_identifiers,
keep_identifier_versions=args.keep_identifier_versions,
lins=args.lins,
ictv=args.ictv,
)
except ValueError as exc:
error("ERROR while loading taxonomies!")
Expand Down Expand Up @@ -637,6 +645,8 @@ def summarize(args):
rank = lineage[-1].rank
if args.lins:
inf = LINLineageInfo(lineage=lineage)
elif args.ictv:
inf = ICTVRankLineageInfo(lineage=lineage)
else:
inf = RankLineageInfo(lineage=lineage)
lin = inf.display_lineage()
Expand Down
Loading

0 comments on commit b644174

Please sign in to comment.