Browse code

fixed gdm also

Simone authored on 19/07/2021 07:02:30
Showing 1 changed files
... ...
@@ -1294,6 +1294,9 @@ sample_region <- function(url, datasetName,sampleName) {
1294 1294
             samples <- GenomicRanges::makeGRangesFromDataFrame(
1295 1295
                 df,
1296 1296
                 keep.extra.columns = TRUE,
1297
+                seqnames.field = c("seqnames", "seqname",
1298
+                                   "chromosome", "chrom",
1299
+                                   "chr", "chromosome_name"),
1297 1300
                 start.field = "left",
1298 1301
                 end.field = "right",
1299 1302
                 strand.field="strand"
Browse code

fixed error on gtf importing dataset files with seqid as other group columns

Simone authored on 17/07/2021 14:32:55
Showing 1 changed files
... ...
@@ -1272,22 +1272,20 @@ sample_region <- function(url, datasetName,sampleName) {
1272 1272
             col.names = FALSE,
1273 1273
             row.names = FALSE
1274 1274
         )
1275
+        vector_field <- vapply(
1276
+            list$fields, function(x) x$name, character(1)
1277
+        )
1275 1278
         if (identical(schema_type, "gtf")) {
1276
-            samples <- tryCatch(
1277
-                expr = {
1278
-                    rtracklayer::import(temp, format = "gtf")
1279
-                },
1280
-                error = function(e){ 
1281
-                    rtracklayer::import(temp, format = "gff", version = "3")
1282
-                },
1283
-                warning = function(w){
1284
-                    rtracklayer::import(temp, format = "gff", version = "3")
1285
-                }
1279
+            attr_col_names <- vector_field[
1280
+              !vector_field %in% c(
1281
+                "seqname", "seqid", "start", "end", "strand"
1282
+              )]
1283
+            samples <- rtracklayer::import(
1284
+                temp, 
1285
+                format = "gtf",
1286
+                colnames = attr_col_names
1286 1287
             )
1287 1288
         } else {
1288
-            vector_field <- vapply(
1289
-                list$fields, function(x) x$name, character(1)
1290
-            )
1291 1289
             df <- data.table::fread(temp, header = FALSE, sep = "\t")
1292 1290
             a <- df[1, 2]
1293 1291
             if(is.na(as.numeric(a)))
Browse code

fixed import gtf, granges schema

Simone authored on 08/06/2021 09:04:48
Showing 1 changed files
... ...
@@ -1273,7 +1273,17 @@ sample_region <- function(url, datasetName,sampleName) {
1273 1273
             row.names = FALSE
1274 1274
         )
1275 1275
         if (identical(schema_type, "gtf")) {
1276
-            samples <- rtracklayer::import(temp, format = "gtf")
1276
+            samples <- tryCatch(
1277
+                expr = {
1278
+                    rtracklayer::import(temp, format = "gtf")
1279
+                },
1280
+                error = function(e){ 
1281
+                    rtracklayer::import(temp, format = "gff", version = "3")
1282
+                },
1283
+                warning = function(w){
1284
+                    rtracklayer::import(temp, format = "gff", version = "3")
1285
+                }
1286
+            )
1277 1287
         } else {
1278 1288
             vector_field <- vapply(
1279 1289
                 list$fields, function(x) x$name, character(1)
Browse code

show_all_metadata use one rest call API

Simone authored on 26/05/2021 07:14:40
Showing 1 changed files
... ...
@@ -1352,3 +1352,25 @@ serialize_query <- function(url,output_gtf,base64) {
1352 1352
     schema
1353 1353
 }
1354 1354
 
1355
+.metadata_matrix <- function(url, datasetName) {
1356
+  url <- sub("/*[/]$", "", url)
1357
+  URL <- paste0(url, "/metadata/", datasetName, "/", "dataset/matrix")
1358
+  authToken = GMQL_credentials$authToken
1359
+  h <- c(
1360
+      'X-Auth-Token' = authToken, 
1361
+      'Accpet' = 'application/json',
1362
+      'Content-Type' = 'application/json')
1363
+  req <- httr::POST(
1364
+      URL, 
1365
+      body = '{"attributes": []}' ,
1366
+      httr::add_headers(h), 
1367
+      encode = "json"
1368
+  )
1369
+  content <- httr::content(req,"parsed")
1370
+
1371
+  if (req$status_code != 200) {
1372
+    stop(content)
1373
+  } else {
1374
+    return(content)
1375
+  }
1376
+}
Browse code

update vignette, new datasets

Simone authored on 18/05/2021 20:04:54
Showing 1 changed files
... ...
@@ -893,8 +893,6 @@ show_schema <- function(url, datasetName) {
893 893
 #' }
894 894
 #' if schemaName is NULL, it looks for a XML schema file to read in the 
895 895
 #' folderPath
896
-#' @param isGMQL logical value indicating whether it is uploaded a GMQL 
897
-#' dataset or not
898 896
 #'
899 897
 #' @return None
900 898
 #'
Browse code

biocheck

Simone authored on 17/05/2021 09:41:45
Showing 1 changed files
... ...
@@ -1,11 +1,11 @@
1 1
 if(getRversion() >= "2.15.1") {
2
-  utils::globalVariables("GMQL_credentials")
3
-  utils::globalVariables("remote_url")
2
+    utils::globalVariables("GMQL_credentials")
3
+    utils::globalVariables("remote_url")
4 4
 }
5 5
 
6 6
 if(getRversion() >= "3.1.0") {
7
-  utils::suppressForeignCheck("GMQL_credentials")
8
-  utils::suppressForeignCheck("remote_url")
7
+    utils::suppressForeignCheck("GMQL_credentials")
8
+    utils::suppressForeignCheck("remote_url")
9 9
 }
10 10
 
11 11
 
... ...
@@ -50,47 +50,51 @@ if(getRversion() >= "3.1.0") {
50 50
 #' @export
51 51
 #' 
52 52
 login_gmql <- function(url, username = NULL, password = NULL) {
53
-  if(!.is_login_expired(url)) {
54
-    print("Login still valid")
55
-    return(invisible(NULL))
56
-  }
57
-  
58
-  as_guest <- TRUE
59
-  
60
-  if(!is.null(username) || !is.null(password))
61
-    as_guest <- FALSE
62
-  
63
-  url <- sub("/*[/]$","",url)
64
-  
65
-  if(as_guest) {
66
-    h <- c('Accept' = "Application/json")
67
-    URL <- paste0(url,"/guest")
68
-    req <- httr::GET(URL,httr::add_headers(h))
69
-  } else {
70
-    req <- httr::GET(url)
71
-    real_URL <- sub("/*[/]$","",req$url)
72
-    h <- c('Accept'="Application/json",'Content-Type'='Application/json')
73
-    URL <- paste0(real_URL,"/login")
74
-    body <- list('username' = username,'password' = password)
75
-    req <- httr::POST(URL, httr::add_headers(h), body = body, encode = "json")
76
-  }
77
-  
78
-  content <- httr::content(req)
79
-  
80
-  if(req$status_code != 200)
81
-    stop(content$errorString)
82
-  else {
83
-    url <- paste0(url,"/")
84
-    GMQL_remote <- list(
85
-      "remote_url" = url, 
86
-      "authToken" = content$authToken,
87
-      "username" = username,
88
-      "password" = password
89
-    )
90
-  
91
-    assign("GMQL_credentials", GMQL_remote, .GlobalEnv)
92
-    print(paste("your Token is", GMQL_remote$authToken))
93
-  }
53
+    if(!.is_login_expired(url)) {
54
+        print("Login still valid")
55
+        return(invisible(NULL))
56
+    }
57
+    
58
+    as_guest <- TRUE
59
+    
60
+    if(!is.null(username) || !is.null(password))
61
+        as_guest <- FALSE
62
+    
63
+    url <- sub("/*[/]$","",url)
64
+    
65
+    if(as_guest) {
66
+        h <- c('Accept' = "Application/json")
67
+        URL <- paste0(url,"/guest")
68
+        req <- httr::GET(URL,httr::add_headers(h))
69
+    } else {
70
+        req <- httr::GET(url)
71
+        real_URL <- sub("/*[/]$","",req$url)
72
+        h <- c('Accept'="Application/json",'Content-Type'='Application/json')
73
+        URL <- paste0(real_URL,"/login")
74
+        body <- list('username' = username,'password' = password)
75
+        req <- httr::POST(
76
+            URL, 
77
+            httr::add_headers(h), 
78
+            body = body, 
79
+            encode = "json")
80
+    }
81
+    
82
+    content <- httr::content(req)
83
+    
84
+    if(req$status_code != 200)
85
+        stop(content$errorString)
86
+    else {
87
+        url <- paste0(url,"/")
88
+        GMQL_remote <- list(
89
+            "remote_url" = url, 
90
+            "authToken" = content$authToken,
91
+            "username" = username,
92
+            "password" = password
93
+        )
94
+        
95
+        assign("GMQL_credentials", GMQL_remote, .GlobalEnv)
96
+        print(paste("your Token is", GMQL_remote$authToken))
97
+    }
94 98
 }
95 99
 
96 100
 #' Logout from GMQL
... ...
@@ -124,24 +128,24 @@ login_gmql <- function(url, username = NULL, password = NULL) {
124 128
 #' @export
125 129
 #'
126 130
 logout_gmql <- function(url) {
127
-  url <- sub("/*[/]$","",url)
128
-  URL <- paste0(url,"/logout")
129
-  
130
-  authToken = GMQL_credentials$authToken
131
-  h <- c('X-Auth-Token' = authToken)
132
-  
133
-  req <- httr::GET(URL, httr::add_headers(h))
134
-  content <- httr::content(req)
135
-  
136
-  if(req$status_code !=200)
137
-    stop(content$error)
138
-  else {
139
-    #delete token from environment
140
-    if(exists("authToken", where = GMQL_credentials))
141
-      rm(GMQL_credentials, envir = .GlobalEnv)
131
+    url <- sub("/*[/]$","",url)
132
+    URL <- paste0(url,"/logout")
133
+    
134
+    authToken = GMQL_credentials$authToken
135
+    h <- c('X-Auth-Token' = authToken)
142 136
     
143
-    print(content)
144
-  }
137
+    req <- httr::GET(URL, httr::add_headers(h))
138
+    content <- httr::content(req)
139
+    
140
+    if(req$status_code !=200)
141
+        stop(content$error)
142
+    else {
143
+        #delete token from environment
144
+        if(exists("authToken", where = GMQL_credentials))
145
+            rm(GMQL_credentials, envir = .GlobalEnv)
146
+        
147
+        print(content)
148
+    }
145 149
 }
146 150
 #' Register into remote GMQL
147 151
 #' 
... ...
@@ -185,46 +189,46 @@ logout_gmql <- function(url) {
185 189
 #' @export
186 190
 #'
187 191
 register_gmql <- function(
188
-  url, 
189
-  username, 
190
-  psw, 
191
-  email, 
192
-  first_name, 
193
-  last_name
192
+    url, 
193
+    username, 
194
+    psw, 
195
+    email, 
196
+    first_name, 
197
+    last_name
194 198
 ) {
195
-  req <- httr::GET(url)
196
-  url <- sub("/*[/]$","",req$url)
197
-  
198
-  URL <- paste0(url,"/register")
199
-  h <- c('Accept' = "Application/json")
200
-  reg_body <- list(
201
-    "firstName" = first_name, 
202
-    "lastName" = last_name,
203
-    "username" = username, 
204
-    "email" = email, 
205
-    "password" = psw
206
-  )
207
-  
208
-  req <- httr::POST(
209
-    URL, 
210
-    body = reg_body, 
211
-    httr::add_headers(h), 
212
-    encode = "json"
213
-  )
214
-  
215
-  content <- httr::content(req,"parsed")
216
-  if(req$status_code != 200) {
217
-    stop(content)
218
-  } else {
219
-    GMQL_remote <- list(
220
-      "remote_url" = url, 
221
-      "authToken" = content$authToken,
222
-      "username" = username,
223
-      "password" = psw
199
+    req <- httr::GET(url)
200
+    url <- sub("/*[/]$","",req$url)
201
+    
202
+    URL <- paste0(url,"/register")
203
+    h <- c('Accept' = "Application/json")
204
+    reg_body <- list(
205
+        "firstName" = first_name, 
206
+        "lastName" = last_name,
207
+        "username" = username, 
208
+        "email" = email, 
209
+        "password" = psw
210
+    )
211
+    
212
+    req <- httr::POST(
213
+        URL, 
214
+        body = reg_body, 
215
+        httr::add_headers(h), 
216
+        encode = "json"
224 217
     )
225
-    assign("GMQL_credentials", GMQL_remote, .GlobalEnv)
226
-    print(paste("your Token is", GMQL_remote$authToken))
227
-  }
218
+    
219
+    content <- httr::content(req,"parsed")
220
+    if(req$status_code != 200) {
221
+        stop(content)
222
+    } else {
223
+        GMQL_remote <- list(
224
+            "remote_url" = url, 
225
+            "authToken" = content$authToken,
226
+            "username" = username,
227
+            "password" = psw
228
+        )
229
+        assign("GMQL_credentials", GMQL_remote, .GlobalEnv)
230
+        print(paste("your Token is", GMQL_remote$authToken))
231
+    }
228 232
 }
229 233
 
230 234
 
... ...
@@ -265,17 +269,17 @@ register_gmql <- function(
265 269
 #' @export
266 270
 #'
267 271
 show_queries_list <- function(url) {
268
-  url <- sub("/*[/]$","",url)
269
-  URL <- paste0(url,"/query")
270
-  authToken = GMQL_credentials$authToken
271
-  h <- c('Accept' = 'Application/json', 'X-Auth-Token' = authToken)
272
-  req <- httr::GET(URL, httr::add_headers(h))
273
-  content <- httr::content(req,"parsed")
274
-  if(req$status_code == 200) {
275
-    return(content)
276
-  } else {
277
-    stop(content$error)
278
-  }
272
+    url <- sub("/*[/]$","",url)
273
+    URL <- paste0(url,"/query")
274
+    authToken = GMQL_credentials$authToken
275
+    h <- c('Accept' = 'Application/json', 'X-Auth-Token' = authToken)
276
+    req <- httr::GET(URL, httr::add_headers(h))
277
+    content <- httr::content(req,"parsed")
278
+    if(req$status_code == 200) {
279
+        return(content)
280
+    } else {
281
+        stop(content$error)
282
+    }
279 283
 }
280 284
 
281 285
 #' Save GMQL query
... ...
@@ -323,24 +327,24 @@ show_queries_list <- function(url) {
323 327
 #' @export
324 328
 #'
325 329
 save_query <- function(url, queryName, queryTxt) {
326
-  req <- httr::GET(url)
327
-  url <- sub("/*[/]$","",req$url)
328
-  URL <- paste0(url,"/query/",queryName,"/save")
329
-  authToken = GMQL_credentials$authToken
330
-  h <- c(
331
-    'Accept' = 'text/plain',
332
-    'X-Auth-Token' = authToken,
333
-    'Content-Type' = 'text/plain'
334
-  )
335
-  req <- httr::POST(URL, httr::add_headers(h),body = queryTxt)
336
-  content <- httr::content(req)
337
-  
338
-  if(req$status_code == 200) {
339
-    # print Saved
340
-    print(content) 
341
-  } else {
342
-    stop(content$error)
343
-  }
330
+    req <- httr::GET(url)
331
+    url <- sub("/*[/]$","",req$url)
332
+    URL <- paste0(url,"/query/",queryName,"/save")
333
+    authToken = GMQL_credentials$authToken
334
+    h <- c(
335
+        'Accept' = 'text/plain',
336
+        'X-Auth-Token' = authToken,
337
+        'Content-Type' = 'text/plain'
338
+    )
339
+    req <- httr::POST(URL, httr::add_headers(h),body = queryTxt)
340
+    content <- httr::content(req)
341
+    
342
+    if(req$status_code == 200) {
343
+        # print Saved
344
+        print(content) 
345
+    } else {
346
+        stop(content$error)
347
+    }
344 348
 }
345 349
 
346 350
 #' @param filePath string local file path of a txt file containing a GMQL query
... ...
@@ -350,12 +354,12 @@ save_query <- function(url, queryName, queryTxt) {
350 354
 #' @export
351 355
 #' 
352 356
 save_query_fromfile <- function(url, queryName, filePath) {
353
-  if(!file.exists(filePath)) {
354
-    stop("file does not exist")
355
-  }
356
-  
357
-  queryTxt <- readLines(filePath)
358
-  save_query(url,queryName,queryTxt)
357
+    if(!file.exists(filePath)) {
358
+        stop("file does not exist")
359
+    }
360
+    
361
+    queryTxt <- readLines(filePath)
362
+    save_query(url,queryName,queryTxt)
359 363
 }
360 364
 
361 365
 #############################
... ...
@@ -415,28 +419,28 @@ save_query_fromfile <- function(url, queryName, filePath) {
415 419
 #' @export
416 420
 #'
417 421
 run_query <- function(url, queryName, query, output_gtf = TRUE) {
418
-  if(output_gtf)
419
-    out <- "GTF"
420
-  else
421
-    out <- "TAB"
422
-  
423
-  req <- httr::GET(url)
424
-  url <- sub("/*[/]$","",req$url)
425
-  URL <- paste0(url,"/queries/run/",queryName,"/",out)
426
-  authToken = GMQL_credentials$authToken
427
-  h <- c(
428
-    'Accept' = "Application/json",
429
-    'Content-Type' = 'text/plain',
430
-    'X-Auth-Token' = authToken
431
-  )
432
-  
433
-  req <- httr::POST(URL,body = query ,httr::add_headers(h),encode = "json")
434
-  content <- httr::content(req,"parsed")
435
-  if (req$status_code != 200) {
436
-    stop(content$error)
437
-  } else {
438
-    return(content)
439
-  }
422
+    if(output_gtf)
423
+        out <- "GTF"
424
+    else
425
+        out <- "TAB"
426
+    
427
+    req <- httr::GET(url)
428
+    url <- sub("/*[/]$","",req$url)
429
+    URL <- paste0(url,"/queries/run/",queryName,"/",out)
430
+    authToken = GMQL_credentials$authToken
431
+    h <- c(
432
+        'Accept' = "Application/json",
433
+        'Content-Type' = 'text/plain',
434
+        'X-Auth-Token' = authToken
435
+    )
436
+    
437
+    req <- httr::POST(URL,body = query ,httr::add_headers(h),encode = "json")
438
+    content <- httr::content(req,"parsed")
439
+    if (req$status_code != 200) {
440
+        stop(content$error)
441
+    } else {
442
+        return(content)
443
+    }
440 444
 }
441 445
 
442 446
 #' @import httr
... ...
@@ -447,13 +451,13 @@ run_query <- function(url, queryName, query, output_gtf = TRUE) {
447 451
 #' @export
448 452
 #' 
449 453
 run_query_fromfile <- function(url, filePath, output_gtf = TRUE) {
450
-  if (!file.exists(filePath)) {
451
-    stop("file does not exist")
452
-  }
453
-  
454
-  query <- readLines(filePath)
455
-  queryName <- sub('\\..*$', '', basename(filePath))
456
-  run_query(url, queryName, query, output_gtf)
454
+    if (!file.exists(filePath)) {
455
+        stop("file does not exist")
456
+    }
457
+    
458
+    query <- readLines(filePath)
459
+    queryName <- sub('\\..*$', '', basename(filePath))
460
+    run_query(url, queryName, query, output_gtf)
457 461
 }
458 462
 
459 463
 #' Compile GMQL query
... ...
@@ -501,27 +505,27 @@ run_query_fromfile <- function(url, filePath, output_gtf = TRUE) {
501 505
 #' @export
502 506
 #'
503 507
 compile_query <- function(url, query) {
504
-  authToken = GMQL_credentials$authToken
505
-  h <- c(
506
-    'Accept' = "Application/json",
507
-    'Content-Type' = 'text/plain',
508
-    'X-Auth-Token' = authToken
509
-  )
510
-  req <- httr::GET(url)
511
-  url <- sub("/*[/]$","",req$url)
512
-  URL <- paste0(url, "/queries/compile")
513
-  req <- httr::POST(
514
-    URL, 
515
-    body = query ,
516
-    httr::add_headers(h), 
517
-    encode = "json"
518
-  )
519
-  content <- httr::content(req, "parsed")
520
-  if (req$status_code != 200) {
521
-    stop(content$error)
522
-  } else {
523
-    return(content)
524
-  }
508
+    authToken = GMQL_credentials$authToken
509
+    h <- c(
510
+        'Accept' = "Application/json",
511
+        'Content-Type' = 'text/plain',
512
+        'X-Auth-Token' = authToken
513
+    )
514
+    req <- httr::GET(url)
515
+    url <- sub("/*[/]$","",req$url)
516
+    URL <- paste0(url, "/queries/compile")
517
+    req <- httr::POST(
518
+        URL, 
519
+        body = query ,
520
+        httr::add_headers(h), 
521
+        encode = "json"
522
+    )
523
+    content <- httr::content(req, "parsed")
524
+    if (req$status_code != 200) {
525
+        stop(content$error)
526
+    } else {
527
+        return(content)
528
+    }
525 529
 }
526 530
 
527 531
 #' @name compile_query
... ...
@@ -529,12 +533,12 @@ compile_query <- function(url, query) {
529 533
 #' @export
530 534
 #'
531 535
 compile_query_fromfile <- function(url ,filePath) {
532
-  if (!file.exists(filePath)) {
533
-    stop("file does not exist")
534
-  }
535
-  
536
-  query <- readLines(filePath)
537
-  compile_query(url, query)
536
+    if (!file.exists(filePath)) {
537
+        stop("file does not exist")
538
+    }
539
+    
540
+    query <- readLines(filePath)
541
+    compile_query(url, query)
538 542
 }
539 543
 
540 544
 #' Stop a job
... ...
@@ -574,17 +578,17 @@ compile_query_fromfile <- function(url ,filePath) {
574 578
 #' @export
575 579
 #'
576 580
 stop_job <- function(url, job_id) {
577
-  url <- sub("/*[/]$", "", url)
578
-  URL <- paste0(url, "/jobs/", job_id, "/stop")
579
-  authToken = GMQL_credentials$authToken
580
-  h <- c('X-Auth-Token' = authToken, 'Accept' = 'text/plain')
581
-  req <- httr::GET(URL, httr::add_headers(h))
582
-  content <- httr::content(req, "parsed")
583
-  if (req$status_code != 200) {
584
-    stop(content)
585
-  } else {
586
-    print(content)
587
-  }
581
+    url <- sub("/*[/]$", "", url)
582
+    URL <- paste0(url, "/jobs/", job_id, "/stop")
583
+    authToken = GMQL_credentials$authToken
584
+    h <- c('X-Auth-Token' = authToken, 'Accept' = 'text/plain')
585
+    req <- httr::GET(URL, httr::add_headers(h))
586
+    content <- httr::content(req, "parsed")
587
+    if (req$status_code != 200) {
588
+        stop(content)
589
+    } else {
590
+        print(content)
591
+    }
588 592
 }
589 593
 
590 594
 #' Show a job log or trace
... ...
@@ -626,18 +630,18 @@ stop_job <- function(url, job_id) {
626 630
 #' @export
627 631
 #'
628 632
 show_job_log <- function(url, job_id) {
629
-  url <- sub("/*[/]$", "", url)
630
-  URL <- paste0(url, "/jobs/", job_id, "/log")
631
-  authToken = GMQL_credentials$authToken
632
-  h <- c('X-Auth-Token' = authToken, 'Accept' = 'Application/json')
633
-  req <- httr::GET(URL, httr::add_headers(h))
634
-  content <- httr::content(req, "parsed")
635
-  
636
-  if (req$status_code != 200) {
637
-    stop(content$error)
638
-  } else {
639
-    print(unlist(content, use.names = FALSE))
640
-  }
633
+    url <- sub("/*[/]$", "", url)
634
+    URL <- paste0(url, "/jobs/", job_id, "/log")
635
+    authToken = GMQL_credentials$authToken
636
+    h <- c('X-Auth-Token' = authToken, 'Accept' = 'Application/json')
637
+    req <- httr::GET(URL, httr::add_headers(h))
638
+    content <- httr::content(req, "parsed")
639
+    
640
+    if (req$status_code != 200) {
641
+        stop(content$error)
642
+    } else {
643
+        print(unlist(content, use.names = FALSE))
644
+    }
641 645
 }
642 646
 
643 647
 
... ...
@@ -649,18 +653,18 @@ show_job_log <- function(url, job_id) {
649 653
 #' @export
650 654
 #'
651 655
 trace_job <- function(url, job_id) {
652
-  url <- sub("/*[/]$", "", url)
653
-  URL <- paste0(url, "/jobs/", job_id, "/trace")
654
-  authToken = GMQL_credentials$authToken
655
-  h <- c('X-Auth-Token' = authToken, 'Accept' = 'Application/json')
656
-  req <- httr::GET(URL, httr::add_headers(h))
657
-  content <- httr::content(req, "parsed")
658
- 
659
-   if (req$status_code != 200) {
660
-    stop(content$error)
661
-  } else {
662
-    return(content)
663
-  }
656
+    url <- sub("/*[/]$", "", url)
657
+    URL <- paste0(url, "/jobs/", job_id, "/trace")
658
+    authToken = GMQL_credentials$authToken
659
+    h <- c('X-Auth-Token' = authToken, 'Accept' = 'Application/json')
660
+    req <- httr::GET(URL, httr::add_headers(h))
661
+    content <- httr::content(req, "parsed")
662
+    
663
+    if (req$status_code != 200) {
664
+        stop(content$error)
665
+    } else {
666
+        return(content)
667
+    }
664 668
 }
665 669
 
666 670
 #' Show all jobs
... ...
@@ -694,18 +698,18 @@ trace_job <- function(url, job_id) {
694 698
 #' @export
695 699
 #' 
696 700
 show_jobs_list <- function(url) {
697
-  url <- sub("/*[/]$", "", url)
698
-  URL <- paste0(url, "/jobs")
699
-  authToken = GMQL_credentials$authToken
700
-  h <- c('X-Auth-Token' = authToken)
701
-  req <- httr::GET(URL, httr::add_headers(h))
702
-  content <- httr::content(req, "parsed")
703
-  
704
-  if (req$status_code != 200) {
705
-    stop(content$error)
706
-  } else {
707
-    return(content)
708
-  }
701
+    url <- sub("/*[/]$", "", url)
702
+    URL <- paste0(url, "/jobs")
703
+    authToken = GMQL_credentials$authToken
704
+    h <- c('X-Auth-Token' = authToken)
705
+    req <- httr::GET(URL, httr::add_headers(h))
706
+    content <- httr::content(req, "parsed")
707
+    
708
+    if (req$status_code != 200) {
709
+        stop(content$error)
710
+    } else {
711
+        return(content)
712
+    }
709 713
 }
710 714
 
711 715
 #############################
... ...
@@ -746,18 +750,18 @@ show_jobs_list <- function(url) {
746 750
 #' @export
747 751
 #'
748 752
 show_datasets_list <- function(url) {
749
-  url <- sub("/*[/]$", "", url)
750
-  URL <- paste0(url, "/datasets")
751
-  authToken = GMQL_credentials$authToken
752
-  h <- c('X-Auth-Token' = authToken)
753
-  req <- httr::GET(URL, httr::add_headers(h))
754
-  content <- httr::content(req, "parsed") #JSON
755
-  
756
-  if (req$status_code != 200) {
757
-    stop(content$error)
758
-  } else {
759
-    return(content)
760
-  }
753
+    url <- sub("/*[/]$", "", url)
754
+    URL <- paste0(url, "/datasets")
755
+    authToken = GMQL_credentials$authToken
756
+    h <- c('X-Auth-Token' = authToken)
757
+    req <- httr::GET(URL, httr::add_headers(h))
758
+    content <- httr::content(req, "parsed") #JSON
759
+    
760
+    if (req$status_code != 200) {
761
+        stop(content$error)
762
+    } else {
763
+        return(content)
764
+    }
761 765
 }
762 766
 
763 767
 
... ...
@@ -801,18 +805,18 @@ show_datasets_list <- function(url) {
801 805
 #' @rdname show_samples_list
802 806
 #' @export
803 807
 show_samples_list <- function(url, datasetName) {
804
-  url <- sub("/*[/]$", "", url)
805
-  URL <- paste0(url, "/datasets/", datasetName)
806
-  authToken = GMQL_credentials$authToken
807
-  h <- c('X-Auth-Token' = authToken)
808
-  req <- httr::GET(URL, httr::add_headers(h))
809
-  content <- httr::content(req, "parsed")
810
-  
811
-  if (req$status_code != 200) {
812
-    stop(content$error)
813
-  } else {
814
-    return(content)
815
-  }
808
+    url <- sub("/*[/]$", "", url)
809
+    URL <- paste0(url, "/datasets/", datasetName)
810
+    authToken = GMQL_credentials$authToken
811
+    h <- c('X-Auth-Token' = authToken)
812
+    req <- httr::GET(URL, httr::add_headers(h))
813
+    content <- httr::content(req, "parsed")
814
+    
815
+    if (req$status_code != 200) {
816
+        stop(content$error)
817
+    } else {
818
+        return(content)
819
+    }
816 820
 }
817 821
 
818 822
 #' Show dataset schema
... ...
@@ -852,18 +856,18 @@ show_samples_list <- function(url, datasetName) {
852 856
 #' @export
853 857
 #'
854 858
 show_schema <- function(url, datasetName) {
855
-  url <- sub("/*[/]$", "", url)
856
-  URL <- paste0(url, "/datasets/", datasetName, "/schema")
857
-  authToken = GMQL_credentials$authToken
858
-  h <- c('X-Auth-Token' = authToken)
859
-  req <- httr::GET(URL, httr::add_headers(h))
860
-  content <- httr::content(req, "parsed")
861
-  
862
-  if (req$status_code != 200) {
863
-    stop(content$error)
864
-  } else {
865
-    return(content)
866
-  }
859
+    url <- sub("/*[/]$", "", url)
860
+    URL <- paste0(url, "/datasets/", datasetName, "/schema")
861
+    authToken = GMQL_credentials$authToken
862
+    h <- c('X-Auth-Token' = authToken)
863
+    req <- httr::GET(URL, httr::add_headers(h))
864
+    content <- httr::content(req, "parsed")
865
+    
866
+    if (req$status_code != 200) {
867
+        stop(content$error)
868
+    } else {
869
+        return(content)
870
+    }
867 871
 }
868 872
 
869 873
 #' Upload dataset
... ...
@@ -938,76 +942,75 @@ show_schema <- function(url, datasetName) {
938 942
 #' @export
939 943
 #'
940 944
 upload_dataset <- function(
941
-  url,
942
-  datasetName,
943
-  folderPath,
944
-  schemaName = NULL
945
+    url,
946
+    datasetName,
947
+    folderPath,
948
+    schemaName = NULL
945 949
 ) {
946
-  
947
-  folderPath <- sub("/*[/]$","",folderPath)
948
-  if(basename(folderPath) !="files")
949
-    folderPath <- file.path(folderPath,"files")
950
-  
951
-  files <- list.files(folderPath, pattern = "*(.gtf|.gdm)", full.names = TRUE)
952
-  if (!length(files)) {
953
-    stop("no files present")
954
-  }
955
-  
956
-  count = .counter(0)
957
-  
958
-  list_files <- lapply(files, function(x) {
959
-    file <- httr::upload_file(x)
960
-  })
961
-  
962
-  list_files_names <- vapply(list_files, function(x) {
963
-    paste0("file", count())
964
-  }, character(1))
965
-  
966
-  names(list_files) <- list_files_names
967
-  req <- httr::GET(url)
968
-  real_URL <- sub("/*[/]$","",req$url)
969
-  URL <- paste0(real_URL, "/datasets/", datasetName, "/uploadSample")
970
-  authToken = GMQL_credentials$authToken
971
-  h <- c('X-Auth-Token' = authToken, 'Accept:' = 'Application/json')
972
-  
973
-  schema_name <- tolower(schemaName)
974
-  
975
-  if (is.null(schemaName) || identical(schema_name, "customparser")) {
976
-    schema <- .retrieve_schema(folderPath)
950
+    folderPath <- sub("/*[/]$","",folderPath)
951
+    if(basename(folderPath) !="files")
952
+        folderPath <- file.path(folderPath,"files")
977 953
     
978
-    list_files <- list(
979
-      list("schema" = httr::upload_file(schema)),
980
-      list_files
981
-    )
982
-    list_files <- unlist(list_files, recursive = FALSE)
954
+    files <- list.files(folderPath, pattern = "*(.gtf|.gdm)", full.names = TRUE)
955
+    if (!length(files)) {
956
+        stop("no files present")
957
+    }
958
+    
959
+    count = .counter(0)
960
+    
961
+    list_files <- lapply(files, function(x) {
962
+        file <- httr::upload_file(x)
963
+    })
964
+    
965
+    list_files_names <- vapply(list_files, function(x) {
966
+        paste0("file", count())
967
+    }, character(1))
968
+    
969
+    names(list_files) <- list_files_names
970
+    req <- httr::GET(url)
971
+    real_URL <- sub("/*[/]$","",req$url)
983 972
     URL <- paste0(real_URL, "/datasets/", datasetName, "/uploadSample")
984
-  } else {
985
-    schemaList <- c(
986
-      "narrowpeak",
987
-      "vcf",
988
-      "broadpeak",
989
-      "bed",
990
-      "bedgraph"
991
-    )
992
-    if (!schema_name %in% schemaList) {
993
-      stop("schema not admissable")
973
+    authToken = GMQL_credentials$authToken
974
+    h <- c('X-Auth-Token' = authToken, 'Accept:' = 'Application/json')
975
+    
976
+    schema_name <- tolower(schemaName)
977
+    
978
+    if (is.null(schemaName) || identical(schema_name, "customparser")) {
979
+        schema <- .retrieve_schema(folderPath)
980
+        
981
+        list_files <- list(
982
+            list("schema" = httr::upload_file(schema)),
983
+            list_files
984
+        )
985
+        list_files <- unlist(list_files, recursive = FALSE)
986
+        URL <- paste0(real_URL, "/datasets/", datasetName, "/uploadSample")
987
+    } else {
988
+        schemaList <- c(
989
+            "narrowpeak",
990
+            "vcf",
991
+            "broadpeak",
992
+            "bed",
993
+            "bedgraph"
994
+        )
995
+        if (!schema_name %in% schemaList) {
996
+            stop("schema not admissable")
997
+        }
998
+        
999
+        URL <- paste0(
1000
+            real_URL,
1001
+            "/datasets/",
1002
+            datasetName,
1003
+            "/uploadSample?schemaName=",
1004
+            schema_name
1005
+        )
994 1006
     }
995 1007
     
996
-    URL <- paste0(
997
-      real_URL,
998
-      "/datasets/",
999
-      datasetName,
1000
-      "/uploadSample?schemaName=",
1001