Skip to content

Commit

Permalink
Merge pull request #30 from bcbio/devel
Browse files Browse the repository at this point in the history
0.2.1
  • Loading branch information
lpantano authored Jun 5, 2024
2 parents 8efe765 + 85e4a21 commit 298e52f
Show file tree
Hide file tree
Showing 54 changed files with 2,376 additions and 292 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
test/*
inst/*/*/*/*/*/*html
inst/*/*/*/*/*/*csv
^data-raw$
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ inst/doc
docs
/doc/
/Meta/
.DS*
14 changes: 11 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: bcbioR
Type: Package
Title: Templates and functions to guide downstream analysis and data interpretation
Version: 0.1.1
Version: 0.1.2
Authors@R: person("Pantano", "Lorena", , "[email protected]",
role = c("aut", "cre"))
Description: Collaborative code repository at the Harvard Chan Bioinformatics Core.
Expand All @@ -11,15 +11,23 @@ Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
Imports:
DESeq2,
stringr,
ggplot2,
magrittr,
hues,
ggprism,
grDevices,
R.utils
R.utils,
readr,
fs,
withr
Suggests:
knitr,
rmarkdown
rmarkdown,
testthat (>= 3.0.0)
VignetteBuilder: knitr
URL: http://bcb.io/bcbioR/
Config/testthat/edition: 3
Depends:
R (>= 2.10)
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
# Generated by roxygen2: do not edit by hand

export(bcbio_nfcore_check)
export(bcbio_set_project)
export(bcbio_templates)
export(cb_friendly_cols)
export(cb_friendly_pal)
export(list_cb_friendly_cols)
export(scale_color_cb_friendly)
export(scale_fill_cb_friendly)
import(DESeq2)
import(R.utils)
import(ggplot2)
import(ggprism)
import(hues)
importFrom(grDevices,colorRampPalette)
importFrom(magrittr,"%>%")
importFrom(readr,read_csv)
importFrom(stringr,str_replace_all)
12 changes: 12 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# bcbioR 0.1.2

* Add draft templates for TEAseq, COSMX
* Adapt templates to nf-core rnaseq
* Fix when sample start by number
* Fix when rRNA rate is missing
* Add by sample plots in QC
* Add function to check nfcore samplesheet
* Add PCA with variance analysis
* Minor details fixed in QC RNAseq report
* Correct metric for rRNA and tRNA

# bcbioR 0.1.1

* Add page to github
Expand Down
4 changes: 3 additions & 1 deletion R/bcbioR-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
"_PACKAGE"

## usethis namespace: start
#' @importFrom grDevices colorRampPalette
#' @importFrom magrittr %>%
#' @importFrom readr read_csv
#' @importFrom stringr str_replace_all
#' @importFrom grDevices colorRampPalette
## usethis namespace: end
#' @import DESeq2
#' @import ggplot2
#' @import hues
#' @import ggprism
Expand Down
8 changes: 8 additions & 0 deletions R/data.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#' varianceStabilizingTransformation Object from Test Data
#'
#' An example of the output of varianceStabilizingTransformation to
#' show different visualization code
#'
#' @format ## `bcbio_vsd_data`
#' VSD object from DESeq2 data
"bcbio_vsd_data"
52 changes: 46 additions & 6 deletions R/hello.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,34 @@
.fix <- function(x){
x <- tolower(x) %>% str_replace_all(., "[[:punct:]]", "_")
x <- str_replace_all(x, " ", "_")
return(x)
}


#' Function to check samplesheet for nf-core
#'
#' @param file path to CSV file for nf-core
#' @examples
#'
#' bcbio_nfcore_check(system.file("extdata", "rnaseq_good.csv", package = "bcbioR") )
#'
#' @export
bcbio_nfcore_check <- function(file){
required=c("sample","fastq_1","fastq_2","strandedness")
samplesheet=read_csv(file)

if (!(all(required %in% colnames(samplesheet)))){
print(colnames(samplesheet))
stop("Missing required columns ", paste(required, collapse = " "))
}else if (any(grepl("^[1-9]", samplesheet[["sample"]]))){
stop("Avoid samples starting with numbers ")
}else if (any(is.na(samplesheet))){
warning("Columns with missing values")
}else{
message("All good.")
}
}

#' Function to help deploy analysis folder inside a project folder
#'
#' This function contains Rmd, R, md, files that help to structure
Expand All @@ -13,7 +39,11 @@
#' Normally these helper files are inside a report folder inside a
#' project folder.
#'
#' @param type string indicating the type of analysis, supported: rnaseq.
#' @param type string indicating the type of analysis, supported:
#' - base
#' - rnaseq, scrnaseq,
#' - teaseq
#' - cosmx
#'
#' @param outpath string path indicating where to copy all the files to
#' @examples
Expand All @@ -23,20 +53,30 @@
#' @export
bcbio_templates <- function(type="rnaseq", outpath){
switch(type,
base={
fpath <- system.file("rmarkdown/templates/common", "skeleton", package="bcbioR")
copyDirectory(fpath, outpath)
},
rnaseq={

fpath <- system.file("rmarkdown/templates/rnaseq", "skeleton", package="bcbioR")
#file.copy(fpath, outpath, recursive = T)
copyDirectory(fpath, outpath)
},
scrnaseq={

fpath <- system.file("rmarkdown/templates/singlecell", "skeleton", package="bcbioR")
#file.copy(fpath, outpath, recursive = T)
copyDirectory(fpath, outpath)
},
teaseq={
fpath <- system.file("rmarkdown/templates/teaseq", "skeleton", package="bcbioR")
copyDirectory(fpath, outpath)
},
cosmx={
fpath <- system.file("rmarkdown/templates/cosmx", "skeleton", package="bcbioR")
copyDirectory(fpath, outpath)
},
{
stop('project type not recognize, please choose: ', 'rnaseq', 'scrnaseq')
stop('project type not recognize, please choose: ', 'base',
'rnaseq', 'scrnaseq',
'teaseq', 'cosmx')
}
)
}
Expand Down
67 changes: 0 additions & 67 deletions README.Rmd

This file was deleted.

77 changes: 45 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@

# bcbioR

<!-- badges: start -->

[![R-CMD-check](https://github.com/bcbio/bcbioR/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/bcbio/bcbioR/actions/workflows/R-CMD-check.yaml)

<!-- badges: end -->

The goal of `bcbioR` is to create guidelines for NGS data interpretation
based on the experience of the Harvard Chan Bioinformatics Core and
everybody who contributes to this package.
The goal of `bcbioR` is to create guidelines for NGS data interpretation based on the experience of the Harvard Chan Bioinformatics Core and everybody who contributes to this package.

## Installation

You can install the development version of bcbioR from
[GitHub](https://github.com/) with:
You can install the development version of bcbioR from [GitHub](https://github.com/) with:

``` r
```
# install.packages("devtools")
devtools::install_github("bcbio/bcbioR")
devtools::install_github("bcbio/bcbioR",ref = "devel")
```

## Quick start

``` r
Use this code to generate a standard project name for all of your folders. **This code will not create any folders or files.**

```
library(bcbioR)
## basic example code
# will help you to build a folder name following HCBC naming rules
Expand All @@ -31,46 +31,59 @@ bcbio_set_project()

### Set base project

The following code will pop up a Rmd template and then clicking ‘save’
will populate that folder with HCBC data structure guidelines
use `setwd()` to set your current directory to the place where you want to work. The bcbioR functions will automatically write to whatever directory you have set.

``` r
rmarkdown::draft("project_folder",template="common",package="bcbioR")
```
setwd("/path/to/analysis/folder")
```

As well, You can get this by going to File -\> New File -\> R
markdown: - then `From Template`, and choose `bcbio base` - choose the
folder to deploy files, it could be a new folder or an existing one
The following code will pop up a Rmd template will populate that folder with HCBC data structure guidelines

```
bcbio_templates(type="base", outpath="/path/to/analysis/folder")
```

### Set RNAseq report folder

This code will populate the folder with HCBC data structure guidelines
and Rmd code:
This code will populate the folder with HCBC data structure guidelines and Rmd code: **You do not need to create a reports folder prior to running this code. This will create and populate the reports folder.**

``` r
bcbio_templates(type="rnaseq", outpath="test_folder/reports")
```
bcbio_templates(type="rnaseq", outpath="/path/to/analysis/folder/reports")
```

### Discover more…

Go to the vignette to know more
`vignette("bcbioR_quick_start,package="bcbioR")`
Go to the vignette to know more `vignette("bcbioR_quick_start",package="bcbioR")`

## How to Contribute

You’ll still need to render `README.Rmd` regularly, to keep `README.md`
up-to-date. `devtools::build_readme()` is handy for this.
### Open an issue

- If you find a bug
- If you want a new feature
- If you want to add code to the templates

### Modify the code

- Clone the repository
- Make sure you are in the `devel` branch
- Create a new branch `git checkout -b feature1`
- Modify you code, add and commit
- Push to GitHub the new branch
- Create a PR from your branch to `devel`
- Assignt the PR to me or Alex

Use `usethis::use_import_from("stringr","str_replace_all")` to add a
function you are using in the code.
Some best practices when developing:

Don’t forget to commit and push the resulting figure files, so they
display on GitHub and CRAN.
- install `devtools`
- Use `usethis::use_import_from("stringr","str_replace_all")` to add a new function you are using in the code.

### Contributors

- Lorena Pantano
- Alex Bartlett
- Emma Berdan
- Heather Wick
- James Billingsley
- Lorena Pantano
- Alex Bartlett
- Emma Berdan
- Heather Wick
- James Billingsley
- Zhu Zhuo
- Elizabeth Partan
Loading

0 comments on commit 298e52f

Please sign in to comment.