...
|
...
|
@@ -55,11 +55,11 @@
|
55
|
55
|
|
56
|
56
|
## We want to deal with chromosomes in a reasonable way. This coerces likely inputs to a unified
|
57
|
57
|
## chromosome name as understood by UCSC. Accepted inputs are:
|
58
|
|
-## - a single integer or a character coercable to one or integer-character combinations
|
|
58
|
+## - a single integer or a character coercible to one or integer-character combinations
|
59
|
59
|
## - a character, starting with 'chr' (case insensitive)
|
60
|
60
|
## Arguments:
|
61
|
61
|
## o x: a character string to be converted to a valid UCSC chromosome name
|
62
|
|
-## o force: a logical flag, force prepending of 'chr' if missing
|
|
62
|
+## o force: a logical flag, force pre-pending of 'chr' if missing
|
63
|
63
|
## Value: the UCSC character name
|
64
|
64
|
.chrName <- function(x, force = FALSE) {
|
65
|
65
|
if (!getOption("ucscChromosomeNames") || length(x) == 0) {
|
...
|
...
|
@@ -86,10 +86,9 @@
|
86
|
86
|
head <- TRUE
|
87
|
87
|
}
|
88
|
88
|
if (!head) {
|
89
|
|
- stop(sprintf(paste(
|
90
|
|
- "Invalid chromosome identifier '%s'\nPlease consider setting options(ucscChromosomeNames=FALSE)",
|
91
|
|
- "to allow for arbitrary chromosome identifiers."
|
92
|
|
- ), y))
|
|
89
|
+ stop(sprintf("Invalid chromosome identifier '%s'\n", y),
|
|
90
|
+ "Please consider setting options(ucscChromosomeNames=FALSE) ",
|
|
91
|
+ "to allow for arbitrary chromosome identifiers.")
|
93
|
92
|
}
|
94
|
93
|
substring(y, 1, 3) <- tolower(substring(y, 1, 3))
|
95
|
94
|
y
|
...
|
...
|
@@ -113,7 +112,7 @@
|
113
|
112
|
## unimplemented types...
|
114
|
113
|
## Arguments:
|
115
|
114
|
## o GdObject: an object inheriting from class GdObject
|
116
|
|
-## Value: a logical skalar indicating whether stacking is needed or not
|
|
115
|
+## Value: a logical scalar indicating whether stacking is needed or not
|
117
|
116
|
.needsStacking <- function(GdObject) stacking(GdObject) %in% c("squish", "pack", "full")
|
118
|
117
|
|
119
|
118
|
|
...
|
...
|
@@ -1430,42 +1429,29 @@ addScheme <- function(scheme, name) {
|
1430
|
1429
|
.getBiomart <- function(genome) {
|
1431
|
1430
|
map <- .ucsc2Ensembl(genome)
|
1432
|
1431
|
if (map$date == "head") {
|
1433
|
|
- bm <- useMart("ensembl", dataset = map$dataset)
|
|
1432
|
+ bm <- useEnsembl(biomart="ensembl", dataset = map$dataset)
|
1434
|
1433
|
ds <- listDatasets(bm)
|
1435
|
1434
|
mt <- ds[match(map$dataset, ds$dataset), "version"]
|
1436
|
1435
|
if (is.na(mt)) {
|
1437
|
|
- stop(sprintf(paste(
|
1438
|
|
- "Gviz thinks that the UCSC genome identifier '%s' should map to the Biomart data set '%s' which is not correct.",
|
1439
|
|
- "\nPlease manually provide biomaRt object"
|
1440
|
|
- ), genome, map$dataset))
|
|
1436
|
+ stop(sprintf("Gviz thinks that the UCSC genome identifier '%s' should map to the Biomart data set '%s' which is not correct.",
|
|
1437
|
+ genome, map$dataset), "\nPlease manually provide biomaRt object")
|
1441
|
1438
|
}
|
1442
|
1439
|
if (mt != map$value) {
|
1443
|
|
- stop(sprintf(
|
1444
|
|
- paste(
|
1445
|
|
- "Gviz thinks that the UCSC genome identifier '%s' should map to the current Biomart head as '%s',",
|
1446
|
|
- "but its current version is '%s'.\nPlease manually provide biomaRt object"
|
1447
|
|
- ),
|
1448
|
|
- genome, map$value, mt
|
1449
|
|
- ))
|
|
1440
|
+ stop(sprintf("Gviz thinks that the UCSC genome identifier '%s' should map to the current Biomart head as '%s', ",
|
|
1441
|
+ genome, map$value, mt), "but its current version is '%s'.\nPlease manually provide biomaRt object.")
|
1450
|
1442
|
}
|
1451
|
1443
|
} else {
|
1452
|
|
- bm <- useMart(host = sprintf("%s.archive.ensembl.org", tolower(sub(".", "", map$date, fixed = TRUE))), biomart = "ENSEMBL_MART_ENSEMBL", dataset = map$dataset)
|
|
1444
|
+ bm <- useEnsembl(biomart = "ENSEMBL_MART_ENSEMBL", dataset = map$dataset, host = sprintf("%s.archive.ensembl.org", tolower(sub(".", "", map$date, fixed = TRUE))))
|
1453
|
1445
|
ds <- listDatasets(bm)
|
1454
|
1446
|
mt <- ds[match(map$dataset, ds$dataset), "version"]
|
1455
|
1447
|
if (is.na(mt)) {
|
1456
|
|
- stop(sprintf(paste(
|
1457
|
|
- "Gviz thinks that the UCSC genome identifier '%s' should map to the Biomart data set '%s' which is not correct.",
|
1458
|
|
- "\nPlease manually provide biomaRt object"
|
1459
|
|
- ), genome, map$dataset))
|
|
1448
|
+ stop(sprintf("Gviz thinks that the UCSC genome identifier '%s' should map to the Biomart data set '%s' which is not correct.",
|
|
1449
|
+ genome, map$dataset), "\nPlease manually provide biomaRt object")
|
1460
|
1450
|
}
|
1461
|
1451
|
if (mt != map$value) {
|
1462
|
|
- stop(sprintf(
|
1463
|
|
- paste(
|
1464
|
|
- "Gviz thinks that the UCSC genome identifier '%s' should map to Biomart archive %s (version %s) as '%s',",
|
1465
|
|
- "but its version is '%s'.\nPlease manually provide biomaRt object"
|
1466
|
|
- ),
|
1467
|
|
- genome, sub(".", " ", map$date, fixed = TRUE), map$version, map$value, mt
|
1468
|
|
- ))
|
|
1452
|
+ stop(sprintf("Gviz thinks that the UCSC genome identifier '%s' should map to Biomart archive %s (version %s) as '%s',",
|
|
1453
|
+ genome, sub(".", " ", map$date, fixed = TRUE), map$version, map$value, mt),
|
|
1454
|
+ "but its version is '%s'.\nPlease manually provide biomaRt object")
|
1469
|
1455
|
}
|
1470
|
1456
|
}
|
1471
|
1457
|
return(bm)
|
...
|
...
|
@@ -2216,7 +2202,7 @@ availableDisplayPars <- function(class) {
|
2216
|
2202
|
}
|
2217
|
2203
|
class <- match.arg(class, c(
|
2218
|
2204
|
"GdObject", "GenomeAxisTrack", "RangeTrack", "NumericTrack", "DataTrack", "IdeogramTrack", "StackedTrack",
|
2219
|
|
- "AnnotationTrack", "DetailsAnnotationTrack", "GeneRegionTrack", "BiomartGeneRegionTrack",
|
|
2205
|
+ "AnnotationTrack", "DetailsAnnotationTrack", "GeneRegionTrack", "BiomartGeneRegionTrack",
|
2220
|
2206
|
"AlignmentsTrack", "SequenceTrack", "SequenceBSgenomeTrack", "SequenceDNAStringSetTrack", "SequenceRNAStringSetTrack"
|
2221
|
2207
|
))
|
2222
|
2208
|
parents <- names(getClassDef(class)@contains)
|
...
|
...
|
@@ -2372,10 +2358,8 @@ availableDisplayPars <- function(class) {
|
2372
|
2358
|
dat
|
2373
|
2359
|
})
|
2374
|
2360
|
if (is(res, "try-error")) {
|
2375
|
|
- warning(sprintf(paste(
|
2376
|
|
- "File '%s' is not valid according to the GFF3 standard and can not be properly parsed.",
|
2377
|
|
- "Results may not be what you expected!"
|
2378
|
|
- ), file))
|
|
2361
|
+ warning(sprintf("File '%s' is not valid according to the GFF3 standard and can not be properly parsed.",
|
|
2362
|
+ file), "\nResults may not be what you expected!")
|
2379
|
2363
|
res <- dat
|
2380
|
2364
|
}
|
2381
|
2365
|
return(res)
|
...
|
...
|
@@ -2804,13 +2788,8 @@ availableDefaultMapping <- function(file, trackType) {
|
2804
|
2788
|
vm[[inputType]] <- setNames(list(list(".stream" = stream)), trackType)
|
2805
|
2789
|
} else {
|
2806
|
2790
|
if (is.null(vm[[inputType]]) || is.null(vm[[inputType]][[trackType]])) {
|
2807
|
|
- warning(sprintf(
|
2808
|
|
- paste(
|
2809
|
|
- "There are no default mappings from %s files to %s. Please provide a manual mapping",
|
2810
|
|
- "in the track constructor if you haven't already done so."
|
2811
|
|
- ),
|
2812
|
|
- inputType, trackType
|
2813
|
|
- ))
|
|
2791
|
+ warning(sprintf("There are no default mappings from %s files to %s. Please provide a manual mapping",
|
|
2792
|
+ inputType, trackType), " in the track constructor if you haven't already done so.")
|
2814
|
2793
|
vm[[inputType]] <- setNames(list(list(".stream" = stream)), trackType)
|
2815
|
2794
|
}
|
2816
|
2795
|
}
|