-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from CRI-iAtlas/develop
Develop
- Loading branch information
Showing
16 changed files
with
639 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Package: iatlasGraphQLClient | ||
Title: iatlas API Client | ||
Type: Package | ||
Version: 0.2.2 | ||
Version: 0.2.4 | ||
Author: Andrew Lamb | ||
Maintainer: Andrew Lamb <[email protected]> | ||
Description: This package is am R Client library for the iAtlas API. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#' Query Cell Stats | ||
#' | ||
#' @param entrez A vector integers | ||
#' @param paging A named list | ||
#' @param ... Arguments to create_result_from_api_query | ||
#' @export | ||
query_cell_stats <- function( | ||
entrez = NA, | ||
paging = NA, | ||
... | ||
){ | ||
tbl <- create_result_from_cursor_paginated_api_query( | ||
query_args = list( | ||
"entrez" = entrez, | ||
"paging" = paging, | ||
"distinct" = F | ||
), | ||
query_file = "cell_stats.txt", | ||
default_tbl = dplyr::tibble( | ||
"type" = character(), | ||
"count" = integer(), | ||
"avg_expr" = double(), | ||
"perc_expr" = double(), | ||
"dataset_name" = character(), | ||
"gene_entrez" = integer() | ||
), | ||
select_cols = c( | ||
"type", | ||
"count", | ||
"avg_expr" = "avgExpr", | ||
"perc_expr" = "percExpr", | ||
"dataset_name" = "dataSet.name", | ||
"gene_entrez" = "gene.entrez" | ||
), | ||
... | ||
) | ||
return(tbl) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
#' Query Cells | ||
#' | ||
#' @param cohort A vector of characters | ||
#' @param cell A vector of characters | ||
#' @param paging A named list | ||
#' @param ... Arguments to create_result_from_api_query | ||
#' @export | ||
query_cells <- function( | ||
cohort = NA, | ||
cell = NA, | ||
paging = NA, | ||
... | ||
){ | ||
tbl <- create_result_from_cursor_paginated_api_query( | ||
query_args = list( | ||
"cohort" = cohort, | ||
"cell" = cell, | ||
"paging" = paging, | ||
"distinct" = F | ||
), | ||
query_file = "cells.txt", | ||
default_tbl = dplyr::tibble( | ||
"type" = character(), | ||
"name" = character(), | ||
), | ||
select_cols = c( | ||
"type", | ||
"name" | ||
), | ||
... | ||
) | ||
return(tbl) | ||
} | ||
|
||
#' Query SingleCellSeq | ||
#' | ||
#' @param entrez A vector integers | ||
#' @param cohort A vector of characters | ||
#' @param cell A vector of characters | ||
#' @param paging A named list | ||
#' @param ... Arguments to create_result_from_api_query | ||
#' @export | ||
query_single_cell_seq <- function( | ||
entrez = NA, | ||
cohort = NA, | ||
cell = NA, | ||
paging = NA, | ||
... | ||
){ | ||
tbl <- create_result_from_cursor_paginated_api_query( | ||
query_args = list( | ||
"entrez" = entrez, | ||
"cohort" = cohort, | ||
"cell" = cell, | ||
"paging" = paging, | ||
"distinct" = F | ||
), | ||
query_file = "single_cell_seq.txt", | ||
default_tbl = dplyr::tibble( | ||
"cell_type" = character(), | ||
"cell_name" = character(), | ||
"gene_entrez" = integer(), | ||
"gene_hgnc" = character(), | ||
"gene_single_cell_seq" = double() | ||
), | ||
select_cols = c( | ||
"cell_type" = "type", | ||
"cell_name" = "name", | ||
"genes" | ||
), | ||
... | ||
) | ||
if (nrow(tbl) == 0) return(tbl) | ||
else { | ||
tbl <- tbl %>% | ||
tidyr::unnest(cols = "genes", keep_empty = T) %>% | ||
dplyr::select( | ||
"cell_type", | ||
"cell_name", | ||
"gene_entrez" = "entrez", | ||
"gene_hgnc" = "hgnc", | ||
"gene_single_cell_seq" = "singleCellSeq" | ||
) | ||
} | ||
return(tbl) | ||
} | ||
|
||
|
||
#' Query SingleCellFeature | ||
#' | ||
#' @param feature A vector of characters | ||
#' @param cohort A vector of characters | ||
#' @param cell A vector of characters | ||
#' @param paging A named list | ||
#' @param ... Arguments to create_result_from_api_query | ||
#' @export | ||
query_single_cell_feature <- function( | ||
feature = NA, | ||
cohort = NA, | ||
cell = NA, | ||
paging = NA, | ||
... | ||
){ | ||
tbl <- create_result_from_cursor_paginated_api_query( | ||
query_args = list( | ||
"feature" = feature, | ||
"cohort" = cohort, | ||
"cell" = cell, | ||
"paging" = paging, | ||
"distinct" = F | ||
), | ||
query_file = "single_cell_feature.txt", | ||
default_tbl = dplyr::tibble( | ||
"cell_type" = character(), | ||
"cell_name" = character(), | ||
"feature_name" = character(), | ||
"feature_display" = character(), | ||
"feature_value" = double() | ||
), | ||
select_cols = c( | ||
"cell_type" = "type", | ||
"cell_name" = "name", | ||
"features" | ||
), | ||
... | ||
) | ||
if (nrow(tbl) == 0) return(tbl) | ||
else { | ||
tbl <- tbl %>% | ||
tidyr::unnest(cols = "features", keep_empty = T) %>% | ||
dplyr::select( | ||
"cell_type", | ||
"cell_name", | ||
"feature_name" = "name", | ||
"feature_display" = "display", | ||
"feature_value" = "value", | ||
) | ||
} | ||
return(tbl) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
query CellStats( | ||
$paging: PagingInput | ||
$distinct:Boolean | ||
$entrez: [Int!] | ||
) { | ||
cellStats( | ||
paging: $paging | ||
distinct: $distinct | ||
entrez: $entrez | ||
) { | ||
items { | ||
dataSet { name } | ||
gene { entrez } | ||
type | ||
count | ||
avgExpr | ||
percExpr | ||
} | ||
paging { | ||
type | ||
pages | ||
total | ||
startCursor | ||
endCursor | ||
hasPreviousPage | ||
hasNextPage | ||
page | ||
limit | ||
} | ||
error | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
query Cells( | ||
$paging: PagingInput | ||
$distinct:Boolean | ||
$cohort: [String!] | ||
$cell: [String!] | ||
) { | ||
cells( | ||
paging: $paging | ||
distinct: $distinct | ||
cohort: $cohort | ||
cell: $cell | ||
) { | ||
items { | ||
name | ||
type | ||
} | ||
paging { | ||
type | ||
pages | ||
total | ||
startCursor | ||
endCursor | ||
hasPreviousPage | ||
hasNextPage | ||
page | ||
limit | ||
} | ||
error | ||
} | ||
} |
Oops, something went wrong.