forked from marcocacciabue/infinity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.rmd
192 lines (117 loc) · 6.39 KB
/
README.rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
---
output: github_document
author: Marco Cacciabue, Débora N. Marcone
---
<!-- 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-",
dpi=300,
out.width = "100%"
)
app_name <- "INFINITy"
```
# **`r app_name `** <img src='man/figures/hex.png' style="float:right; height:200px;" /> a fast and accurate tool for classifying human influenza A and B virus sequences
<!-- badges: start -->
[![DOI](https://zenodo.org/badge/COMPLETE!!)](https://zenodo.org/badge/latestdoi/COMPLETE!!)
[![](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
[![R-CMD-check](https://github.com/marcocacciabue/infinity/workflows/R-CMD-check/badge.svg)](https://github.com/marcocacciabue/infinity/actions)
<!-- badges: end -->
If you wish to run the app without installation and directly on the web go to one the following servers:
## [INFINITy web-application official server!](https://infinity.unlu.edu.ar/)
## [INFINITy web-application secondary server!](https://cacciabue.shinyapps.io/infinity2/)
If you find our app useful please consider citing: [Cacciabue et al 2022](https://www.biorxiv.org/)
## :arrow_double_down: Installation
If you have a working R and Rstudio setup you
can install the released version of **`r app_name `** from [GitHub](https://github.com/) with:
``` r
if (!require("remotes", quietly = TRUE))
install.packages("remotes")
remotes::install_github("marcocacciabue/infinity")
```
This could take several minutes depending on your system and installation. Only the first time it runs.
Alternatively, you can download the repository as a .zip file and install it manually with Rstudio.
## :computer: Deploying **`r app_name `**
To start the app simply run the following command:
```{r, eval=FALSE}
infinity::runShinyApp()
```
:+1: You are ready to classify your data.
## **`r app_name `** is an R package
This means that users that prefer working directly in an R console can use some of the exported functions. The easiest way is to use the wrapper funtion "ClassifyInfinity()"
```{r, eval=FALSE}
#load the library
library(infinity)
# Indicate the file path to the fasta file to use.If your file is in your working directory you need to simply indicate the file name. In this case, we use a test file provided with the package itself.
file_path<-system.file("extdata","test_dataset.fasta",package="infinity")
# Use the wrapper function. You can change the classification model and pass other arguments
ClassifyInfinity(inputFile=file_path,model=FULL_HA)
# This command run the whole pipeline and saves a file in the working directory a "Results.csv" by default. You can change the name file setting the "outputFile" parameter.
```
For a more detailed workflow the user can use the exported functions of the package.
```{r, eval=FALSE}
# First we indicate the location of the fasta file. In this case, we use a test file provided with the package itself.
file_path<-system.file("extdata","test_dataset.fasta",package="infinity")
# We load the sequences
sequence<-ape::read.FASTA(file_path,type = "DNA")
# We the count and normalize the k-mers
NormalizedData <- Kcounter(SequenceData=sequence,model=FULL_HA)
# We perform the classification
PredictedData <- PredictionCaller(NormalizedData=NormalizedData,model=FULL_HA)
# We add the quality FLAGs
PredictedData <- QualityControl(PredictedData,model=FULL_HA)
# We adjust the classification according to the FLAGs present for each sample:
PredictedData <- Quality_filter(PredictedData)
# The PredictedData dataframe contains the classifications
PredictedData
```
## :whale: Docker images available
### **`r app_name `** as a shiny app in docker
Another way to run **`r app_name `** as a shiny app is to use the docker image. Follow these steps:
1. If you don´t already have it, install docker: https://www.docker.com/get-started.
2. Open a terminal and run the following:
```{bash, eval=FALSE}
docker pull cacciabue/infinity:shiny
```
and wait for the image to download. You only have to run this command the first time, or whenever you want to check for updates.
3. Once the downloading is complete run the following:
```{bash, eval=FALSE}
docker run -d --rm -p 3838:3838 cacciabue/infinity:shiny
```
4. Finally, open your favorite browser and go to http://localhost:3838/
5. The app should be up and running in your browser. Load the fasta file and press RUN.
6. You can save a report using the corresponding button.
### **`r app_name `** in a docker image with all dependecies allready installed
For more reproducibility a fully operational environment is available to work directly in docker:
1. If you don´t already have it, install docker: https://www.docker.com/get-started.
2. Open a terminal, go to the directory where the fasta files are stored and run the following:
```{bash, eval=FALSE}
docker pull cacciabue/infinity:cli
```
3. Once the downloading is complete run the following:
```{bash, eval=FALSE}
#for WINDOWS
docker run --rm --volume %cd%:/nexus cacciabue/infinity:cli
#for unix/MAC
docker run -it --volume $(pwd):/nexus cacciabue/infinity:cli
```
4. Now you can run
```{bash, eval=FALSE}
setwd('nexus')
# Indicate the file path to the fasta file to use.If your file is in your working directory you need to simply indicate the file name. In this case, we use a test file provided with the package itself.
file_path<-system.file("extdata","test_dataset.fasta",package="infinity")
# Use the wrapper function. You can change the classification model and pass other arguments
ClassifyInfinity(inputFile=file_path,model=FULL_HA)
# This command run the whole pipeline and saves a file in the working directory a "Results.csv" by default. You can change the name file setting the "outputFile" parameter.
# To exit the container just run
q()
```
5. Alternatively you can perform step 3 and 4 in one command like this:
```{bash, eval=FALSE}
#for WINDOWS
docker run --rm --volume %cd%:/nexus cacciabue/infinity:cli R -e "setwd('nexus');library('infinity');ClassifyInfinity(inputFile='test_dataset.fasta',model=FULL_HA)"
#for unix/MAC
docker run --rm --volume $(pwd):/nexus cacciabue/infinity:cli R -e "setwd('nexus');library('infinity');ClassifyInfinity(inputFile='test_dataset.fasta',model=FULL_HA)"
# USER SHOULD CHANGE test_dataset.fasta for the correct file name