Commit 7f394c4e authored by liiskolb's avatar liiskolb

update R package

parent 7ed8e7fa
File added
......@@ -4,3 +4,4 @@ LICENSE
^.*\.png
README.md
hybrid_filtering
r-gprofiler2
......@@ -11,6 +11,7 @@ export(gsnpense)
export(mapViridis)
export(publish_gostplot)
export(publish_gosttable)
export(random_query)
export(set_base_url)
export(set_tls_version)
export(set_user_agent)
......
......@@ -20,7 +20,7 @@ gp_globals$base_url = "http://biit.cs.ut.ee/gprofiler"
#' Gene list functional enrichment.
#'
#' Interface to the g:Profiler tool g:GOSt for functional enrichments analysis of gene lists.
#' Interface to the g:Profiler tool g:GOSt (\url{https://biit.cs.ut.ee/gprofiler/gost}) for functional enrichments analysis of gene lists.
#' In case the input 'query' is a list of gene vectors, results for multiple queries will be returned in the same data frame with column 'query' indicating the corresponding query name.
#' If 'multi_query' is selected, the result is a data frame for comparing multiple input lists,
#' just as in the web tool.
......@@ -57,6 +57,8 @@ gp_globals$base_url = "http://biit.cs.ut.ee/gprofiler"
#' When requesting a 'multi_query', either TRUE or FALSE, the columns of the resulting data frame differ.
#' If 'evcodes' is set, the return value includes columns 'evidence_codes' and 'intersection'.
#' The latter conveys info about the intersecting genes between the corresponding query and term.
#'
#' The result fields are further described in \url{https://biit.cs.ut.ee/gprofiler_beta/page/apis#gost_query_results}
#' @author Liis Kolberg <liis.kolberg@@ut.ee>, Uku Raudvere <uku.raudvere@@ut.ee>
#' @examples
#' gostres <- gost(c("X:1000:1000000", "rs17396340", "GO:0005005", "ENSG00000156103", "NLRP1"))
......@@ -845,9 +847,61 @@ upload_GMT_file <- function(gmtfile){
return(custom_id)
}
#' Generate a random gene list.
#'
#' This function returns a vector of randomly selected genes from the selected organism.
#'
#' @param organism organism name. Organism names are constructed by concatenating the first letter of the name and the
#' family name. Example: human - 'hsapiens', mouse - 'mmusculus'.
#' @return a character vector containing randomly selected gene IDs from the selected organism.
#' @author Liis Kolberg <liis.kolberg@@ut.ee>
#' @examples
#' random_genes <- random_query()
#' @export
random_query <- function(organism = "hsapiens"){
url = paste0(file.path(gp_globals$base_url, "api", "gost", "random_query"), "/")
body <- jsonlite::toJSON((
list(organism = jsonlite::unbox(organism))),
auto_unbox = FALSE,
null = "null")
# Headers
headers <- list("Accept" = "application/json",
"Content-Type" = "application/json",
"charset" = "UTF-8")
oldw <- getOption("warn")
options(warn = -1)
h1 = RCurl::basicTextGatherer(.mapUnicode = FALSE)
h2 = RCurl::getCurlHandle() # Get info about the request
# Request
r = RCurl::curlPerform(
url = url,
postfields = body,
httpheader = headers,
customrequest = 'POST',
verbose = FALSE,
ssl.verifypeer = FALSE,
writefunction = h1$update,
curl = h2,
.opts = gp_globals$rcurl_opts
)
options(warn = 0)
rescode = RCurl::getCurlInfo(h2)[["response.code"]]
txt <- h1$value()
if (rescode != 200) {
stop("Bad request, response code ", rescode)
}
res <- jsonlite::fromJSON(txt)
return(res)
}
#' Gene ID conversion.
#'
#' Interface to the g:Profiler tool g:Convert that uses the information in Ensembl databases to handle hundreds of types of identifiers for genes, proteins, transcripts, microarray probesets, etc, for many species,
#' Interface to the g:Profiler tool g:Convert (\url{https://biit.cs.ut.ee/gprofiler/convert}) that uses the information in Ensembl databases to handle hundreds of types of identifiers for genes, proteins, transcripts, microarray probesets, etc, for many species,
#' experimental platforms and biological databases.
#' The input is flexible: it accepts a mixed list of IDs and recognises their types automatically.
#' It can also serve as a service to get all genes belonging to a particular functional category.
......@@ -963,7 +1017,7 @@ gconvert = function(
#' Orthology search.
#'
#' Interface to the g:Profiler tool g:Orth that, given a target organism, retrieves the genes of the target organism that are similar in sequence to the source organism genes in the input.
#' Interface to the g:Profiler tool g:Orth (\url{https://biit.cs.ut.ee/gprofiler/orth}) that, given a target organism, retrieves the genes of the target organism that are similar in sequence to the source organism genes in the input.
#'
#' @param query vector of gene IDs to be translated.
#' @param source_organism name of the source organism. Organism names are constructed by concatenating
......@@ -1079,7 +1133,7 @@ gorth <- function(
#' Convert SNP rs numbers to genes.
#'
#' Interface to the g:Profiler tool g:SNPense that maps SNP rs identifiers to chromosome positions, genes and variant effects.
#' Interface to the g:Profiler tool g:SNPense (\url{https://biit.cs.ut.ee/gprofiler/snpense}) that maps SNP rs identifiers to chromosome positions, genes and variant effects.
#' Available only for human SNPs.
#'
#' @param query vector of SNP IDs to be translated (should start with prefix 'rs').
......
file.png

308 KB

Version: 1.0
RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default
EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8
RnwWeave: Sweave
LaTeX: pdfLaTeX
AutoAppendNewline: Yes
StripTrailingWhitespace: Yes
BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageCheckArgs: --as-cran
PackageRoxygenize: rd,collate,namespace,vignette
......@@ -28,7 +28,7 @@ The output is a data.frame which is a table closely corresponding to the
web interface output.
}
\description{
Interface to the g:Profiler tool g:Convert that uses the information in Ensembl databases to handle hundreds of types of identifiers for genes, proteins, transcripts, microarray probesets, etc, for many species,
Interface to the g:Profiler tool g:Convert (\url{https://biit.cs.ut.ee/gprofiler/convert}) that uses the information in Ensembl databases to handle hundreds of types of identifiers for genes, proteins, transcripts, microarray probesets, etc, for many species,
experimental platforms and biological databases.
The input is flexible: it accepts a mixed list of IDs and recognises their types automatically.
It can also serve as a service to get all genes belonging to a particular functional category.
......
......@@ -31,7 +31,7 @@ The output is a data.frame which is a table closely corresponding to the
web interface output.
}
\description{
Interface to the g:Profiler tool g:Orth that, given a target organism, retrieves the genes of the target organism that are similar in sequence to the source organism genes in the input.
Interface to the g:Profiler tool g:Orth (\url{https://biit.cs.ut.ee/gprofiler/orth}) that, given a target organism, retrieves the genes of the target organism that are similar in sequence to the source organism genes in the input.
}
\examples{
gorth(c("Klf4","Pax5","Sox2","Nanog"), source_organism="mmusculus", target_organism="hsapiens")
......
......@@ -60,9 +60,11 @@ A named list where 'result' contains data.frame with the enrichment analysis res
When requesting a 'multi_query', either TRUE or FALSE, the columns of the resulting data frame differ.
If 'evcodes' is set, the return value includes columns 'evidence_codes' and 'intersection'.
The latter conveys info about the intersecting genes between the corresponding query and term.
The result fields are further described in \url{https://biit.cs.ut.ee/gprofiler_beta/page/apis#gost_query_results}
}
\description{
Interface to the g:Profiler tool g:GOSt for functional enrichments analysis of gene lists.
Interface to the g:Profiler tool g:GOSt (\url{https://biit.cs.ut.ee/gprofiler/gost}) for functional enrichments analysis of gene lists.
In case the input 'query' is a list of gene vectors, results for multiple queries will be returned in the same data frame with column 'query' indicating the corresponding query name.
If 'multi_query' is selected, the result is a data frame for comparing multiple input lists,
just as in the web tool.
......
......@@ -17,7 +17,7 @@ The output is a data.frame which is a table closely corresponding to the
web interface output. Columns 'ensgs' and 'gene_names' can contain list of multiple values.
}
\description{
Interface to the g:Profiler tool g:SNPense that maps SNP rs identifiers to chromosome positions, genes and variant effects.
Interface to the g:Profiler tool g:SNPense (\url{https://biit.cs.ut.ee/gprofiler/snpense}) that maps SNP rs identifiers to chromosome positions, genes and variant effects.
Available only for human SNPs.
}
\examples{
......
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gprofiler2.R
\name{random_query}
\alias{random_query}
\title{Generate a random gene list.}
\usage{
random_query(organism = "hsapiens")
}
\arguments{
\item{organism}{organism name. Organism names are constructed by concatenating the first letter of the name and the
family name. Example: human - 'hsapiens', mouse - 'mmusculus'.}
}
\value{
a character vector containing randomly selected gene IDs from the selected organism.
}
\description{
This function returns a vector of randomly selected genes from the selected organism.
}
\examples{
random_genes <- random_query()
}
\author{
Liis Kolberg <liis.kolberg@ut.ee>
}
"%R%" CMD INSTALL --build .
IF %ERRORLEVEL% NEQ 0 exit 1
#!/bin/bash
if [[ $target_platform =~ linux.* ]] || [[ $target_platform == win-32 ]] || [[ $target_platform == win-64 ]] || [[ $target_platform == osx-64 ]]; then
export DISABLE_AUTOBREW=1
mv DESCRIPTION DESCRIPTION.old
grep -v '^Priority: ' DESCRIPTION.old > DESCRIPTION
$R CMD INSTALL --build .
else
mkdir -p $PREFIX/lib/R/library/gprofiler2
mv * $PREFIX/lib/R/library/gprofiler2
if [[ $target_platform == osx-64 ]]; then
pushd $PREFIX
for libdir in lib/R/lib lib/R/modules lib/R/library lib/R/bin/exec sysroot/usr/lib; do
pushd $libdir || exit 1
for SHARED_LIB in $(find . -type f -iname "*.dylib" -or -iname "*.so" -or -iname "R"); do
echo "fixing SHARED_LIB $SHARED_LIB"
install_name_tool -change /Library/Frameworks/R.framework/Versions/3.5.0-MRO/Resources/lib/libR.dylib "$PREFIX"/lib/R/lib/libR.dylib $SHARED_LIB || true
install_name_tool -change /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libR.dylib "$PREFIX"/lib/R/lib/libR.dylib $SHARED_LIB || true
install_name_tool -change /usr/local/clang4/lib/libomp.dylib "$PREFIX"/lib/libomp.dylib $SHARED_LIB || true
install_name_tool -change /usr/local/gfortran/lib/libgfortran.3.dylib "$PREFIX"/lib/libgfortran.3.dylib $SHARED_LIB || true
install_name_tool -change /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libquadmath.0.dylib "$PREFIX"/lib/libquadmath.0.dylib $SHARED_LIB || true
install_name_tool -change /usr/local/gfortran/lib/libquadmath.0.dylib "$PREFIX"/lib/libquadmath.0.dylib $SHARED_LIB || true
install_name_tool -change /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libgfortran.3.dylib "$PREFIX"/lib/libgfortran.3.dylib $SHARED_LIB || true
install_name_tool -change /usr/lib/libgcc_s.1.dylib "$PREFIX"/lib/libgcc_s.1.dylib $SHARED_LIB || true
install_name_tool -change /usr/lib/libiconv.2.dylib "$PREFIX"/sysroot/usr/lib/libiconv.2.dylib $SHARED_LIB || true
install_name_tool -change /usr/lib/libncurses.5.4.dylib "$PREFIX"/sysroot/usr/lib/libncurses.5.4.dylib $SHARED_LIB || true
install_name_tool -change /usr/lib/libicucore.A.dylib "$PREFIX"/sysroot/usr/lib/libicucore.A.dylib $SHARED_LIB || true
install_name_tool -change /usr/lib/libexpat.1.dylib "$PREFIX"/lib/libexpat.1.dylib $SHARED_LIB || true
install_name_tool -change /usr/lib/libcurl.4.dylib "$PREFIX"/lib/libcurl.4.dylib $SHARED_LIB || true
install_name_tool -change /usr/lib/libc++.1.dylib "$PREFIX"/lib/libc++.1.dylib $SHARED_LIB || true
install_name_tool -change /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libc++.1.dylib "$PREFIX"/lib/libc++.1.dylib $SHARED_LIB || true
done
popd
done
popd
fi
fi
{% set version = '0.1.6' %}
{% set posix = 'm2-' if win else '' %}
{% set native = 'm2w64-' if win else '' %}
package:
name: r-gprofiler2
version: {{ version|replace("-", "_") }}
source:
url:
- {{ cran_mirror }}/src/contrib/gprofiler2_{{ version }}.tar.gz
- {{ cran_mirror }}/src/contrib/Archive/gprofiler2/gprofiler2_{{ version }}.tar.gz
sha256: ff2ddcfc78596611b16ffa45a8dc3a000f2578ee432b83da63b64f2e1d6ba337
build:
merge_build_host: True # [win]
# If this is a new build for the same version, increment the build number.
number: 0
noarch: generic
# This is required to make R link correctly on Linux.
rpaths:
- lib/R/lib/
- lib/
requirements:
build:
- {{posix}}zip # [win]
host:
- r-base
- r-rcurl
- r-crosstalk
- r-dplyr
- r-ggplot2
- r-gridextra
- r-jsonlite
- r-plotly
- r-plyr
- r-tidyr
- r-viridislite
run:
- r-base
- r-rcurl
- r-crosstalk
- r-dplyr
- r-ggplot2
- r-gridextra
- r-jsonlite
- r-plotly
- r-plyr
- r-tidyr
- r-viridislite
test:
commands:
# You can put additional test commands to be run here.
- $R -e "library('gprofiler2')" # [not win]
- "\"%R%\" -e \"library('gprofiler2')\"" # [win]
# You can also put a file called run_test.py, run_test.sh, or run_test.bat
# in the recipe that will be run at test time.
# requires:
# Put any additional test requirements here.
about:
home: https://CRAN.R-project.org/package=gprofiler2
license: GPL (>= 2)
summary: 'A toolset for functional enrichment analysis and visualization, gene/protein/SNP
identifier conversion and mapping orthologous genes across species via ''g:Profiler''
(<https://biit.cs.ut.ee/gprofiler>). The main tools are: (1) ''g:GOSt'' - functional
enrichment analysis and visualization of gene lists; (2) ''g:Convert'' - gene/protein/transcript
identifier conversion across various namespaces; (3) ''g:Orth'' - orthology search
across species; (4) ''g:SNPense'' - mapping SNP rs identifiers to chromosome positions,
genes and variant effects This package is an R interface corresponding to the 2019
update of ''g:Profiler'' and provides access to ''g:Profiler'' for versions ''e94_eg41_p11''
and higher. See the package ''gProfileR'' for accessing older versions from the
''g:Profiler'' toolset. '
license_family: GPL3
license_file: 'LICENSE'
extra:
recipe-maintainers:
- conda-forge/r
- liiskolb
# The original CRAN metadata for this package was:
# Package: gprofiler2
# Type: Package
# Title: Interface to the 'g:Profiler' Toolset
# Version: 0.1.6
# Author: Liis Kolberg <liis.kolberg@ut.ee>, Uku Raudvere <uku.raudvere@ut.ee>
# Maintainer: Liis Kolberg <liis.kolberg@ut.ee>
# Description: A toolset for functional enrichment analysis and visualization, gene/protein/SNP identifier conversion and mapping orthologous genes across species via 'g:Profiler' (<https://biit.cs.ut.ee/gprofiler>). The main tools are: (1) 'g:GOSt' - functional enrichment analysis and visualization of gene lists; (2) 'g:Convert' - gene/protein/transcript identifier conversion across various namespaces; (3) 'g:Orth' - orthology search across species; (4) 'g:SNPense' - mapping SNP rs identifiers to chromosome positions, genes and variant effects This package is an R interface corresponding to the 2019 update of 'g:Profiler' and provides access to 'g:Profiler' for versions 'e94_eg41_p11' and higher. See the package 'gProfileR' for accessing older versions from the 'g:Profiler' toolset.
# BugReports: https://biit.cs.ut.ee/gprofiler/page/contact
# License: GPL (>= 2)
# Encoding: UTF-8
# LazyData: true
# RoxygenNote: 6.1.1
# Imports: jsonlite, RCurl, ggplot2, plotly, tidyr, crosstalk, plyr, grDevices, gridExtra, grid, viridisLite, dplyr
# Depends: R (>= 3.5)
# NeedsCompilation: no
# Packaged: 2019-08-26 11:01:17 UTC; Liis
# Repository: CRAN
# Date/Publication: 2019-08-26 13:40:02 UTC
# See
# https://docs.conda.io/projects/conda-build for
# more information about meta.yaml
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment