mskcc-epi-bio / gnomer Goto Github PK
View Code? Open in Web Editor NEWPackage to wrangle and visualize genomic data in R
Home Page: https://mskcc-epi-bio.github.io/gnomeR/
License: Other
Package to wrangle and visualize genomic data in R
Home Page: https://mskcc-epi-bio.github.io/gnomeR/
License: Other
Following up on PR #93 (and meeting 2020-08-17)
We agreed this is fine for now, but if someone feels inclined they can add pancan palettes to the default plots in the future.
maf <- maf %>%
filter(.data$Variant_Type == "SNP",
.data$HGVSc != "") %>%
mutate(SNV_Class = substrRight(.data$HGVSc,3)
This filtering code is only included in the ggsnvclass()
function in the newest version. We may want to add a line to documentation about this, but may not be needed
These are removed in the current version of code
Decided to keep both cor and comut functions. We need to confirm that these are being calculated correctly in plotting functions
Also just a note that we added a n_genes argument to plotting functions to allow user to control how many genes are displayed in plots.
If you make any changes relating to the above, please link to this issue
We discussed potentially changing the binary matrix function to output a binary matrix instead of a list. Potentially throw the patient IDs as a warning instead of returning them.
@AxelitoMartin what do you prefer?
TCGA pancan data prep
Common checks and visualizations for TCGA pancan
Helper functions to prepare omic data for iCluster
Helper functions to visualize iCluster results
@karissawhiting @AxelitoMartin any others you want to add to wishlist?
Hi, Using gnomeR for a project (thanks for your efforts!) - and noticed that the percentages generated by the gen.summary function use all the samples in the matrix as the denominator rather than only the ones are sequenced for those genes. (This is in the context where you have data from multiple IMPACT panels.) So even if I filter at 5%, if I have genes that are sequenced in only a small number of patients, it will show percentages lower than 5%.
Relatedly, it would be great to have an option to filter out genes that are sequenced in less than some threshold of samples.
Let me know if you want specific examples.
Thank you!
Two options:
@arorarshi or @AxelitoMartin can you add description and a reprex to this issue?
Need to check that samples passed through patients
in binmat
actually exist in input file
Need to modify this so it throws warning that not all samples were mutated on IM3-6 but still annotated those that were rather than overwriting the argument to FALSE
Potentially using ggplot.
talk to @edrill about this.
The package needs better documentation for oncoKB annotation. We should add a separate vignette for this that includes instructions on how to get, save and use an oncoKB token.
As part of this, we need to test the oncoKB functionality within the package.
The oncogenic signaling pathways taken from the paper can only be annotated using an alteration-level matrix.
We should prevent users from annotating the default pathways with a gene-level alteration matrix, but keep the functionality for user who have a custom pathway (i.e. for exploratory analyses, or for other pathways with less-strict definitions).
For the second item, we can look at the patient ID's IMX codes to tell if there are multiple platforms.
We need to improve handling of column names in create_binary_matrix()
. The function should by default support: traditional maf names (see link below), lower snakecase version of maf names, and API column names.
This needs to be done for mutation (maf), cna, and structural variant data eventually but we will start with mutation (maf).
library(cbioportalR)
set_cbioportal_db("msk")
msk_2017 <- get_genetics_by_study("msk_impact_2017")
ss <- available_samples("msk_impact_2017")
h_ss <- head(ss, n = 100)
msk_2017 <- get_genetics_by_sample(sample_id = h_ss$sampleId)
msk_2017$mutation
create_binary_matrix()
create_binary_matrix()
arguments. Improve errors/messaging for when certain columns are missing (e.g. variant type = "germline")Have user specify genes in pathway, and output matrix columns with those tallied.
Code needs to be tested and language reviewed.
Previous vignettes have been removed from the package. Please let me know if you plan to work on this and I can share the previous version to work off of.
@arorarshi @AxelitoMartin Can you add some details about what you are envisioning for this?
Several imports are in the package that I'm not sure are necessary.
Imports should be reserved for packages whose functions we need to do our functions.
For example:
ComplexHeatmap
GGally
plotly
Do we actually use functions from these packages within any of our functions? If so, they should clearly be marked within our functions as ComplexHeatmap::add_heatmap
(should never just be "naked" like add_heatmap
). But, I don't see functions from these packages being called this way anywhere in the package.
To make the package "leaner" I would recommend we cut down on unnecessary imports, or else make more clear why we require these inputs!
@AxelitoMartin @arorarshi @karissawhiting any thoughts on this?
test on seq.plat, samples with no mutation
Let's make this into a separate function that can be called within binmat(). This function should work with IMPACT or GENIE panels (add tests to check).
Should also allow you to pass sample/panel pairs so you can differentially annotate for missingness depending on the panel that sample was tested on.
Currently gnomeR expects a matrix for CNA data. This causes the oncoKB functionality to not work.
If there are already unit tests commented out on any file you are working on, feel free to use/revamp them or replace them
OVERALL TEST COVERAGE: 76.8%
withr::with_envvar(new = c("NOT_CRAN" = "true"), covr::report())
. This will show you the test coverage of each file and the package overall. One of our goals is to increase this coverage percentage.Additionally, I've added some suggestions for tests in the test files themselves (in the tests folder of the package)
gnomerR::mut
, gnomerR::fusion
, gnomerR::cna
), a small sample of real data, or create your own fake data.Discussed doing a review of function names and file names. Here are some tips from the tidyverse style guide.
For file names, we discussed changing file names to be same as function names when there is only one function in the file.
gen_summary()
and gen_uni_cox()
functionality overlaps with {gtsummary} tbl_summary()
and tbl_uvregression()
functions. Since {gtsummary} is very fully-featured, we may want to consider making these functions wrap existing {gtsummary} functions, or consider removing these functions altogether.
One thing to consider is speed since genomic data sets are often very large. We should test {gtsummary} functions with large genomic data sets first to see if it's worth keeping these less fully featured, but faster versions.
The newest IMPACT panel needs to be added to the internal pacakge dataframe gnomeR::impact_gene_info
. Review the impact-gene-info.R
script (in data-raw
folder) and add code there to do so. The code to add the previous panels is here and can be used as reference.
You will need to:
cbioportalR::get_gene_pane("IMPACT505")
cbioportalR::get_alias()
cna.binary = FALSE
- return the rownames of data.frame when running with cna alone - binmat(cna=cna)
cna.binary= FALSE
- specify.plat
is not counted for? genes need to be censored for different IM platformsCreate a package website
@margarethannum
Processing CNA files
gene_CN
and then have the discrete states as is. Have an option to also return CN events as binary. (This can be in make-bin-mat.R
or make-oncoprint-dat.R
)cna
file, there are no NA, even if the sample was sequenced on a different platform for a gene that didn't exist in the platform. (Find out)Analysis
4. Analyze Copy Number Alterations (CNA) wrt to an entire gene and perform association test on all observed CN states of the gene
oncoKB removed from binary_matrix() for now. Need to work this back into the package and test.
oncoKB as in an R environment was fully validated with its python counterpart. We get the same annotations. However, oncoKB versions should be kept in mind, and we should try and update with their latest version.
We discussed making the binary matrix function more modular by splitting it out into 3 pre-processing functions for mutations, CNA and fusions. These would then be called within the overarching matrix function. This will help with future testing and troubleshooting.
Additionally, should the user have an option in the binary matrix function to combine mutations and CNAs and make an "alterations" matrix? If so, these could be first computed separately by the individually cleaning functions and then combined before being returned to user.
We discussed possibly making the binary matrix function into a method function in the future, but TBD.
I think a good start on this task will be to adjust the create.bin.matrix() function to accept column names other than MAF standard names as arguments. The MAF standards can be default.
Code needs to be tested and language reviewed.
Previous vignettes have been removed from the package. Please let me know if you plan to work on this and I can share the previous version to work off of.
Following the vignette, I run the command plot_oncoPrint(gen.dat = select(bmat, all_of(genes)))
. I get the following messages in console:
All mutation types: MUT, AMP, DEL.
Following at
are removed: FUS, MIS, because no color was defined for them.
Following at
are removed: FUS, MIS, because no color was defined for them.
Following at
are removed: FUS, MIS, because no color was defined for them.
Attaching resulting oncoprint:
The correct labeling should be:
Blue square = Deletion
Red square = Amplification
Green line = Mutation
I ran the above code with both the regular and development versions of gnomeR.
Thank you!
This isn't urgent but should be done eventually, especially if we are planning to submit to CRAN. There are a couple in particular that I can't figure out like the one about the large size of the docs
folder or how to bind the python functions so we don't get the no visible bindings note for those.
Allow users to easily access the list of IMPACT genes and panels. Export this list to users and add documentation for it with a source reference.
Thrown an error if a gene isn't part of any IMPACT platform. Additionally, there should be a check for any genes that have been renamed.
The check should probably be based off list from issue #53
Consider breaking up function to make it more modular. This will make it easier to test and troubleshoot.
Currently create_binary_matrix()
outputs separate sets of notes for which genes are relabeled as aliases. It would be best to capture these and concatenate into 1 message/list (can probably use {purrr} functions for this).
Currently the mut_type
argument of binary_matrix()
returns only mutations marked as SOMATIC
in maf. This also removes any unknown mutation types (usually in file as NA or ""). Often when you pull data from the API, mutation type is blank for many observations. These are almost always actually SOMATIC
so we should not exclude these by default.
binary_matrix()
function to remove GERMLINE
by default but keep everything else including blanks. Maybe we can call this option NO_GERMLINE
?cli::cli_warn()
) that notes you have X number of mutations marked as blank. Let user know these are retained in resulting binary matrix.SOMATIC
or GERMLINE
or ALL
I removed the pathways argument from the binary matrix function, but we still have the custom_pathway()
function. I'm thinking we should remove this as well and have one unified function called add_pathway()
that can annotate pre-set pathways included in the package, or allow you to pass a custom pathway. It could be used as follows:
binary_matrix(mutation = mut, cna = cna, fusions = fus) %>%
add_pathway(pathway = "all")
Where the pathway
argument would be "all" be default, allowing you to annotate all package-included pathways. (see gnomeR::pathways
). Otherwise you could specify a specific pathway_id
like "RTK-RAS".
binary_matrix(mutation = mut, cna = cna, fusions = fus) %>%
add_pathway(pathway = "RTK-RAS")
Additionally, you could add a custom pathway with:
binary_matrix(mutation = mut, cna = cna, fusions = fus) %>%
add_pathway(custom_pathway = c("TP53", "APC", "FGFR3"))
First step of this will be updating the gnomeR::pathways
internal data which is currently incorrect. See pathways.R which pulls data from pathways.csv to create this internal data frame. You can update pathways.csv directly.
Right now if I query a non-MSK sample ID using the API and then feed the genetic data into binary matrix it looks as if that sample has no mutations even though it may have mutations that were just not accessible in the IMPACT database. It also overwrites spe.plat
which is a pain.
I'm not sure the best way to deal with these non MSK samples yet, and I also haven't been able to find a way to query all sample mutation data within a study in a way that would allow access to these non MSK samples through the API. I would think it would be possible considering the data is on cbioportal somewhere.
Consider removing these summary functions and instead encouraging people to use {gtsummary}, as this functionality is more fully featured already there. We can deprecate these and if someone calls these functions, we can throw a message with suggestion/code to use tbl_uvregression()
We should have a case study vignette that uses data pulled directly from cBioPortal in {gnomeR} functions. See {cbioportalR} vignette for instructions on how to pull data: https://github.com/karissawhiting/cbioportalR
Code needs to be tested and language reviewed.
Previous vignettes have been removed from the package. Please let me know if you plan to work on this and I can share the previous version to work off of.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.