From c9136883989728b5e8f2d2aa959f1401d5e45f8f Mon Sep 17 00:00:00 2001 From: Eric Tvedte Date: Tue, 11 Jun 2024 16:00:22 -0400 Subject: [PATCH] Add files via upload --- dist/fcs.py | 35 +++++++++++++++++++++++++++++++++-- dist/run_fcsadaptor.sh | 15 +++++++++++---- 2 files changed, 44 insertions(+), 6 deletions(-) diff --git a/dist/fcs.py b/dist/fcs.py index 2e824cc..74c1d2f 100644 --- a/dist/fcs.py +++ b/dist/fcs.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# pylint: disable=C0301,C0114,C0103,C0116,R0913,R0914,W0511,R1732,R0916 """ PUBLIC DOMAIN NOTICE National Center for Biotechnology Information @@ -35,7 +37,7 @@ CONTAINER = "run_gx" DEFAULT_CONTAINER_DB = "/app/db/gxdb/" -DEFAULT_VERSION = "0.5.0" +DEFAULT_VERSION = "0.5.4" DEFAULT_DOCKER_IMAGE = f"ncbi/fcs-gx:{DEFAULT_VERSION}" GX_BIN_DIR = Path("/app/bin") @@ -425,7 +427,36 @@ def main() -> int: parser.print_usage() sys.exit() - GlobalStat.opt_in = (not args.no_report_analytics) and ("--help" not in extra_args) and (not args.dry_run) + GlobalStat.opt_in = ( + not args.no_report_analytics + and "--help" not in extra_args + and not args.dry_run + and os.getenv("DO_NOT_TRACK", "0") == "0" # GP-37725 + and os.getenv("NCBI_FCS_REPORT_ANALYTICS", "1") == "1" # GP-37725 + ) + + if ( # If none of the banner-switches are set, display the banner. GP-37725 + not args.no_report_analytics + and os.getenv("DO_NOT_TRACK") is None + and os.getenv("NCBI_FCS_REPORT_ANALYTICS") is None + ): + print(""" +-------------------------------------------------------------------------------------------- + +NCBI collects limited usage data for each run of FCS by default. To disable usage reporting: + +python3 fcs.py --no-report-analytics ... + +or export NCBI_FCS_REPORT_ANALYTICS=1 to enable, +or export NCBI_FCS_REPORT_ANALYTICS=0 to disable the reporting. + +Usage data collected by NCBI is documented in the FCS privacy notice +at https://github.com/ncbi/fcs/blob/main/PRIVACY.md + +--------------------------------------------------------------------------------------------""", + file=sys.stderr) + + if hasattr(args, "cmd"): GlobalStat.ncbi_op = args.cmd retcode = 0 diff --git a/dist/run_fcsadaptor.sh b/dist/run_fcsadaptor.sh index 865ab8d..7b347f3 100644 --- a/dist/run_fcsadaptor.sh +++ b/dist/run_fcsadaptor.sh @@ -1,7 +1,7 @@ #!/bin/bash SCRIPT_NAME=$0 -DEFAULT_VERSION="0.5.0" +DEFAULT_VERSION="0.5.4" DOCKER_IMAGE=ncbi/fcs-adaptor:${DEFAULT_VERSION} SINGULARITY_IMAGE="" CONTAINER_ENGINE="docker" @@ -19,6 +19,7 @@ Options: --output-dir output path (required) --image dockerhub address or sif file (required for singularity only) --container-engine default docker + --debug debug Taxonomy (exactly one required): --prok prokaryotes @@ -29,6 +30,7 @@ EOF } DOCKER=docker +DEBUG="" while [[ $# -gt 0 ]] do @@ -60,6 +62,11 @@ do CONTAINER_ENGINE=$2 shift ;; + --debug) + DEBUG="--debug" + shift + ;; + -*) echo "invalid option : '$1'" usage 10 @@ -108,9 +115,9 @@ then } trap finish EXIT - $DOCKER run --init --name $CONTAINER --user "$(id -u):$(id -g)" -v $FASTA_DIRNAME:/sample-volume/ \ + $DOCKER run --rm --init --name $CONTAINER --user "$(id -u):$(id -g)" -v $FASTA_DIRNAME:/sample-volume/ \ -v $EXPANDED_OUTPUT:/output-volume/ $DOCKER_IMAGE \ - /app/fcs/bin/av_screen_x -o /output-volume/ $TAX /sample-volume/$FASTA_FILENAME + /app/fcs/bin/av_screen_x -o /output-volume/ $TAX /sample-volume/$FASTA_FILENAME $DEBUG elif [[ ${CONTAINER_ENGINE} == "singularity" ]] then @@ -118,7 +125,7 @@ then then singularity run $CONTAINER --bind $FASTA_DIRNAME:/sample-volume/ \ --bind $EXPANDED_OUTPUT:/output-volume/ $SINGULARITY_IMAGE \ - /app/fcs/bin/av_screen_x -o /output-volume/ $TAX /sample-volume/$FASTA_FILENAME + /app/fcs/bin/av_screen_x -o /output-volume/ $TAX /sample-volume/$FASTA_FILENAME $DEBUG else echo "--image is required when specifying --container-engine singularity" fi