Read any number of byte ranges from a Gesel database file on the local filesystem.

readDatabaseRanges(dir, name, start, end)

Arguments

dir

String containing the path to a directory containing all Gesel database files.

name

String containing the name of a Gesel database file. This usually has the species identifier as a prefix, e.g., "9606_set2gene.tsv.gz".

start

Integer vector containing the zero-indexed closed start of each byte range to extract from the file. This may be of zero length.

end

Integer vector containing the zero-indexed open end of each byte range to extract from the file. This should have the same length as start such that the i-th range is defined as [start[i], end[i]). All ranges supplied in a single call to this function should be non-overlapping.

Value

List of length equal to length(start). Each entry is a raw vector representing the contents of the corresponding byte range.

See also

downloadDatabaseRanges, for a remote counterpart to this function that requests the byte ranges from a server.

Examples

path <- downloadDatabaseFile("9606_set2gene.tsv")
readDatabaseRanges(dirname(path), basename(path), 0L, 100L)
#> [[1]]
#>   [1] 31 31 36 39 31 09 31 35 33 36 0a 38 35 39 09 36 33 32 09 31 32 38 38 09 32
#>  [26] 32 39 36 09 31 34 38 09 39 34 09 33 31 37 36 09 32 36 34 30 09 33 34 32 09
#>  [51] 33 32 32 09 36 30 37 36 09 36 39 36 39 0a 31 34 34 33 09 34 31 09 35 09 31
#>  [76] 35 36 31 09 31 30 37 38 09 33 35 32 09 32 34 32 37 09 31 33 36 09 32 39 33
#> 
readDatabaseRanges(dirname(path), basename(path), c(10, 100, 1000), c(20, 150, 1100))
#> [[1]]
#>  [1] 0a 38 35 39 09 36 33 32 09 31
#> 
#> [[2]]
#>  [1] 39 09 32 39 34 39 0a 31 34 34 35 09 32 09 31 09 31 38 37 31 34 0a 32 37 35
#> [26] 34 0a 34 35 36 33 09 31 0a 32 34 36 39 09 32 31 30 09 32 09 38 30 39 32 09
#> 
#> [[3]]
#>   [1] 09 31 31 09 32 31 09 31 33 30 09 31 31 09 34 09 36 32 09 32 31 31 09 35 33
#>  [26] 09 31 30 09 36 36 34 09 35 09 37 38 09 32 33 31 09 32 39 09 32 33 09 37 31
#>  [51] 30 09 32 09 33 38 37 09 32 38 35 09 32 32 39 09 34 34 35 09 32 39 37 09 31
#>  [76] 32 36 09 34 09 32 38 09 37 39 09 36 36 09 37 39 09 33 33 39 09 39 31 09 31
#>