Skip to content

Commit 7a66ef3

Browse files
committed
docs: add in section removed by accident in prior commit
1 parent fe7b37b commit 7a66ef3

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

Microarray/Affymetrix/Pipeline_GL-DPPD-7114_Versions/GL-DPPD-7114.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,32 @@ if (organism %in% c("athaliana")) {
756756
}
757757

758758
# At this point, we have df_mapping from either the biomart live service or the ensembl genomes ftp archive depending on the organism
759+
760+
listToUniquePipedString <- function(str_list) {
761+
#! convert lists into strings denoting unique elements separated by '|' characters
762+
#! e.g. c("GO1","GO2","GO2","G03") -> "GO1|GO2|GO3"
763+
return(toString(unique(str_list)) %>% stringr::str_replace_all(pattern = stringr::fixed(", "), replacement = "|"))
764+
}
765+
766+
unique_probe_ids <- df_mapping %>%
767+
# note: '!!sym(VAR)' syntax allows usage of variable 'VAR' in dplyr functions due to NSE. ref: https://dplyr.tidyverse.org/articles/programming.html # NON_DPPD
768+
dplyr::mutate(dplyr::across(!!sym(expected_attribute_name), as.character)) %>% # Ensure probeset ids treated as character type
769+
dplyr::group_by(!!sym(expected_attribute_name)) %>%
770+
dplyr::summarise(
771+
ENSEMBL = listToUniquePipedString(ensembl_gene_id)
772+
) %>%
773+
# Count number of ensembl IDS mapped
774+
dplyr::mutate(
775+
count_ENSEMBL_mappings = 1 + stringr::str_count(ENSEMBL, stringr::fixed("|"))
776+
)
777+
778+
probeset_expression_matrix <- oligo::exprs(probeset_level_data)
779+
780+
probeset_expression_matrix.biomart_mapped <- probeset_expression_matrix %>%
781+
as.data.frame() %>%
782+
tibble::rownames_to_column(var = "ProbesetID") %>% # Ensure rownames (probeset IDs) can be used as join key
783+
dplyr::left_join(unique_probe_ids, by = c("ProbesetID" = expected_attribute_name ) ) %>%
784+
dplyr::mutate( count_ENSEMBL_mappings = ifelse(is.na(ENSEMBL), 0, count_ENSEMBL_mappings) )
759785
```
760786

761787
**Input Data:**

0 commit comments

Comments
 (0)