Skip to content

Commit a5b0dd8

Browse files
author
Merotto
committed
Merge branch 'update_conversion_genes' of https://github.com/omnideconv/immunedeconv into update_conversion_genes
2 parents 23eab7a + dcd2c18 commit a5b0dd8

File tree

5 files changed

+38
-31
lines changed

5 files changed

+38
-31
lines changed

.github/workflows/conda.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@ jobs:
2626
uses: conda-incubator/setup-miniconda@v2
2727
with:
2828
auto-update-conda: true
29-
mamba-version: "*"
30-
channels: conda-forge,bioconda,defaults
29+
miniforge-version: latest
30+
use-mamba: true
31+
channels: conda-forge,bioconda
3132
channel-priority: true
3233
python-version: 3.8
3334

3435
- name: Set-up channels and install conda build
3536
run: |
36-
mamba install -y conda-build conda-verify
37+
mamba install -y conda-build conda-verify boa
3738
shell: bash
3839

3940
- name: build and test package

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# R specific hooks: https://github.com/lorenzwalthert/precommit
33
repos:
44
- repo: https://github.com/lorenzwalthert/precommit
5-
rev: v0.3.2.9007
5+
rev: v0.3.2.9021
66
hooks:
77
- id: style-files
88
args: [--style_pkg=styler, --style_fun=tidyverse_style]
@@ -17,7 +17,7 @@ repos:
1717
- id: end-of-file-fixer
1818
exclude: '\.Rd'
1919
- repo: https://github.com/pre-commit-ci/pre-commit-ci-config
20-
rev: v1.5.1
20+
rev: v1.6.1
2121
hooks:
2222
# Only reuiqred when https://pre-commit.ci is used for config validation
2323
- id: check-pre-commit-ci-config
@@ -31,7 +31,7 @@ repos:
3131
exclude: "inst/extdata/.*"
3232
# `exclude: <regex>` to allow committing specific files
3333
- repo: https://github.com/pre-commit/mirrors-prettier
34-
rev: v3.0.0-alpha.6
34+
rev: v3.0.3
3535
hooks:
3636
- id: prettier
3737

R/mouse_deconvolution_methods.R

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,11 @@ mouse_genes_to_human <- function(gene_expression_matrix, mirror = "www", other_a
268268
genes.retrieved <- NULL
269269
tryCatch(
270270
expr = {
271-
genes.retrieved <<- getLDS(attributes = c("mgi_symbol"),
272-
filters = "mgi_symbol", values = gene.names.mouse,
273-
mart = mouse, attributesL = c("hgnc_symbol"), martL = human, uniqueRows = T)
271+
genes.retrieved <<- getLDS(
272+
attributes = c("mgi_symbol"),
273+
filters = "mgi_symbol", values = gene.names.mouse,
274+
mart = mouse, attributesL = c("hgnc_symbol"), martL = human, uniqueRows = T
275+
)
274276

275277
newGenes.counts <- gene_expression_matrix %>%
276278
left_join(., genes.retrieved, by = c("gene_name" = "MGI.symbol")) %>%
@@ -289,32 +291,33 @@ mouse_genes_to_human <- function(gene_expression_matrix, mirror = "www", other_a
289291

290292
message(paste0("ATTENTION: Only the ", fraction, "% of genes was maintained"))
291293
},
292-
error = function(e){
293-
print('Cannot connect to ENSEMBL. Using alternative method. This will take some time.')
294-
295-
if(manual_annot){
294+
error = function(e) {
295+
print("Cannot connect to ENSEMBL. Using alternative method. This will take some time.")
296296

297+
if (manual_annot) {
297298
# Code adapted from: https://support.bioconductor.org/p/129636/#9144606
298299

299-
mouse_human_genes = read.csv("http://www.informatics.jax.org/downloads/reports/HOM_MouseHumanSequence.rpt",sep="\t")
300+
mouse_human_genes <- read.csv("http://www.informatics.jax.org/downloads/reports/HOM_MouseHumanSequence.rpt", sep = "\t")
300301

301-
find_corr_gene <- function(gene, mouse_human_genes_df){
302-
class_key = (mouse_human_genes_df %>%
303-
filter(Symbol == gene & Common.Organism.Name=="mouse, laboratory"))[['DB.Class.Key']]
304-
if(!identical(class_key, integer(0)) ){
302+
find_corr_gene <- function(gene, mouse_human_genes_df) {
303+
class_key <- (mouse_human_genes_df %>%
304+
filter(Symbol == gene & Common.Organism.Name == "mouse, laboratory"))[["DB.Class.Key"]]
305+
if (!identical(class_key, integer(0))) {
305306
output <- NULL
306-
human_genes = (mouse_human_genes_df %>% filter(DB.Class.Key == class_key & Common.Organism.Name=="human"))[,"Symbol"]
307-
for(human_gene in human_genes){
308-
output = append(output, human_gene)
307+
human_genes <- (mouse_human_genes_df %>% filter(DB.Class.Key == class_key & Common.Organism.Name == "human"))[, "Symbol"]
308+
for (human_gene in human_genes) {
309+
output <- append(output, human_gene)
309310
}
310-
if(!is.null(output)){
311+
if (!is.null(output)) {
311312
return(
312313
data.frame(
313-
'human_gene' = output,
314-
'mouse_gene' = gene))
314+
"human_gene" = output,
315+
"mouse_gene" = gene
316+
)
317+
)
315318
}
316-
317-
}}
319+
}
320+
}
318321

319322
genes.retrieved <- map_dfr(gene.names.mouse, function(x) find_corr_gene(x, mouse_human_genes))
320323

@@ -328,9 +331,9 @@ mouse_genes_to_human <- function(gene_expression_matrix, mirror = "www", other_a
328331
round(., 1)
329332

330333
message(paste0("ATTENTION: Only the ", fraction, "% of genes was maintained"))
331-
332334
}
333-
})
335+
}
336+
)
334337

335338
return(newGenes.counts)
336339
}

man/mouse_genes_to_human.Rd

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test_mapping.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
test_that("cell_type mapping to a single method_cell_type are calculated correctly", {
32
fractions <- data.frame(sample1 = c("B cell" = .3, "T cell CD4+" = .5, "Myeloid dendritic cell" = .2))
43
cell_type <- "T cell CD4+"

0 commit comments

Comments
 (0)