Skip to content

Small bugfix + Conda environment change for MacOS #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 17 additions & 13 deletions run_tapioca.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@
" See example input file on the Tapioca GitHub (https://github.com/FunctionLab/tapioca)"

INVALID_NORM_CONTENT_MSG = "\n Error: Invalid data content/structure. %s must be reformatted to fit expected structure." \
" See example normlaized input file on the Tapioca GitHub" \
"(https://github.com/FunctionLab/tapioca)"
" See example normlaized input file on the Tapioca GitHub" \
"(https://github.com/FunctionLab/tapioca)"


def validate_file(file_name, prenorm):
#validate file name and path.
# validate file name and path.
if not valid_path(file_name):
print(INVALID_PATH_MSG % (file_name))
quit()
elif not valid_filetype(file_name):
print(INVALID_FILETYPE_MSG % (file_name))
quit()
elif not validate_file_structure(file_name,prenorm):
elif not validate_file_structure(file_name, prenorm):
if prenorm:
print(INVALID_CONTENT_MSG % (file_name))
else:
Expand All @@ -41,7 +41,8 @@ def valid_path(path):
# validate file path
return os.path.exists(path)

def validate_file_structure(path,prenorm):

def validate_file_structure(path, prenorm):
# validate file contents
table = pd.read_csv(path)
cols = list(table.columns)
Expand All @@ -63,7 +64,7 @@ def validate_file_structure(path,prenorm):
pass_flag = False

for col in cols[3:]:
if not col.replace('.','').isnumeric():
if not col.replace('.', '').isnumeric():
print('Error: all curve data points (ex. temperatures) should be a number, '+str(col)+'is not a number.'
)
pass_flag = False
Expand All @@ -86,7 +87,8 @@ def validate_file_structure(path,prenorm):

def main():
# create parser object
parser = argparse.ArgumentParser(description="A Command Line Interface For Running Tapioca")
parser = argparse.ArgumentParser(
description="A Command Line Interface For Running Tapioca")

# defining arguments for parser object
parser.add_argument("-i", "--input", type=str, nargs=1,
Expand Down Expand Up @@ -127,24 +129,26 @@ def main():
args.fullmodel = bool(args.fullmodel[0])

# Check that the input file exists
if args.input == None:
if args.input is None:
print('Error: No input file provided.')
quit()

# Validate the Input
validate_file(input_check, args.prenorm)


# Convert Namespace object to dictionary so that
# if savename is not present, we can safely set a default name
args_dict = vars(args) # type: Dict

# If savename is None then set a default name based on the time
if args.savename == None:
if "savename" not in args_dict:
current_datatime = str(datetime.datetime.now()).replace('-', '').replace(':', '') \
.split('.')[0].replace(' ', '')
.split('.')[0].replace(' ', '')
args.savename = current_datatime
else:
args.savename = args.savename[0]

if args.tissue == None:
if "tissue" not in args_dict:
args.tissue = ''
else:
args.tissue = args.tissue[0]
Expand All @@ -162,4 +166,4 @@ def main():

if __name__ == "__main__":
# calling the main function
main()
main()
122 changes: 12 additions & 110 deletions tapioca_env_mac.yml
Original file line number Diff line number Diff line change
@@ -1,115 +1,17 @@
name: Tapioca
channels:
- conda-forge
- anaconda
- defaults
dependencies:
- appnope=0.1.2=py39hecd8cb5_1001
- argon2-cffi=21.3.0=pyhd3eb1b0_0
- argon2-cffi-bindings=21.2.0=py39hca72f7f_0
- asttokens=2.0.5=pyhd3eb1b0_0
- attrs=21.4.0=pyhd3eb1b0_0
- backcall=0.2.0=pyhd3eb1b0_0
- beautifulsoup4=4.11.1=py39hecd8cb5_0
- blas=1.0=mkl
- bleach=4.1.0=pyhd3eb1b0_0
- bottleneck=1.3.4=py39h67323c0_0
- ca-certificates=2022.4.26=hecd8cb5_0
- certifi=2022.6.15=py39hecd8cb5_0
- cffi=1.15.0=py39hc55c11b_1
- debugpy=1.5.1=py39he9d5cce_0
- decorator=5.1.1=pyhd3eb1b0_0
- defusedxml=0.7.1=pyhd3eb1b0_0
- entrypoints=0.4=py39hecd8cb5_0
- executing=0.8.3=pyhd3eb1b0_0
- icu=58.2=h0a44026_3
- intel-openmp=2021.4.0=hecd8cb5_3538
- ipykernel=6.9.1=py39hecd8cb5_0
- ipython=8.3.0=py39hecd8cb5_0
- ipython_genutils=0.2.0=pyhd3eb1b0_1
- ipywidgets=7.6.5=pyhd3eb1b0_1
- jedi=0.18.1=py39hecd8cb5_1
- jinja2=3.0.3=pyhd3eb1b0_0
- joblib=1.1.0=pyhd3eb1b0_0
- jpeg=9e=hca72f7f_0
- jsonschema=4.4.0=py39hecd8cb5_0
- jupyter=1.0.0=py39hecd8cb5_7
- jupyter_client=7.2.2=py39hecd8cb5_0
- jupyter_console=6.4.3=pyhd3eb1b0_0
- jupyter_core=4.10.0=py39hecd8cb5_0
- jupyterlab_pygments=0.1.2=py_0
- jupyterlab_widgets=1.0.0=pyhd3eb1b0_1
- libcxx=14.0.6=h9765a3e_0
- libffi=3.4.2=hecd8cb5_6
- libgfortran=3.0.1=h93005f0_2
- libpng=1.6.37=ha441bb4_0
- libsodium=1.0.18=h1de35cc_0
- llvm-openmp=12.0.0=h0dcd299_1
- markupsafe=2.1.1=py39hca72f7f_0
- matplotlib-inline=0.1.2=pyhd3eb1b0_2
- mistune=0.8.4=py39h9ed2024_1000
- mkl=2021.4.0=hecd8cb5_637
- mkl-service=2.4.0=py39h9ed2024_0
- mkl_fft=1.3.1=py39h4ab4a9b_0
- mkl_random=1.2.2=py39hb2f4e1b_0
- nbclient=0.5.13=py39hecd8cb5_0
- nbconvert=6.4.4=py39hecd8cb5_0
- nbformat=5.3.0=py39hecd8cb5_0
- ncurses=6.4=hcec6c5f_0
- nest-asyncio=1.5.5=py39hecd8cb5_0
- notebook=6.4.11=py39hecd8cb5_0
- numexpr=2.8.1=py39h2e5f0a9_2
- numpy=1.22.3=py39h2e5f0a9_0
- numpy-base=1.22.3=py39h3b1a694_0
- openssl=1.1.1t=hca72f7f_0
- packaging=21.3=pyhd3eb1b0_0
- pandas=1.4.2=py39he9d5cce_0
- pandocfilters=1.5.0=pyhd3eb1b0_0
- parso=0.8.3=pyhd3eb1b0_0
- pexpect=4.8.0=pyhd3eb1b0_3
- pickleshare=0.7.5=pyhd3eb1b0_1003
- pip=23.0.1=py39hecd8cb5_0
- prometheus_client=0.13.1=pyhd3eb1b0_0
- prompt-toolkit=3.0.20=pyhd3eb1b0_0
- prompt_toolkit=3.0.20=hd3eb1b0_0
- ptyprocess=0.7.0=pyhd3eb1b0_2
- pure_eval=0.2.2=pyhd3eb1b0_0
- pycparser=2.21=pyhd3eb1b0_0
- pygments=2.11.2=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pyqt=5.9.2=py39h23ab428_6
- pyrsistent=0.18.0=py39hca72f7f_0
- python=3.9.16=h218abb5_2
- python-dateutil=2.8.2=pyhd3eb1b0_0
- python-fastjsonschema=2.15.1=pyhd3eb1b0_0
- pytz=2022.1=py39hecd8cb5_0
- pyzmq=22.3.0=py39he9d5cce_2
- qt=5.9.7=h468cd18_1
- qtconsole=5.3.0=pyhd3eb1b0_0
- qtpy=2.0.1=pyhd3eb1b0_0
- readline=8.2=hca72f7f_0
- scikit-learn=0.24.2=py39hb2f4e1b_0
- scipy=1.7.3=py39h8c7af03_0
- send2trash=1.8.0=pyhd3eb1b0_1
- setuptools=65.6.3=py39hecd8cb5_0
- sip=4.19.13=py39h23ab428_0
- six=1.16.0=pyhd3eb1b0_1
- soupsieve=2.3.1=pyhd3eb1b0_0
- sqlite=3.41.1=h6c40b1e_0
- stack_data=0.2.0=pyhd3eb1b0_0
- terminado=0.13.1=py39hecd8cb5_0
- testpath=0.6.0=py39hecd8cb5_0
- threadpoolctl=2.2.0=pyh0d69192_0
- tk=8.6.12=h5d9f67b_0
- tornado=6.1=py39h9ed2024_0
- traitlets=5.1.1=pyhd3eb1b0_0
- typing-extensions=4.1.1=hd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- tzdata=2022g=h04d1e81_0
- wcwidth=0.2.5=pyhd3eb1b0_0
- webencodings=0.5.1=py39hecd8cb5_1
- wheel=0.38.4=py39hecd8cb5_0
- widgetsnbextension=3.5.2=py39hecd8cb5_0
- xz=5.2.10=h6c40b1e_1
- zeromq=4.3.4=h23ab428_0
- zlib=1.2.13=h4dc903c_0
prefix: /opt/anaconda3/envs/Tapioca
- python==3.9.6
- jupyter==1.0.0
- conda-tree==1.1.0
- jpeg==9e
- sip==6.7.12
- scikit-learn==0.24.2
- typing-extensions==4.1.1
- icu==73.2
- libpng==1.6.37
- pandas==1.4.2
- libsqlite==3.45.2