Package: corals
CorALSCorALSis an open-source software package for the construction and analysis of large-scale correlation networks for high-dimensional data.If you useCorALSfor a scientific publication, please cite:Becker, M., Nassar, H., Espinosa, C. et al. 
Large-scale correlation network construction for unraveling the coordination of complex biological systems. 
Nat Comput Sci (2023). 
https://doi.org/10.1038/s43588-023-00429-yInstallpipinstallcoralsQuick startThe following quick start examples can also be found inan executable notebook.Note:If any of the following examples do not work, check thepreviously mentioned executable notebookas well. It is tested automatically, and thisREADMEmay not have been updated.Prepare parallelizationBefore running anything, we make sure thatnumpywill not  oversubscribe CPUs and slow things down.
Note that this has to be executedbefore importingnumpy.For full correlation matrix calculation, settingn_threads > 1can be used to parallelize the calculation.For the top-k approaches, settingn_threads=1makes the most sense, since parallelization is specified separately.fromcorals.threadsimportset_threads_for_external_librariesset_threads_for_external_libraries(n_threads=1)Load dataCreate some data (alternatively load your own):importnumpyasnp# create random datan_features=20000n_samples=50X=np.random.random((n_samples,n_features))Full correlation matrix computation# runtime: ~2 secfromcorals.correlation.full.baseimportcor_fullcor_values=cor_full(X)Top-k correlation matrix computation using Spearman correlation# runtime: ~5 sec with `n_jobs=8`fromcorals.correlation.topk.baseimportcor_topkcor_topk_result=cor_topk(X,k=0.001,correlation_type="spearman",n_jobs=8)Top-k differential correlation matrix computation using Spearman correlation# generate some more dataX1=XX2=np.random.random((n_samples,n_features))# runtime: ~5 sec with `n_jobs=8`fromcorals.correlation.topkdiff.baseimportcor_topkdiffcor_topkdiff_result=cor_topkdiff(X1,X2,k=0.001,correlation_type="spearman",n_jobs=8)Calculating p-values# reusing correlation from the top-k example# runtime: ~20 sec with `n_jobs=8`fromcorals.correlation.topk.baseimportcor_topkcor_topk_values,cor_topk_coo=cor_topk(X,correlation_type="spearman",k=0.001,n_jobs=8)fromcorals.correlation.utilsimportderive_pvalues,multiple_test_correctionn_samples=X.shape[0]n_features=X.shape[1]# calculate p-valuespvalues=derive_pvalues(cor_topk_values,n_samples)# multiple hypothesis correctionpvalues_corrected=multiple_test_correction(pvalues,n_features,method="fdr_bh")Detailed examplesFor detailed examples and recommendations, see the correspondingnotebook.Thedocs/notebooksfolder may contain additional examples and tutorials in the form of Jupyter Notebooks.Quick setup for Jupyter notebooks.exportENV_NAME=corals

condacreate-n${ENV_NAME}python=3.10
condaactivate${ENV_NAME}pipinstallcorals

condainstall-cconda-forgejupyterlab# optional if Jupyter Lab is already installedcondainstall-cconda-forgeipykernel
python-mipykernelinstall--user--name${ENV_NAME}DevelopmentTODO: add documentation for contributing new code / methodsSetupgitclonegit@github.com:mgbckr/corals-lib-python.git
pipinstall-e.Releasegittag-ax.x.x-m"Release x.x.x"