Entering edit mode
5.4 years ago
Assa Yeroslaviz
★
1.9k
after an update of the rtracklyer package, I loose the names of chromosomes in my bigwigfile object.
I have a list of bigwig files, I'm reading into R for processing.
filesList <- list.files(path = "./bigWigFiles",pattern = ".bw", full.names = TRUE)
bigWigList <- lapply(X = filesList, FUN = import.bw, as="NumericList")
In rtracklayer
version 1.38.3 the objkect has the names of the chromosome in a list
> str(bigWigList[[1]])
Formal class 'SimpleNumericList' [package "IRanges"] with 4 slots
..@ elementType : chr "numeric"
..@ elementMetadata: NULL
..@ metadata :List of 1
.. ..$ ranges:Formal class 'GRanges' [package "GenomicRanges"] with 6 slots
.. .. .. ..@ seqnames :Formal class 'Rle' [package "S4Vectors"] with 4 slots
.. .. .. .. .. ..@ values : Factor w/ 17 levels "chrI","chrII",..: 1 2 3 4 5 6 7 8 9 10 ...
.. .. .. .. .. ..@ lengths : int [1:17] 1 1 1 1 1 1 1 1 1 1 ...
.. .. .. .. .. ..@ elementMetadata: NULL
.. .. .. .. .. ..@ metadata : list()
.. .. .. ..@ ranges :Formal class 'IRanges' [package "IRanges"] with 6 slots
...
.. .. .. ..@ seqinfo :Formal class 'Seqinfo' [package "GenomeInfoDb"] with 4 slots
.. .. .. .. .. ..@ seqnames : chr [1:17] "chrI" "chrII" "chrIII" "chrIV" ...
.. .. .. .. .. ..@ seqlengths : int [1:17] NA NA NA NA NA NA NA NA NA NA ...
.. .. .. .. .. ..@ is_circular: logi [1:17] NA NA NA NA NA NA ...
.. .. .. .. .. ..@ genome : chr [1:17] NA NA NA NA ...
.. .. .. ..@ metadata : list()
..@ listData :List of 17
.. ..$ chrI : num [1:230218] 0 1 1 1 1 2 4 6 8 10 ...
.. ..$ chrII : num [1:813184] 8 14 24 30 37 44 56 58 64 67 ...
.. ..$ chrIII : num [1:316620] 1 4 5 7 7 10 11 10 15 18 ...
.. ..$ chrIV : num [1:1531933] 7 7 15 17 20 22 24 30 34 37 ...
.. ..$ chrIX : num [1:439888] 15 42 69 87 98 111 127 146 161 185 ...
.. ..$ chrV : num [1:576874] 0 0 0 0 0 0 0 0 0 0 ...
.. ..$ chrVI : num [1:270161] 0 3 3 4 6 8 10 11 11 11 ...
.. ..$ chrVII : num [1:1090940] 0 0 0 0 0 0 0 0 0 0 ...
.. ..$ chrVIII: num [1:562643] 4 4 4 4 4 4 4 4 4 4 ...
.. ..$ chrX : num [1:745751] 16 42 55 70 82 102 114 120 132 142 ...
.. ..$ chrXI : num [1:666816] 0 0 0 0 0 0 0 0 0 0 ...
.. ..$ chrXII : num [1:1078177] 0 0 0 0 0 0 0 0 0 0 ...
.. ..$ chrXIII: num [1:924431] 0 1 1 1 1 1 1 1 1 1 ...
.. ..$ chrXIV : num [1:784333] 0 0 0 0 0 0 0 0 0 0 ...
.. ..$ chrXV : num [1:1091291] 0 0 0 0 0 0 0 0 0 0 ...
.. ..$ chrXVI : num [1:948066] 0 0 0 0 0 0 0 0 0 0 ...
.. ..$ chrmt : num [1:85779] 33 52 70 71 73 80 83 84 85 87 ...
But in a different session with rtracklayer
version 1.44.0 I don't have them anymore.
str(bigWigList[[1]])
Formal class 'SimpleNumericList' [package "IRanges"] with 4 slots
..@ elementType : chr "numeric"
..@ elementMetadata: NULL
..@ metadata :List of 1
.. ..$ ranges:Formal class 'GRanges' [package "GenomicRanges"] with 7 slots
.. .. .. ..@ seqnames :Formal class 'Rle' [package "S4Vectors"] with 4 slots
.. .. .. .. .. ..@ values : Factor w/ 17 levels "chrI","chrII",..: 1 2 3 4 5 6 7 8 9 10 ...
.. .. .. .. .. ..@ lengths : int [1:17] 1 1 1 1 1 1 1 1 1 1 ...
.. .. .. .. .. ..@ elementMetadata: NULL
.. .. .. .. .. ..@ metadata : list()
.. .. .. ..@ ranges :Formal class 'IRanges' [package "IRanges"] with 6 slots
...
.. .. .. .. .. ..@ seqnames : chr [1:17] "chrI" "chrII" "chrIII" "chrIV" ...
.. .. .. .. .. ..@ seqlengths : int [1:17] NA NA NA NA NA NA NA NA NA NA ...
.. .. .. .. .. ..@ is_circular: logi [1:17] NA NA NA NA NA NA ...
.. .. .. .. .. ..@ genome : chr [1:17] NA NA NA NA ...
.. .. .. ..@ elementMetadata:Formal class 'DataFrame' [package "S4Vectors"] with 6 slots
.. .. .. .. .. ..@ rownames : NULL
.. .. .. .. .. ..@ nrows : int 17
.. .. .. .. .. ..@ listData : Named list()
.. .. .. .. .. ..@ elementType : chr "ANY"
.. .. .. .. .. ..@ elementMetadata: NULL
.. .. .. .. .. ..@ metadata : list()
.. .. .. ..@ elementType : chr "ANY"
.. .. .. ..@ metadata : list()
..@ listData :List of 17
.. ..$ : num [1:230218] 0 1 1 1 1 2 4 6 8 10 ...
.. ..$ : num [1:813184] 8 14 24 30 37 44 56 58 64 67 ...
.. ..$ : num [1:316620] 1 4 5 7 7 10 11 10 15 18 ...
.. ..$ : num [1:1531933] 7 7 15 17 20 22 24 30 34 37 ...
.. ..$ : num [1:439888] 15 42 69 87 98 111 127 146 161 185 ...
.. ..$ : num [1:576874] 0 0 0 0 0 0 0 0 0 0 ...
.. ..$ : num [1:270161] 0 3 3 4 6 8 10 11 11 11 ...
.. ..$ : num [1:1090940] 0 0 0 0 0 0 0 0 0 0 ...
.. ..$ : num [1:562643] 4 4 4 4 4 4 4 4 4 4 ...
.. ..$ : num [1:745751] 16 42 55 70 82 102 114 120 132 142 ...
.. ..$ : num [1:666816] 0 0 0 0 0 0 0 0 0 0 ...
.. ..$ : num [1:1078177] 0 0 0 0 0 0 0 0 0 0 ...
.. ..$ : num [1:924431] 0 1 1 1 1 1 1 1 1 1 ...
.. ..$ : num [1:784333] 0 0 0 0 0 0 0 0 0 0 ...
.. ..$ : num [1:1091291] 0 0 0 0 0 0 0 0 0 0 ...
.. ..$ : num [1:948066] 0 0 0 0 0 0 0 0 0 0 ...
.. ..$ : num [1:85779] 33 52 70 71 73 80 83 84 85 87 ...
For both versions I'm using the exact same command with the exact same bigwig file. Any idea what was changed, or how I can get the chromosome names into the output?
thanks Assa
I have figured out I can get them by calling them as such
But this looks a bit extreme. Is there a better way?
I think a better way to access them, instead of using slots directly, would be
thanks for the suggestion. IMHO this is also not really a fixed solution, but just a different way to dodge the problem.
Previously it was possible to access them using the command
names(bigWigList[[1]])
because they were saved with the data.If you were able to access them previously, it might be worth starting a discussion with the developers on their recommended forum (mostly a GitHub issue here). It seems their
listData
slot has gone from being a named list to an unnamed list.