Skip to content

Commit

Permalink
Remove todo from vignette (#115)
Browse files Browse the repository at this point in the history
* correct mistakes in vignettes

* styling

* grammar mistakes

* how to link your own files

---------

Co-authored-by: Tymoteusz Kwieciński <[email protected]>
  • Loading branch information
nizwant and Fersoil authored Sep 4, 2024
1 parent 45206bf commit 5c03e62
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 21 deletions.
15 changes: 7 additions & 8 deletions vignettes/example_script.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ knitr::opts_chunk$set(

# Introduction

The basic functionality of the `PvSTATEM` package is reading raw MBA data. To present the package's functionalities, we use a sample dataset from the Covid OISE study, which is pre-loaded into the package. Firstly, let us load the dataset as the `plate` object.
The basic functionality of the `PvSTATEM` package is reading raw MBA data. To present the package's functionalities, we use a sample dataset from the Covid OISE study, which is pre-loaded into the package. You might want to replace these variables with paths to your files on your local disk. Firstly, let us load the dataset as the `plate` object.

```{r}
library(PvSTATEM)
library(ggplot2)
plate_filepath <- system.file("extdata", "CovidOISExPONTENT.csv", package = "PvSTATEM", mustWork = TRUE) # get the filepath of the csv dataset
Expand All @@ -49,15 +48,15 @@ plate$sample_names
plate$analyte_names
```

The summary can also the accessed using the built-in generic method `summary`.
The summary can also be accessed using the built-in generic method `summary`.

```{r}
summary(plate)
```

## Quality control

The package can plot the dilutions along the MFI values, allowing manual inspecting of the standard curve. This method raises a warning in case the MFI values were not adjusted using the blank samples.
The package can plot the dilutions along the MFI values, allowing manual inspection of the standard curve. This method raises a warning in case the MFI values were not adjusted using the blank samples.

```{r}
plot_standard_curve_analyte(plate, analyte_name = "OC43_S")
Expand Down Expand Up @@ -92,23 +91,23 @@ The plotting function has more options, such as selecting which axis the log sca
Another useful method of inspecting the potential errors of the data is `plot_mfi_for_analyte`.
This method plots the MFI values of standard curve samples for a given analyte along the boxplot of the MFI values of the test samples.

It helps identifying the outlier samples and checking if the tests samples are within the range of the standard curve samples.
It helps identify the outlier samples and check if the test samples are within the range of the standard curve samples.

```{r}
plot_mfi_for_analyte(plate, analyte_name = "OC43_S")
plot_mfi_for_analyte(plate, analyte_name = "Spike_6P")
```

It can be seen, that for the `Spike_6P` analyte, the MFI values don't fall within the range of the standard curve samples, which could be problematic for the model. The values of test dilutions will be extrapolated from the standard curve, which may lead to incorrect results.
It can be seen that for the `Spike_6P` analyte, the MFI values don't fall within the range of the standard curve samples, which could be problematic for the model. The values of test dilutions will be extrapolated from the standard curve, which may lead to incorrect results.

## Normalization


After inspection, we may create the model for the standard curve of a certain antibody.
The model is fitted using the `nplr` package, which provides a simple interface
for fitting n-parameter logistic regression models,
but to create clearer interface for the user,
but to create a clearer interface for the user,
we encapsulated this model into our own class called `Model` for simplicity.
The detailed documentation of the `Model` class can be found by executing the command `?Model`.

Expand Down Expand Up @@ -155,7 +154,7 @@ plot_standard_curve_analyte_with_model(plate, model, log_scale = c("all"))
plot_standard_curve_analyte_with_model(plate, model, log_scale = c("all"), plot_asymptote = FALSE)
```

Apart from the plotting, the package can predict values of all the samples on the plate.
Apart from the plotting, the package can predict the values of all the samples on the plate.

```{r}
mfi_values <- plate$data$Median$OC43_S
Expand Down
38 changes: 25 additions & 13 deletions vignettes/our_datasets.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -20,46 +20,58 @@ knitr::opts_chunk$set(

# Introduction

Our package main purpose is to read, perform quality control and normalize raw MBA data. Unfortunately, different devices and labs have different data formats. We gathered few datasets on which our package could be tested. This document describes the datasets and theirs sources.
Our package's main purpose is to read, perform quality control, and normalize raw MBA data. Unfortunately, different devices and labs have different data formats. We gathered a few datasets on which our package could be tested. This document describes the datasets and their sources.

The majority of our datasets, available for the public are stored in the `extdata` folder of the package. The remaining ones - both private and the larger number of publicly available datasets are stored in the `OneDrive` folder, which is accessible for the package developers.
The majority of our datasets, available for the public are stored in the `extdata` folder of the package. The remaining ones - both private and the larger number of publicly available datasets are stored in the `OneDrive` folder, which is accessible to the package developers.

## How to access the files

The simples way of accessing the files is to simply download them from our GitHub repository.
The simple way of accessing the files is to download them from our GitHub repository.

Another way, is to source the files using the `system.file` function. The function returns the path to the file, which can be used to read the data. The function has the following syntax:
Another way is to source the files using the `system.file` function. The function returns the path to the file, which can be used to read the data. The function has the following syntax:

TODO
```{r}
dataset_name <- "CovidOISExPONTENT.csv"
dataset_filepath <- system.file("extdata", dataset_name, package = "PvSTATEM", mustWork = TRUE)
```
The variable `dataset_filepath` now contains the path to the specified dataset on your computer. Since we know the filepath to the desired dataset, we can execute the `read_data` function to read the data. The function has the following syntax:

```{r}
library(PvSTATEM)
plate <- read_luminex_data(dataset_filepath)
plate
```

## Description of the datasets

Our datasets are divided into three main categories:

- **artificial** - the ones created by us for the purpose of testing the package functionalities
- **public** - the publicly available datasets, produced in scope of PvSTATEM project or by the laboratories participating in the project.
- **external** - the ones gathered from public domain, external sources, independent from PvSTATEM project
- **public** - the publicly available datasets, produced in the scope of PvSTATEM project or by the laboratories participating in the project.
- **external** - the ones gathered from the public domain, external sources, independent from PvSTATEM project


### Artificial datasets

In order to perform simple unit tests and validate the most basic reading functionalities of the package, we created a few artificial datasets. The datasets are stored in the `extdata` folder of the package. The datasets are:

- `random.csv` - a simple dataset with random values, used to test the basic functionalities of the package
- `random2.csv` - another simple dataset with random values, used to test the basic functionalities of the package. This file has a corresponding, artificial layout - `random_layout.csv`
- `random.csv` - a simple dataset with random values used to test the basic functionalities of the package
- `random2.csv` - another simple dataset with random values used to test the basic functionalities of the package. This file has a corresponding, artificial layout - `random_layout.csv`
- `random_broken_colB.csv` - this dataset has a broken column, which should be detected by the package and reported as a warning

### Public datasets

The datasets from this category are the most important for the package development, since the main purpose of the package is to make the preprocessing of the data easier in scope of the PvSTATEM project.
The datasets from this category are the most important for package development since the main purpose of the package is to make the preprocessing of the data easier in the scope of the PvSTATEM project.

The majority of them are stored in the `OneDrive` folder of the package. The datasets available in the `extdata` folder are two files coming from Covid oise examination:
The majority of them are stored in the package's `OneDrive` folder. The datasets available in the `extdata` folder are two files coming from Covid oise examination:

- `CovidOISExPONTENT.csv`, which is a `IG4DC2~1.csv` plate from examination `IgG_CovidOise4_30plex`. It contains corresponding layout file `CovidOISExPONTENT_layout.xlsx`
- `CovidOISExPONTENT.csv`, which is a `IG4DC2~1.csv` plate from examination `IgG_CovidOise4_30plex`. It contains the corresponding layout file `CovidOISExPONTENT_layout.xlsx`
- `CovidOISExPONTENT_CO.csv`, which is a `IGG_CO~1.csv` plate from examination `IgG_CovidOise2_30plex` and corresponding layout file

Most of examples and vignettes in the package are based on these datasets.
Most of the examples and vignettes in the package are based on these datasets.

### External datasets

Expand Down

0 comments on commit 5c03e62

Please sign in to comment.