| 1 |
## generate-reads.R -- generate reads with different contamination |
| 2 |
## rates. |
| 3 |
|
| 4 |
source("read-sim.R") |
| 5 |
|
| 6 |
contams <- seq(0, 0.95, 0.05) |
| 7 |
n.reps <- 10 |
| 8 |
|
| 9 |
if (!file.exists("simulated-reads")) |
| 10 |
dir.create("simulated-reads") |
| 11 |
|
| 12 |
for (rate in contams) { |
| 13 |
for (rep in 1:n.reps) { |
| 14 |
dir <- file.path("simulated-reads", rate) |
| 15 |
if (!file.exists(dir)) { |
| 16 |
dir.create(dir) |
| 17 |
} |
| 18 |
message(sprintf("creating file %d for contamination rate %f.\n", rep, rate)) |
| 19 |
outfile <- file.path(dir, sprintf("%02d.fastq", rep)) |
| 20 |
message(outfile) |
| 21 |
ff <- file("reads.fastq", open="r") |
| 22 |
contaminateFASTQEntry(ff, outfile, rate, verbose=FALSE) |
| 23 |
close(ff) |
| 24 |
} |
| 25 |
} |