Browse code

check and bioccheck complete, merged

nikopech authored on 27/12/2021 10:03:47
Showing 7 changed files

... ...
@@ -94,8 +94,7 @@ lineagespot <- function(vcf_fls = NULL,
94 94
     lineage_report <- uniq_variants(hits_table = hits_table,
95 95
                                    AF_threshold = AF_threshold,
96 96
                                    file.out = paste0("lineage_report_",
97
-                                                     file.out.index, ".txt"),
98
-                                   print.out = print.out)
97
+                                                     file.out.index, ".txt"))
99 98
 
100 99
     out <- list("variants.table" = vcf_table,
101 100
                "lineage.hits" = hits_table,
... ...
@@ -28,7 +28,7 @@
28 28
 #' merge_vcf(vcf_folder = system.file("extdata",
29 29
 #'                                    "vcf-files",
30 30
 #'                                    package = "lineagespot"),
31
-#'
31
+#' 
32 32
 #'           gff3_path = system.file("extdata",
33 33
 #'                                   "NC_045512.2_annot.gff3",
34 34
 #'                                   package = "lineagespot"))
... ...
@@ -50,8 +50,8 @@ merge_vcf <- function(vcf_fls = NULL,
50 50
     if( is.null(vcf_fls) ) {
51 51
 
52 52
         vcf_fls <- list.files(vcf_folder,
53
-        pattern = "vcf",
54
-        full.names = TRUE)
53
+                              pattern = "vcf",
54
+                              full.names = TRUE)
55 55
 
56 56
 
57 57
     }
... ...
@@ -233,7 +233,7 @@ compute_AF <- function(x) {
233 233
 
234 234
 change_AA_abbreviations <- function(x) {
235 235
 
236
-    AA_abbreviations <- data.table(Three_Letter <- c("Ala",
236
+    AA_abbreviations <- data.table(Three_Letter = c("Ala",
237 237
                                                    "Arg",
238 238
                                                    "Asn",
239 239
                                                    "Asp",
... ...
@@ -254,7 +254,7 @@ change_AA_abbreviations <- function(x) {
254 254
                                                    "Tyr",
255 255
                                                    "Val"),
256 256
 
257
-                                  One_Letter <- c("A",
257
+                                  One_Letter = c("A",
258 258
                                                  "R",
259 259
                                                  "N",
260 260
                                                  "D",
... ...
@@ -282,8 +282,8 @@ change_AA_abbreviations <- function(x) {
282 282
     for(i in seq_len(nrow(AA_abbreviations))) {
283 283
 
284 284
         x$AA_alt <- str_replace_all(x$AA_alt,
285
-        AA_abbreviations[i,]$Three_Letter,
286
-        AA_abbreviations[i,]$One_Letter)
285
+                                    AA_abbreviations[i,]$Three_Letter,
286
+                                    AA_abbreviations[i,]$One_Letter)
287 287
 
288 288
     }
289 289
 
... ...
@@ -316,7 +316,7 @@ correct_Orf1ab_gene <- function(x, genes) {
316 316
 
317 317
 read_gene_coordinates <- function(gff_path) {
318 318
 
319
-    gene_annot - fread(gff_path, header = FALSE, sep = "\t")
319
+    gene_annot <- fread(gff_path, header = FALSE, sep = "\t")
320 320
 
321 321
     gene_annot <- gene_annot[, c(4, 5, 9), with = FALSE]
322 322
 
... ...
@@ -11,8 +11,7 @@ lineagespot(
11 11
   ref_folder = NULL,
12 12
   voc = c("B.1.617.2", "B.1.1.7", "B.1.351", "P.1"),
13 13
   AF_threshold = 0.8,
14
-  file.out.index = Sys.Date(),
15
-  print.out = FALSE
14
+  file.out.index = Sys.Date()
16 15
 )
17 16
 }
18 17
 \arguments{
... ...
@@ -30,9 +29,6 @@ that will be integrated into a single table}
30 29
 \item{AF_threshold}{A parameter indicating the AF threshold for identifying variants per sample}
31 30
 
32 31
 \item{file.out.index}{A string index that is going to be contained in the output file names}
33
-
34
-\item{print.out}{Logical value indicating if the produced table should be printed.
35
-Default value is FALSE.}
36 32
 }
37 33
 \value{
38 34
 A list of three elements;
... ...
@@ -51,7 +47,7 @@ variant(s) file(s)
51 47
 }
52 48
 \examples{
53 49
 
54
-results = lineagespot(vcf_folder = system.file("extdata", "vcf-files",
50
+results <- lineagespot(vcf_folder = system.file("extdata", "vcf-files",
55 51
                                                 package = "lineagespot"),
56 52
 
57 53
                       gff3_path = system.file("extdata",
... ...
@@ -8,8 +8,7 @@ lineagespot_hits(
8 8
   vcf_table = NULL,
9 9
   ref_folder = NULL,
10 10
   voc = c("B.1.617.2", "B.1.1.7", "B.1.351", "P.1"),
11
-  file.out = paste0("lineage_hits_", Sys.Date(), ".txt"),
12
-  print.out = FALSE
11
+  file.out = paste0("lineage_hits_", Sys.Date(), ".txt")
13 12
 )
14 13
 }
15 14
 \arguments{
... ...
@@ -20,8 +19,6 @@ lineagespot_hits(
20 19
 \item{voc}{A character vector containing the names of the lineages of interest}
21 20
 
22 21
 \item{file.out}{Given name for the output file}
23
-
24
-\item{print.out}{Logical value indicating if the produced table should be printed}
25 22
 }
26 23
 \value{
27 24
 A data table containing all identified SARS-CoV-2 variants
... ...
@@ -33,7 +30,7 @@ coming from outbreak.info reports
33 30
 }
34 31
 \examples{
35 32
 
36
-variants_table = merge_vcf(vcf_folder = system.file("extdata",
33
+variants_table <- merge_vcf(vcf_folder = system.file("extdata",
37 34
                                                     "vcf-files",
38 35
                                                     package = "lineagespot"),
39 36
 
... ...
@@ -43,12 +40,12 @@ variants_table = merge_vcf(vcf_folder = system.file("extdata",
43 40
 
44 41
 # retrieve lineage reports using outbreak.info's API
45 42
 
46
-lineage_hits_table = lineagespot_hits(vcf_table = variants_table,
43
+lineage_hits_table <- lineagespot_hits(vcf_table = variants_table,
47 44
                                       voc = c("B.1.1.7", "B.1.617.2"))
48 45
 
49 46
 
50 47
 # use user-specified references
51
-lineage_hits_table.2 = lineagespot_hits(vcf_table = variants_table,
48
+lineage_hits_table.2 <- lineagespot_hits(vcf_table = variants_table,
52 49
                                         ref_folder = system.file("extdata", "ref",
53 50
                                                                  package = "lineagespot"))
54 51
 
... ...
@@ -8,8 +8,7 @@ merge_vcf(
8 8
   vcf_fls = NULL,
9 9
   vcf_folder = NULL,
10 10
   gff3_path = NULL,
11
-  file.out = paste0("Variant_table_", Sys.Date(), ".txt"),
12
-  print.out = FALSE
11
+  file.out = paste0("Variant_table_", Sys.Date(), ".txt")
13 12
 )
14 13
 }
15 14
 \arguments{
... ...
@@ -21,8 +20,6 @@ will be integrated into a single table}
21 20
 \item{gff3_path}{Path to GFF3 file}
22 21
 
23 22
 \item{file.out}{Given name for the output file}
24
-
25
-\item{print.out}{Logical value indicating if the produced table should be printed}
26 23
 }
27 24
 \value{
28 25
 A data table contaiing all variants from each sample of the input VCF files
... ...
@@ -7,8 +7,7 @@
7 7
 uniq_variants(
8 8
   hits_table = NULL,
9 9
   AF_threshold = 0.8,
10
-  file.out = paste0("lineage_report_", Sys.Date(), ".txt"),
11
-  print.out = FALSE
10
+  file.out = paste0("lineage_report_", Sys.Date(), ".txt")
12 11
 )
13 12
 }
14 13
 \arguments{
... ...
@@ -20,8 +19,6 @@ identify the presence or not of a variant. This is used to compute the number
20 19
 of variants in a sample and eventually the proportion of a lineage.}
21 20
 
22 21
 \item{file.out}{Given name for the output file}
23
-
24
-\item{print.out}{Logical value indicating if the produced table should be printed}
25 22
 }
26 23
 \value{
27 24
 A data table with metrics assessing the
... ...
@@ -32,16 +29,16 @@ Lineage report for variants overlapping
32 29
 }
33 30
 \examples{
34 31
 
35
-variants_table = merge_vcf(vcf_folder = system.file("extdata", "vcf-files",
32
+variants_table <- merge_vcf(vcf_folder = system.file("extdata", "vcf-files",
36 33
                                                     package = "lineagespot"),
37 34
 
38 35
                            gff3_path = system.file("extdata",
39 36
                                                    "NC_045512.2_annot.gff3",
40 37
                                                    package = "lineagespot"))
41 38
 
42
-lineage_hits_table = lineagespot_hits(vcf_table = variants_table,
39
+lineage_hits_table <- lineagespot_hits(vcf_table = variants_table,
43 40
                                       voc = c("B.1.1.7", "B.1.617.2"))
44 41
 
45
-report = uniq_variants(hits_table = lineage_hits_table)
42
+report <- uniq_variants(hits_table = lineage_hits_table)
46 43
 head(report)
47 44
 }
48 45
deleted file mode 100644