-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5415449
Showing
21 changed files
with
421 additions
and
0 deletions.
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
^MIPr\.Rproj$ | ||
^\.Rproj\.user$ | ||
^README\.Rmd$ | ||
^LICENSE\.md$ |
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,6 @@ | ||
.Rproj.user | ||
.Rhistory | ||
.Rdata | ||
.httr-oauth | ||
.DS_Store | ||
inst/doc |
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,31 @@ | ||
Package: MIPr | ||
Title: Collection of Functions for MIPTools Analysis | ||
Version: 0.0.0.9000 | ||
Authors@R: | ||
person(given = "Aris", | ||
family = "Paschalidis", | ||
role = c("aut", "cre"), | ||
email = "aris.paschalidis@gmail.com", | ||
comment = c(ORCID = "0000-0003-2247-1885")) | ||
Description: What the package does (one paragraph). | ||
License: MIT + file LICENSE | ||
Encoding: UTF-8 | ||
LazyData: true | ||
Roxygen: list(markdown = TRUE) | ||
RoxygenNote: 7.1.1 | ||
Suggests: | ||
knitr, | ||
rmarkdown, | ||
spelling | ||
Language: en-US | ||
Imports: | ||
dplyr, | ||
janitor, | ||
magrittr, | ||
readr, | ||
rlang, | ||
tibble, | ||
tidyr | ||
VignetteBuilder: knitr | ||
Depends: | ||
R (>= 2.10) |
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,2 @@ | ||
YEAR: 2021 | ||
COPYRIGHT HOLDER: Aris Paschalidis |
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,21 @@ | ||
# MIT License | ||
|
||
Copyright (c) 2021 Aris Paschalidis | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,22 @@ | ||
Version: 1.0 | ||
|
||
RestoreWorkspace: No | ||
SaveWorkspace: No | ||
AlwaysSaveHistory: Default | ||
|
||
EnableCodeIndexing: Yes | ||
UseSpacesForTab: Yes | ||
NumSpacesForTab: 2 | ||
Encoding: UTF-8 | ||
|
||
RnwWeave: Sweave | ||
LaTeX: pdfLaTeX | ||
|
||
AutoAppendNewline: Yes | ||
StripTrailingWhitespace: Yes | ||
LineEndingConversion: Posix | ||
|
||
BuildType: Package | ||
PackageUseDevtools: Yes | ||
PackageInstallArgs: --no-multiarch --with-keep.source | ||
PackageRoxygenize: rd,collate,namespace |
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,6 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
export("%>%") | ||
export(read) | ||
importFrom(magrittr,"%>%") | ||
importFrom(rlang,.data) |
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,8 @@ | ||
#' \pkg{MIPr} Collection of Functions for MIPTools Analysis | ||
#' | ||
#' @docType package | ||
#' @name MIPr | ||
#' | ||
#' @importFrom rlang .data | ||
#' | ||
"_PACKAGE" |
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,63 @@ | ||
#------------------------------------------------ | ||
#' Read data | ||
#' | ||
#' Read paired data files and combine the files. | ||
#' | ||
#' @param alternate_table Alternate table. | ||
#' @param coverage_table Coverage table. | ||
#' | ||
#' @return A tibble containing the parsed data. | ||
#' @export | ||
read <- function(alternate_table, coverage_table) { | ||
alternate_table <- read_file(alternate_table, "alternate") | ||
coverage_table <- read_file(coverage_table, "coverage") | ||
|
||
bind_table <- dplyr::full_join(alternate_table, coverage_table, | ||
by = c("sample", "gene_id", "gene", | ||
"mutation_name", "exonic_func", | ||
"aa_change", "targeted")) %>% | ||
dplyr::mutate(dplyr::across(.data$umi_count:.data$coverage, as.numeric)) | ||
} | ||
|
||
#------------------------------------------------ | ||
#' Read file | ||
#' | ||
#' Read data files. | ||
#' | ||
#' @param file Alternate table. | ||
#' | ||
#' @return Parsed file. | ||
#' | ||
#' @keywords internal | ||
read_file <- function(file, type = c("alternate", "coverage")) { | ||
data <- readr::read_csv(file, col_names = FALSE) %>% | ||
# Take the tranpose of our matrix, making rows columns and columns rows. This | ||
# will allows us to keep all the data in our .csv file. | ||
tibble::rownames_to_column() %>% | ||
tidyr::pivot_longer(-.data$rowname) %>% | ||
tidyr::pivot_wider(names_from = .data$rowname, | ||
values_from = .data$value) %>% | ||
# Assign the column names of our tibble and clean them up | ||
dplyr::select(-.data$name) %>% | ||
janitor::row_to_names(1) | ||
if (type == "alternate") { | ||
data <- data %>% | ||
# Convert out data to a long format, where now we have a column with the | ||
# umi_count | ||
tidyr::pivot_longer(cols = -c(.data$`Gene ID`:.data$Targeted), | ||
names_to = "sample" , | ||
values_to = "umi_count") | ||
} else if (type == "coverage") { | ||
data <- data %>% | ||
# Convert out data to a long format, where now we have a column with the | ||
# coverage | ||
tidyr::pivot_longer(cols = -c(.data$`Gene ID`:.data$Targeted), | ||
names_to = "sample" , | ||
values_to = "coverage") | ||
} else { | ||
stop("Inocrrect type specified") | ||
} | ||
data <- data %>% | ||
dplyr::relocate(sample) %>% | ||
janitor::clean_names() | ||
} |
Binary file not shown.
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,14 @@ | ||
#' Pipe operator | ||
#' | ||
#' See \code{magrittr::\link[magrittr:pipe]{\%>\%}} for details. | ||
#' | ||
#' @name %>% | ||
#' @rdname pipe | ||
#' @keywords internal | ||
#' @export | ||
#' @importFrom magrittr %>% | ||
#' @usage lhs \%>\% rhs | ||
#' @param lhs A value or the magrittr placeholder. | ||
#' @param rhs A function call using the magrittr semantics. | ||
#' @return The result of calling `rhs(lhs)`. | ||
NULL |
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,29 @@ | ||
--- | ||
output: github_document | ||
--- | ||
|
||
<!-- README.md is generated from README.Rmd. Please edit that file --> | ||
|
||
```{r, include = FALSE} | ||
knitr::opts_chunk$set( | ||
collapse = TRUE, | ||
comment = "#>", | ||
fig.path = "man/figures/README-", | ||
out.width = "100%" | ||
) | ||
``` | ||
|
||
# MIPr | ||
|
||
<!-- badges: start --> | ||
[](https://lifecycle.r-lib.org/articles/stages.html#experimental) | ||
[](https://opensource.org/licenses/MIT) | ||
<!-- badges: end --> | ||
|
||
## Installation | ||
To install the package, please follow the code below. In order to install, | ||
`devtools` must be installed. | ||
```{r, eval = FALSE} | ||
# install.packages("devtools") | ||
devtools::install_github("https://github.com/arisp099/MIPr") | ||
``` |
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,22 @@ | ||
|
||
<!-- README.md is generated from README.Rmd. Please edit that file --> | ||
|
||
# MIPr | ||
|
||
<!-- badges: start --> | ||
|
||
[](https://lifecycle.r-lib.org/articles/stages.html#experimental) | ||
[](https://opensource.org/licenses/MIT) | ||
<!-- badges: end --> | ||
|
||
## Installation | ||
|
||
To install the package, please follow the code below. In order to | ||
install, `devtools` must be installed. | ||
|
||
``` r | ||
# install.packages("devtools") | ||
devtools::install_github("https://github.com/arisp099/MIPr") | ||
``` |
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,3 @@ | ||
MIPTools | ||
github | ||
https |
Oops, something went wrong.