Write USCS genome browser file from intervals set data frame

fwrite_ucsc(
  intervals,
  file,
  name,
  type = NULL,
  description = "",
  color = "black",
  rm_intervalID = TRUE,
  append = FALSE,
  sparse = TRUE,
  span = NULL,
  categories = NULL,
  ...
)

Arguments

intervals

misha intervals set. Can have an additional 'name' and 'score' fields. When 'type' equals to 'barChart', the intervals should have also a 'strand', 'category' and 'name2' fields.

file

name of the output file

name

track name

type

track type. See https://genome.ucsc.edu/FAQ/FAQformat.html

description

track description

color

color of the track in the genome browser

rm_intervalID

remove intervalID column from intervals

append

append to an existing file

span

span parameter for type = "wig"

categories

categories order for 'barChart' type

...

list of additional attributes such as group or priority. See: https://genome.ucsc.edu/goldenPath/help/customTrack.html

Examples

if (FALSE) {
gset_genome("mm9")
intervals <- gintervals(1, c(3025716, 3052742, 3181668), c(3026216, 3053242, 3182168))
intervals$score <- c(0.2, 0.5, 1)
fwrite_ucsc(intervals, "out.ucsc", name = "clust1", type = "bedGraph", graphType = "bar", color = "red", viewLimits = "0:1", autoScale = "off")
intevals2 <- gintervals(1, c(3671488, 3903482, 3943609), c(3671988, 3903982, 3944109))
intevals2$score <- c(1, 0.2, 0.45)
fwrite_ucsc(intervals2, "out.ucsc", name = "clust2", type = "bedGraph", graphType = "bar", color = "blue", viewLimits = "0:1", autoScale = "off", append = TRUE)
}