Make functional

This commit is contained in:
2024-07-22 16:33:35 -04:00
parent 8cf3703b0c
commit 258fd070ef

View File

@@ -138,7 +138,6 @@ parse_input() {
fi fi
} }
# @section Helper functions # @section Helper functions
# @internal # @internal
module() { module() {
@@ -188,9 +187,9 @@ install_dependencies() {
debug "Running: ${FUNCNAME[0]}" "$@" debug "Running: ${FUNCNAME[0]}" "$@"
# Dependency arrays # Dependency arrays
depends_rpm=(graphviz pandoc pdftk-java gd-devel) depends_rpm=(graphviz pandoc pdftk-java gd-devel shdoc)
depends_deb=(graphviz pandoc pdftk-java libgd-dev) depends_deb=(graphviz pandoc pdftk-java libgd-dev shdoc)
depends_brew=(graphiz pandoc gd pdftk-java) depends_brew=(graphiz pandoc gd pdftk-java shdoc)
depends_perl=(File::Map ExtUtils::PkgConfig GD GO::TermFinder) depends_perl=(File::Map ExtUtils::PkgConfig GD GO::TermFinder)
depends_r=(BiocManager ontologyIndex ggrepel tidyverse sos openxlsx ggplot2 depends_r=(BiocManager ontologyIndex ggrepel tidyverse sos openxlsx ggplot2
plyr extrafont gridExtra gplots stringr plotly ggthemes pandoc rmarkdown) plyr extrafont gridExtra gplots stringr plotly ggthemes pandoc rmarkdown)
@@ -501,11 +500,8 @@ py_gtf() {
shopt -u nullglob shopt -u nullglob
for s in "${set2[@]}"; do for s in "${set2[@]}"; do
echo "$PERL analyze_v2.pl -an gene_association.sgd -as P -o gene_ontology_edit.obo -b $set1 $s" pl_analyze "$set1" "$s"
echo "TODO: analyze_v2.pl should be translated" pl_terms2tsv "$s"
"$PERL" analyze_v2.pl -an gene_association.sgd -as P -o gene_ontology_edit.obo -b "$set1" "$s"
echo "$PERL terms2tsv_v4.pl $s.terms > $s.tsv"
echo "TODO: terms2tsv_v4.pl should be translated"
"$PERL" terms2tsv_v4.pl "$s.terms" > "$s.tsv" "$PERL" terms2tsv_v4.pl "$s.terms" > "$s.tsv"
done done
@@ -518,36 +514,59 @@ py_gtf() {
popd || return 1 popd || return 1
} }
# @description Perl analyze submodule
# @arg $1 string "Set 1"
# @arg $@ string
pl_analyze() {
:
}
pl_terms2tsv() {
:
}
# Perform operations in each directory # Perform operations in each directory
for d in "$process_dir" "$function_dir" "$component_dir"; do for d in "$process_dir" "$function_dir" "$component_dir"; do
set1="ORF_List_Without_DAmPs.txt" set1="ORF_List_Without_DAmPs.txt"
out_file="${d##*/}Results.txt" # Use the dirname to create each Results filename out_file="${d##*/}Results.txt" # Use the dirname to create each Results filename
_process "$d" & # parallelize _process "$d" & # parallelize
done done
}
submodule pl_analyze
# @description Perl analyze submodule
# This seems weird to me because we're just overwriting the same data for all set2 members
# https://metacpan.org/dist/GO-TermFinder/view/examples/analyze.pl
# Is there a reason you need a custom version and not the original from cpan?
# @arg $1 string Set 1
# @arg $2 string Set 2
pl_analyze() {
script="analyze_v2.pl"
an="gene_association.sgd"
out_file="gene_ontology_edit.obo"
debug "$PERL $script -an $an -as P -o $out_file -b $1 $2"
"$PERL" "$script" -an "$an" -as P -o "$out_file" -b "$1" "$2"
}
submodule pl_terms2tsv
# @description Perl terms2tsv submodule
# Probably should be translated to shell/python
# @arg $1 string Set 2
pl_terms2tsv() {
script="terms2tsv_v4.pl"
debug "$PERL $script $1.terms > $1.tsv"
"$PERL" "$script" "$1.terms" > "$1.tsv"
}
submodule documentation
# @section Documentation
# @description Generates markdown documentation from this script using shdoc
documentation() {
debug "Running: ${FUNCNAME[0]}"
# Print markdown to stdout
shdoc < "$SCRIPT"
# Create markdown file
shdoc < "$SCRIPT" > documentation.md
} }
# @description Compile GTF in R # @description Compile GTF in R
r_compile_gtf() { r_compile_gtf() {
debug "Running: ${FUNCNAME[0]}" debug "Running: ${FUNCNAME[0]}"
@@ -564,7 +583,8 @@ main() {
debug "Running: ${FUNCNAME[0]}" "$@" debug "Running: ${FUNCNAME[0]}" "$@"
# Where are we located? # Where are we located?
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) SCRIPT=$(realpath -s "${BASH_SOURCE[0]}")
SCRIPT_DIR=$(dirname "$SCRIPT")
# Set the automatic project directory prefix # Set the automatic project directory prefix
PROJECT_PREFIX="$(whoami)_$(date +%y_%m_%d)" PROJECT_PREFIX="$(whoami)_$(date +%y_%m_%d)"