From 184fa6ec204cfb488e0e9890c3eb37f9a78c008b Mon Sep 17 00:00:00 2001 From: ecwood Date: Wed, 17 Jul 2024 15:09:18 -0700 Subject: [PATCH] #140 made sure its only defined once --- build/Snakefile-post-etl | 2 +- build/build-kg2-snakemake.sh | 10 ++++------ build/snakemake-config-var.yaml | 2 -- master-config.shinc | 2 ++ neo4j/tsv-to-neo4j.sh | 5 ++--- process/run-simplify.sh | 7 +++---- 6 files changed, 12 insertions(+), 16 deletions(-) diff --git a/build/Snakefile-post-etl b/build/Snakefile-post-etl index e6de67ee..62ccffd7 100644 --- a/build/Snakefile-post-etl +++ b/build/Snakefile-post-etl @@ -126,7 +126,7 @@ rule Simplify: log: config['SIMPLIFY_LOG'] shell: - "bash -x {input.code} {input.nodes} {input.edges} {output.nodes} {output.edges} " + config['VERSION_FILE'] + " " + config['TEST_FLAG'] + " > {log} 2>&1" + "bash -x {input.code} {input.nodes} {input.edges} {output.nodes} {output.edges} " + config['TEST_FLAG'] + " > {log} 2>&1" rule Slim: input: diff --git a/build/build-kg2-snakemake.sh b/build/build-kg2-snakemake.sh index 6d313846..96d00935 100755 --- a/build/build-kg2-snakemake.sh +++ b/build/build-kg2-snakemake.sh @@ -64,8 +64,6 @@ then run_flag="-F" fi -kg2_version_file="kg2-version.txt" -local_kg2_version_file="${BUILD_DIR}/${kg2_version_file}" trigger_file_is_major_release=${BUILD_DIR}/major-release trigger_file_is_minor_release=${BUILD_DIR}/minor-release @@ -89,14 +87,14 @@ if [[ "${ci_flag}" == "ci" ]] then sed -i "\@^kg2_version=@ckg2_version=KG2.CI" ${CODE_DIR}/master-config.shinc else - ${s3_cp_cmd} s3://${s3_bucket_public}/${kg2_version_file} ${local_kg2_version_file} + ${s3_cp_cmd} s3://${s3_bucket_public}/${kg2_version_file} ${kg2_version_file_local} if [[ "${increment_flag}" != '' ]] then - ${VENV_DIR}/bin/python3 ${PROCESS_CODE_DIR}/update_version.py ${increment_flag} ${local_kg2_version_file} + ${VENV_DIR}/bin/python3 ${PROCESS_CODE_DIR}/update_version.py ${increment_flag} ${kg2_version_file_local} else echo "*** TEST MODE -- NO INCREMENT ***" fi - curr_kg2_version=`cat ${local_kg2_version_file}` + curr_kg2_version=`cat ${kg2_version_file_local}` sed -i "\@^kg2_version=@ckg2_version=${curr_kg2_version}" ${CODE_DIR}/master-config.shinc fi @@ -156,7 +154,7 @@ cd ~ && ${VENV_DIR}/bin/snakemake --snakefile ${snakefile} ${run_flag} -R Finish if [[ "${ci_flag}" != "ci" ]] then - ${s3_cp_cmd} ${local_kg2_version_file} s3://${s3_bucket_public}/${kg2_version_file} + ${s3_cp_cmd} ${kg2_version_file_local} s3://${s3_bucket_public}/${kg2_version_file} fi if [[ -f ${trigger_file_is_major_release} ]] diff --git a/build/snakemake-config-var.yaml b/build/snakemake-config-var.yaml index c811da79..a751dc4c 100644 --- a/build/snakemake-config-var.yaml +++ b/build/snakemake-config-var.yaml @@ -291,5 +291,3 @@ kg2_tsv_tarball: ${BUILD_DIR}/kg2-tsv-for-neo4j${version_suffix}${test_suffix}.t tsv_placeholder: ${BUILD_DIR}/tsv_placeholder.empty finish_script: ${BUILD_CODE_DIR}/finish-snakemake.sh - -version_file: ${BUILD_DIR}/kg2-version.txt diff --git a/master-config.shinc b/master-config.shinc index 97fb5956..ac6dd9e5 100644 --- a/master-config.shinc +++ b/master-config.shinc @@ -30,4 +30,6 @@ ont_load_inventory_file=${MAPS_CODE_DIR}/ont-load-inventory${test_suffix}.yaml rtx_config_file=RTXConfiguration-config.json biolink_model_version=4.2.0 infores_registry_version=0.2.8 +kg2_version_file=version.txt +kg2_version_file_local=${BUILD_DIR}/${kg2_version_file} kg2_version= \ No newline at end of file diff --git a/neo4j/tsv-to-neo4j.sh b/neo4j/tsv-to-neo4j.sh index 2fd03361..07c2f692 100755 --- a/neo4j/tsv-to-neo4j.sh +++ b/neo4j/tsv-to-neo4j.sh @@ -54,9 +54,8 @@ rm -r -f ${tsv_dir} mkdir -p ${tsv_dir} # get the latest KG2 version -kg2_version_file="kg2-version.txt" -${s3_cp_cmd} s3://${s3_bucket}/${kg2_version_file} ${BUILD_DIR}/${kg2_version_file} -kg2_version=`cat ${BUILD_DIR}/${kg2_version_file}` +${s3_cp_cmd} s3://${s3_bucket}/${kg2_version_file} ${kg2_version_file_local} +kg2_version=`cat ${kg2_version_file_local}` # download the latest TSV files from the S3 Bucket ${s3_cp_cmd} s3://${s3_bucket}/kg2-tsv-for-neo4j-${kg2_version}${test_arg}.tar.gz ${tsv_tarball} diff --git a/process/run-simplify.sh b/process/run-simplify.sh index 6a8951b7..4a033273 100755 --- a/process/run-simplify.sh +++ b/process/run-simplify.sh @@ -10,7 +10,7 @@ if [[ "${1:-}" == "--help" || "${1:-}" == "-h" ]]; then exit 2 fi -# Usage: run-simplify.sh [version_filename] [test] +# Usage: run-simplify.sh [test] echo "================= starting run-simplify.sh ==================" date @@ -22,15 +22,14 @@ input_nodes_json=${1:-} input_edges_json=${2:-} output_nodes_json=${3:-} output_edges_json=${4:-} -local_version_filename=${5:-"${BUILD_DIR}/kg2-version.txt"} -build_flag=${6:-""} +build_flag=${5:-""} # TODO: Inhibits and increase are not in biolink model anymore - Find out what that should be now ${VENV_DIR}/bin/python3 -u ${PROCESS_CODE_DIR}/filter_kg_and_remap_predicates.py ${test_flag} --dropNegated \ --dropSelfEdgesExcept interacts_with,regulates,inhibits,increase \ ${predicate_mapping_file} ${infores_mapping_file} ${curies_to_urls_file} \ ${knowledge_level_agent_type_mapping_file} ${input_nodes_json} ${input_edges_json} \ - ${output_nodes_json} ${output_edges_json} ${local_version_filename} + ${output_nodes_json} ${output_edges_json} ${kg2_version_file_local} date echo "================= finishing run-simplify.sh =================="