File: compute_coverage.R

package info (click to toggle)
pyrle 0.0.33-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 320 kB
  • sloc: python: 1,142; makefile: 9
file content (19 lines) | stat: -rw-r--r-- 408 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env Rscript
args = commandArgs(trailingOnly=TRUE)

options(warn=-1)

f1 = args[1]
rf = args[2]

df1 = read.table(f1, sep="\t", header=TRUE)

suppressMessages(library(GenomicRanges))

result = coverage(GRanges(seqnames = df1$Chromosome, ranges = IRanges(start = df1$Start, end = df1$End)))

df = data.frame(Runs=runLength(result), Values=runValue(result))

print(df)

write.table(df, rf, sep="\t")