A note on fimo16 in TFutils

Introduction

Sequence-based TF affinity scoring can be conducted with the FIMO suite, see @Sonawane2017. We have serialized an object with references to FIMO outputs for 16 TFs.

suppressPackageStartupMessages({
library(TFutils)
library(GenomicRanges)
})
fimo16

While the token bed is used in the filenames, the files are not actually bed format!

Importing with scanTabix

We can use reduceByRange to import selected scans.

si = TFutils::seqinfo_hg19_chr17
myg = GRanges("chr17", IRanges(38.07e6,38.09e6), seqinfo=si)
colnames(fimo16) = fimo16$HGNC 
lk2 = reduceByRange(fimo16[, c("POU2F1", "VDR")],
  MAP=function(r,f) scanTabix(f, param=r))
str(lk2)

This result can be massaged into a GRanges or other desirable structure. fimo_granges takes care of this.

#fimo_ranges = function(gf, query) { # prototypical code
# rowRanges(gf) = query
# ans = reduceByRange(gf, MAP=function(r,f) scanTabix(f, param=r))
# ans = unlist(ans, recursive=FALSE)  # drop top list structure
# tabs = lapply(ans, lapply, function(x) {
#     con = textConnection(x)
#     on.exit(close(con))
#     dtf = read.delim(con, h=FALSE, stringsAsFactors=FALSE, sep="\t")
#     colnames(dtf) = c("chr", "start", "end", "rname", "score", "dir", "pval")
#     ans = with(dtf, GRanges(seqnames=chr, IRanges(start, end),
#            rname=rname, score=score, dir=dir, pval=pval))
#     ans
#     })
# GRangesList(unlist(tabs, recursive=FALSE))
#}
rr = fimo_granges(fimo16[, c("POU2F1", "VDR")], myg)
rr


Try the TFutils package in your browser

Any scripts or data that you put into this service are public.

TFutils documentation built on May 2, 2020, 2:01 a.m.