forked from Elisseeff-Lab/domino
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrh.dev #90
Draft
weshorton
wants to merge
25
commits into
bioconductor
Choose a base branch
from
wrh.dev
base: bioconductor
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Wrh.dev #90
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
0061099
Long commit, forgot to commit while working.
weshorton d4ea351
Update man for circos plot to include title
weshorton cfe736f
Update incoming_signaling_heatmap man to have the new display argumen…
weshorton 805e565
Forgot to add the descriptions to incoming_signaling_heatmap
weshorton 4813629
Update signaling_network man to have offset_sides option
weshorton 062008d
Fix display_top/display_method mixup between signaling_heatmap and in…
weshorton d67b9f3
Add 'cr_signaling_matrices' and 'rec_signaling' slots to domino class…
weshorton 0f34cf1
New function make_rl_reading that takes the rl_reading construction o…
weshorton e6168ce
Revert "New function make_rl_reading that takes the rl_reading constr…
weshorton 50c876c
Add new function that is reverse of circos_ligand_receptor. To do: co…
weshorton 80228a2
Update dom_linkages access function to recognize lig_rec
weshorton 660128b
New function that takes a built domino object and calculates receptor…
weshorton 508517b
Updated man file for linkages script
weshorton c62d516
Update feature heatmap to subset for specific clusters
weshorton a530ef4
Update namespace with new functions
weshorton 479d764
Part 1 of large update to Sushma's outgoing_network code.
weshorton 5fc194b
Part 2 of large update to Sushma's outgoing_network code.
weshorton 42e5fd4
Add lig_rec to dom@linkages in create_domino
weshorton 2c9f97c
Combined both circos plot versions into one generalized plot. Remove …
weshorton a8575ba
Add note to build_domino about possibly getting list of expressed lig…
weshorton b588a44
Add circos_ligand_receptor_general to NAMESPACE and remove circos_rec…
weshorton 3fc3cb3
Add verbose option to outgoign_network to update which cluster is bei…
weshorton 1f0d945
Add help markdown to circos_ligand_receptor_general. Also add multi_p…
weshorton bf09d03
Update gene_network function. Fixed the L_ substitution because it ge…
weshorton bb93e16
Changed stop()'s to warnings()'s for expression check so I can run ci…
weshorton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -97,3 +97,105 @@ table_convert_genes <- function(genes, from, to, conversion_table) { | |
genesV2 <- cbind(col1[which(col1 %in% genes)], col2[which(col1 %in% genes)]) | ||
return(genesV2) | ||
} | ||
|
||
#' Resolve Names | ||
#' @description | ||
#' Return gene names of ligands with non-standard names | ||
#' @param dom domino object | ||
#' @param genes vector of gene names to resolve | ||
#' @details Ligand names (which are stored in dom@linkages$rec_lig) do not always match the gene name | ||
#' Search all provided names and output the gene name if the ligand name is non-standard | ||
#' @return vector of length(genes) with applicable values replaced using dom@misc$rl_map information | ||
#' @export | ||
#' | ||
resolve_names <- function(dom, genes, rec_lig = "lig") { | ||
rl_map = dom@misc[["rl_map"]] | ||
if (rec_lig == "lig") { | ||
gene <- "L.gene" | ||
name <- "L.name" | ||
} else if (rec_lig == "rec") { | ||
gene <- "R.gene" | ||
name <- "R.name" | ||
} else { | ||
stop("rec_lig must be one of 'lig' or 'rec'.\n") | ||
} | ||
|
||
genes_resolved <- sapply(genes, function(l){ | ||
int <- rl_map[rl_map[[name]] == l, ][1,] | ||
if((int[[name]] != int[[gene]]) & !grepl("\\,", int[[gene]])){ | ||
int[[gene]] | ||
} else { | ||
int[[name]] | ||
} | ||
}) | ||
return(genes_resolved) | ||
} # resolve_names | ||
|
||
#' Resolve Complexes | ||
#' @description | ||
#' Expand any complex names into their component gene names | ||
#' @param dom domino object | ||
#' @param genes vector of complex names to resolve | ||
#' @details Ligand names (which are stored in dom@linkages$rec_lig) can refer to complexes that are | ||
#' detailed in dom@linkages$complexes. Search all provided names and if the name is a complex, output component genes, otherwise output the name | ||
#' @return list of length(genes), with names(list) == genes. List values are the same as the names if not in a complex and are the complex genes if they are in a complex. | ||
#' @export | ||
#' | ||
resolve_complexes <- function(dom, genes) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sushma function |
||
genes_list <- lapply(genes, function(l){ | ||
if(l %in% names(dom@linkages$complexes)){ | ||
return(dom@linkages$complexes[[l]]) | ||
} else { | ||
return(l) | ||
} | ||
}) | ||
names(genes_list) <- genes | ||
return(genes_list) | ||
} | ||
|
||
#' Get All Ligands | ||
#' @description | ||
#' Get all unique ligands present in dom@linkages$rec_lig | ||
#' @param dom domino object | ||
#' @param expressed_only logical indicating whether to subset ligands based on expression in dom@z_scores | ||
#' @details Get all unique ligands in a domino object, expanding all ligand complexes as well. Optionally subset by expression. | ||
#' @return vector of ligands if expressed_only = T, list if F | ||
get_all_reclig <- function(dom, expressed_only = T, rec_lig = "rec") { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Code originally in Sushma's outgoing_network. Extracted here |
||
|
||
### Vector of all ligands expressed | ||
if (rec_lig == "rec") { | ||
all <- unlist(dom@linkages$rec_lig) | ||
resolve_rec_lig <- "lig" | ||
} else if (rec_lig == "lig") { | ||
if (!"lig_rec" %in% names(dom@linkages)) stop("Must run invert_rec_lig_linkages if rec_lig is set to 'lig'.\n") | ||
all <- unlist(dom@linkages$lig_rec) | ||
resolve_rec_lig <- "rec" | ||
} else { | ||
stop("lig_rec must be one of 'lig' or 'rec") | ||
} | ||
|
||
all <- unique(all) | ||
all <- all[!all == ""] | ||
|
||
### Resolve non-standard ligand names | ||
all_names_resolved <- resolve_names(dom, all, rec_lig = resolve_rec_lig) | ||
all_names_resolved <- unique(all_names_resolved) | ||
|
||
### Resolve complexes | ||
if(length(dom@linkages$complexes) > 0){ | ||
all_complexes_resolved_list <- resolve_complexes(dom, all_names_resolved) | ||
all_names_resolved <- unlist(all_complexes_resolved_list) | ||
} | ||
|
||
if (expressed_only) { | ||
### Subset for ligands expressed in the data | ||
genes <- intersect(all_names_resolved, rownames(dom@z_scores)) | ||
} else { | ||
genes <- all_names_resolved | ||
#genes <- all_complexes_resolved_list | ||
} | ||
|
||
out_ls <- list("genes" = genes, "complex" = all_complexes_resolved_list) | ||
return(out_ls) | ||
|
||
} # get_all_reclig |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sushma function, updated it to take either receptor or ligand