Skip to content

Commit

Permalink
Fixed all bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
spirosmaggioros committed Jul 18, 2024
1 parent 6c66403 commit 2367bd6
Show file tree
Hide file tree
Showing 16 changed files with 1,932 additions and 1,473 deletions.
32 changes: 19 additions & 13 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,34 @@

import os
import sys
sys.path.insert(0, os.path.abspath('../'))

project = 'spare-scores'
copyright = '2024, Gyujoon Hwang, George Aidinis'
author = 'Gyujoon Hwang, George Aidinis'
release = '2024'
sys.path.insert(0, os.path.abspath("../"))

project = "spare-scores"
copyright = "2024, Gyujoon Hwang, George Aidinis"
author = "Gyujoon Hwang, George Aidinis"
release = "2024"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = ['sphinx.ext.todo', 'sphinx.ext.viewcode', 'sphinx.ext.autodoc', 'sphinx_toolbox.sidebar_links', 'sphinx_toolbox.github']

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
extensions = [
"sphinx.ext.todo",
"sphinx.ext.viewcode",
"sphinx.ext.autodoc",
"sphinx_toolbox.sidebar_links",
"sphinx_toolbox.github",
]

templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

github_username = 'CBICA'
github_repository = 'github.com/CBICA/spare_score'
github_username = "CBICA"
github_repository = "github.com/CBICA/spare_score"

html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']
html_theme = "sphinx_rtd_theme"
html_static_path = ["_static"]
96 changes: 63 additions & 33 deletions merge_ROI_demo_and_test.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import argparse

import pandas as pd

from spare_scores import spare_test

def merge_and_test(roi_file,
demographic_file,
model_path,
key_var,
output_file,
spare_column_name,
verbose,
logs_file):


def merge_and_test(
roi_file,
demographic_file,
model_path,
key_var,
output_file,
spare_column_name,
verbose,
logs_file,
):

# Read the input CSV files into pandas DataFrames
df_roi = pd.read_csv(roi_file)
df_demographic = pd.read_csv(demographic_file)
Expand All @@ -21,16 +26,19 @@ def merge_and_test(roi_file,
merged_df = pd.merge(df_roi, df_demographic, on=key_var)

# Call the spare_test function from the spare_scores package
result = spare_test(merged_df,
model_path,
key_var,
output_file,
spare_column_name,
verbose,
logs_file)
result = spare_test(
merged_df,
model_path,
key_var,
output_file,
spare_column_name,
verbose,
logs_file,
)

return result


if __name__ == "__main__":
# Example usage:
# python merge_ROI_demo_and_test.py -i spare_scores/data/example_data_ROIs.csv \
Expand All @@ -41,27 +49,49 @@ def merge_and_test(roi_file,
# -l zzz_logs.txt \
# -sv SPARE_score
# # Create an ArgumentParser object
parser = argparse.ArgumentParser(description='Spare Scores Analysis')
parser = argparse.ArgumentParser(description="Spare Scores Analysis")

# Define the command-line arguments
parser.add_argument('-i', '--input', required=True, help='Input ROI CSV file')
parser.add_argument('-d', '--demographic', required=True, help='Input demographic CSV file')
parser.add_argument('-m', '--model', required=True, help='Model for spare_train')
parser.add_argument('-kv', '--key_var', required=False, default='', help='The key variable of the dataset.')
parser.add_argument('-o', '--output', required=False, default='', help='Output CSV file')
parser.add_argument('-l', '--logs', required=False, default='', help='Output logs file')
parser.add_argument('-sv', '--spare_var', required=False, default='SPARE_score', help='Column for calculated spare score')
parser.add_argument('-v', '--verbose', required=False, default=1, help='Type of logging messages.')
parser.add_argument("-i", "--input", required=True, help="Input ROI CSV file")
parser.add_argument(
"-d", "--demographic", required=True, help="Input demographic CSV file"
)
parser.add_argument("-m", "--model", required=True, help="Model for spare_train")
parser.add_argument(
"-kv",
"--key_var",
required=False,
default="",
help="The key variable of the dataset.",
)
parser.add_argument(
"-o", "--output", required=False, default="", help="Output CSV file"
)
parser.add_argument(
"-l", "--logs", required=False, default="", help="Output logs file"
)
parser.add_argument(
"-sv",
"--spare_var",
required=False,
default="SPARE_score",
help="Column for calculated spare score",
)
parser.add_argument(
"-v", "--verbose", required=False, default=1, help="Type of logging messages."
)

# Parse the command-line arguments
args = parser.parse_args()

# Call the merge_and_test function with the provided arguments
merge_and_test(args.input,
args.demographic,
args.model,
args.key_var,
args.output,
args.spare_var,
args.verbose,
args.logs)
merge_and_test(
args.input,
args.demographic,
args.model,
args.key_var,
args.output,
args.spare_var,
args.verbose,
args.logs,
)
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ test=pytest
[flake8]
statistics = true
exclude = .git
ignore = E203, E501, W503, B950
ignore = E203, E501, E722, W503, B950
select = B,C,E,F,W,T4,B9
per-file-ignores =
__init__.py: F401, F403
Expand Down
53 changes: 29 additions & 24 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,32 @@
this_directory = Path(__file__).parent
long_description = (this_directory / "README.md").read_text()

setup(name='spare_scores',
version='1.2.1',
description='Compute characteristic brain signatures of your case population.',
long_description=long_description,
long_description_content_type='text/markdown',
author='Gyujoon Hwang, George Aidinis',
author_email='[email protected], [email protected]',
license='https://www.med.upenn.edu/cbica/software-agreement-non-commercial.html',
packages=find_packages(),
package_data={'spare_scores':['mdl/*.pkl.gz','data/*.csv']},
include_package_data=True,
install_requires=['numpy',
'pandas',
'setuptools',
'scikit-learn',
'torch<2.3.1',
'matplotlib',
'optuna'],
entry_points={
'console_scripts': ["spare_score = spare_scores.cli:main",
"spare_scores = spare_scores.cli:main",
"SPARE = spare_scores.cli:main"]
},
)
setup(
name="spare_scores",
version="1.2.1",
description="Compute characteristic brain signatures of your case population.",
long_description=long_description,
long_description_content_type="text/markdown",
author="Gyujoon Hwang, George Aidinis",
author_email="[email protected], [email protected]",
license="https://www.med.upenn.edu/cbica/software-agreement-non-commercial.html",
packages=find_packages(),
package_data={"spare_scores": ["mdl/*.pkl.gz", "data/*.csv"]},
include_package_data=True,
install_requires=[
"numpy",
"pandas",
"setuptools",
"scikit-learn",
"torch<2.3.1",
"matplotlib",
"optuna",
],
entry_points={
"console_scripts": [
"spare_score = spare_scores.cli:main",
"spare_scores = spare_scores.cli:main",
"SPARE = spare_scores.cli:main",
]
},
)
Loading

0 comments on commit 2367bd6

Please sign in to comment.