-
Notifications
You must be signed in to change notification settings - Fork 0
/
makeread.r
36 lines (25 loc) · 880 Bytes
/
makeread.r
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
library(polyester)
library(Biostrings)
# read the quant.sf
makeReads <- function(quant_file, fastapath, output_dir, repeat_times=1){
quants <- read.table(quant_file, header = T, stringsAsFactors = F)
fasta <- readDNAStringSet(fastapath)
if (!all(quants$Transcript == names(fasta))) {
stop("quant assignment Not match with fasta file ")
}
NumRead <- quants$NumRead
readscount <- matrix(rep(NumRead, repeat_times)
,nrow = length(NumRead)
,ncol = repeat_times)
simulate_experiment_countmat(fasta = fastapath,
readmat = readscount,
outdir = output_dir)
}
makeReads(
quant_file = "mixed.txt",
fastapath = "mixed.fa",
output_dir = "estimatedReadRaw",
repeat_times = 5
)
sink()
q(save = "no")