diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..d0c3cbf1020d5c292abdedf27627c6abe25e2293 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = source +BUILDDIR = build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000000000000000000000000000000000000..747ffb7b3033659bdd2d1e6eae41ecb00358a45e --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=source +set BUILDDIR=build + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/Notizen.md b/docs/source/Notizen.md similarity index 100% rename from Notizen.md rename to docs/source/Notizen.md diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 0000000000000000000000000000000000000000..f305360a75bf69efe043c85d3a799882fc2c4529 --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,35 @@ +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information + +project = 'Autoencoder BigData_Praktikum' +copyright = '2023, Franziska Roepke, Harpreet Int-Veen, Paul Kühnel' +author = 'Franziska Roepke, Harpreet Int-Veen, Paul Kühnel' +release = '0.1' + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = ['sphinx.ext.todo', + 'sphinx.ext.duration', + 'sphinx.ext.doctest', + 'sphinx.ext.autodoc', + 'sphinx.ext.viewcode', + 'sphinx.ext.autosummary'] + +templates_path = ['_templates'] +exclude_patterns = ['_build', '*.loom', '.DS_Store'] + +source_suffix = ['.rst', '.md'] + + + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_theme = 'alabaster' +html_static_path = ['_static'] diff --git a/testfiles/how_to_fix_loompy_error.md b/docs/source/how_to_fix_loompy_error.md similarity index 100% rename from testfiles/how_to_fix_loompy_error.md rename to docs/source/how_to_fix_loompy_error.md diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 0000000000000000000000000000000000000000..80a76a3f87d5490948533d3279101855083fa8d8 --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,52 @@ +.. Autoencoder BigData_Praktikum documentation master file, created by + sphinx-quickstart on Fri May 26 14:36:45 2023. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to Autoencoder BigData_Praktikum's documentation! +========================================================= + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + + +.. note:: + + This project is under active development. + + +Development +=========== + +Notes +----- + +Some notes during development: + +.. toctree:: + + Notizen + + +Main documentation +================== + +See API + +API +=== + +.. autosummary:: + :toctree: generated + + main_methods diff --git a/main_methods.py b/main_methods.py index f51d2929fb55c1a1cf6102e94fc2741e93bfa3b9..3f0ca7942d67e7a992d935c89f5b6daca72a7ff3 100644 --- a/main_methods.py +++ b/main_methods.py @@ -1,21 +1,36 @@ import loompy import pandas as pd +import os def loom_to_pandas_df(file_name="testfiles/test.loom"): """ - :param file_name: the name of the loom file (default is: "testfiles/test.loom") + :param file_name: the name of the loom file (default is: + "testfiles/test.loom") :return: pandas DataFrame """ df = pd.DataFrame # Empty DataFrame - to return in case of wrong formatting - - if file_name[-4:] != ".loom": + if file_name[-5:] != ".loom": print(f"{file_name} is not a valid file name. Only use '.loom' files!") with loompy.connect(file_name) as ds: try: - df = pd.DataFrame(data=ds[:, :], index=ds.ra.Gene, columns=ds.ca.input_name) + df = pd.DataFrame(data=ds[:, :], + index=ds.ra.Gene, + columns=ds.ca.input_name) except AttributeError or ValueError or OSError: - raise Exception(f"The loom file {file_name} does not exist or has no valid format!") + raise Exception(f"The loom file {file_name} does not exist or has " + f"no valid format!") return df + + +print(os.getcwd()) +os.chdir("testfiles") +print(os.getcwd()) +# print(os.listdir()) +test_df = loom_to_pandas_df("AllelicExpressionPatterns-mouse-brain-SS2.loom") +test_df.info() +test_df.describe() +print(".........") +print(test_df) diff --git a/testfiles/loom_test.py b/testfiles/loom_test.py index 1187d4ba3b133f24d54c46b2df16ee225841fec9..b4e6b07cbef8d4edad2d549a7ad47659d5bfc8a2 100644 --- a/testfiles/loom_test.py +++ b/testfiles/loom_test.py @@ -1,9 +1,19 @@ import loompy import pandas as pd -ds = loompy.connect("test.loom") -df = pd.DataFrame(data=ds[:, :], index=ds.ra.Gene, columns=ds.ca.input_name) -ds.close() +with loompy.connect("AllelicExpressionPatterns-mouse-brain-SS2.loom") as ds: -df.info() -df.describe() \ No newline at end of file + #print(ds.ra.Gene) + print(ds.ca.input_name) + print(ds[0:10, 0:10]) + + + + + +#ds = loompy.connect("test.loom") +#df = pd.DataFrame(data=ds[:, :], index=ds.ra.Gene, columns=ds.ca.input_name) +#ds.close() + +#df.info() +#df.describe()