Package: ggca
Gene GEM Correlation Analysis (GGCA)Computes efficiently the correlation (Pearson, Spearman or Kendall) and the p-value (two-sided) between all the pairs from two datasets. It also supportsCpG Site IDs.IMPORTANT: GGCA is the heart of a platform called Multiomix. On the official website you will be able to use this library in a fast and agile way through a friendly graphical interface (along with many extra features!). Go tohttps://multiomix.org/to get started now!Python PyPi|Rust CrateIndexRequirementsUsagePythonRustContributingConsiderationsRequirementsYou need to installGSL>= 2.6 in your system to use this library.UsageThere are a few examples inexamplesfolder for both languages.PythonInstall:pip install ggcaConfigure and call thecorrelatemethod:importggca# Possible Correlation methodsSPEARMAN=1KENDALL=2PEARSON=3# Possible P-values adjustment methodsBENJAMINI_HOCHBERG=1BENJAMINI_YEKUTIELI=2BONFERRONI=3mrna_file_path="mrna.csv"gem_file_path="mirna.csv"try:(result_combinations,evaluated_combinations)=ggca.correlate(mrna_file_path,gem_file_path,correlation_method=PEARSON,correlation_threshold=0.5,sort_buf_size=2_000_000,adjustment_method=BENJAMINI_HOCHBERG,all_vs_all=True,gem_contains_cpg=False,collect_gem_dataset=None,keep_top_n=2# Keeps only top 2 elements)print(f'Number of resulting combinations:{len(result_combinations)}of{evaluated_combinations}evaluated combinations')forcombinationinresult_combinations:print(combination.gene,combination.gem,combination.correlation,combination.p_value,combination.adjusted_p_value)exceptggca.GGCADiffSamplesLengthasex:print('Raised GGCADiffSamplesLength:',ex)exceptggca.GGCADiffSamplesasex:print('Raised GGCADiffSamples:',ex)exceptggca.InvalidCorrelationMethodasex:print('Raised InvalidCorrelationMethod:',ex)exceptggca.InvalidAdjustmentMethodasex:print('Raised InvalidAdjustmentMethod:',ex)exceptggca.GGCAErrorasex:print('Raised GGCAError:',ex)RustAdd crate toCargo.toml:ggca = "0.4.0"Create an analysis and run it:useggca::adjustment::AdjustmentMethod;useggca::analysis::Analysis;useggca::correlation::CorrelationMethod;// File's pathsletdf1_path="mrna.csv";letdf2_path="mirna.csv";// Some parametersletgem_contains_cpg=false;letis_all_vs_all=true;letkeep_top_n=Some(10);// Keeps the top 10 of correlation (sorting by abs values)letcollect_gem_dataset=None;// Better performance. Keep small GEM files in memoryletanalysis=Analysis::new_from_files(df1_path.to_string(),df2_path.to_string(),false);let(result,number_of_elements_evaluated)=analysis.compute(CorrelationMethod::Pearson,0.7,2_000_000,AdjustmentMethod::BenjaminiHochberg,is_all_vs_all,collect_gem_dataset,keep_top_n,)?;println!("Number of elements -> {} of {} combinations evaluated",result.len(),number_of_elements_evaluated);forcor_p_valueinresult.iter(){println!("{}",cor_p_value);}Note thatenv_loggercrate is used to provide some warning in case some mRNA/GEM combinations produce NaN values (for instance, because the input array has 0 std). In that case, you can add RUST_LOG=warn to your command to produce warnings in the stderr. E.g:RUST_LOG=warn cargo test --no-default-features --testsorRUST_LOG=warn cargo run --example basic --no-default-featuresContributingAll kind of help is welcome! Feel free o submit an issue or a PR. There are some TODOs which are listed below:Parallelize iterators to improve performanceMake Rust enums accessible from PythonAdd support for Windows OSAdd Rust documentationAdd testsAdd MyPy supportDevelopingWe provide a Docker image to execute all the commands listed below:Build for rust: cargo build [--release]Build for Python (uses Maturin):First of all, remove thetarget/wheelsfolder:rm -rf ./target/wheelsBuild wheels:docker run --rm -v $(pwd):/io jwaresolutions/ggca-build:0.2.3 maturin build --release --skip-auditwheel --manylinux=2014Repair wheels to include some missing.sofiles:docker run --rm -v $(pwd):/io jwaresolutions/ggca-build:0.2.3 ./repair-wheels.shOnly for development:To run the examples you must run with this command due toan issuewith Pyo3:cargo run [--release] --no-default-features --example <example>In Python you can test with Maturin:Maturin develop (installs the package in your current virtualenv):maturin developMaturin build (just builds the wheel for your current Python version):maturin build --manylinux=1-uncheckedTo publish in PyPi:Install twine:pip install twineUpload:twine upload ./target/wheels/wheelhouse/*TestsAll the correlation, p-values and adjusted p-values were taken fromcor.testandp.adjustfunctions from the R programming language andstatsmodelspackage for Python language.Data insmall_filesfolder was retrieved with random sampling from theColorectal Adenocarcinoma (TCGA, Nature 2012)dataset. This dataset can be downloaded fromcBioPortal datasets pageorthis direct link.All the correlations results were compared directly with R-Multiomics output (old version ofmultiomix.orgonly available for R lang).PerformanceWe usecriterion.rsto perform benchmarks. In case you have made a contribution you can check that no regression was added to the project. Just runcargo bench --no-default-featuresbefore and after your changes to perform a statistical analysis of performance.ConsiderationsIf you use any part of our code, or the tool itself is useful for your research, please consider citing:@article{camele2022multiomix,
  title={Multiomix: a cloud-based platform to infer cancer genomic and epigenomic events associated with gene expression modulation},
  author={Camele, Genaro and Menazzi, Sebastian and Chanfreau, Hern{\'a}n and Marraco, Agustin and Hasperu{\'e}, Waldo and Butti, Matias D and Abba, Martin C},
  journal={Bioinformatics},
  volume={38},
  number={3},
  pages={866--868},
  year={2022},
  publisher={Oxford University Press}
}