Entering edit mode
mawen8898
▴
10
@mawen8898-23390
Last seen 4.4 years ago
Hello, everybody. When I was trying to use simulateSV of RSVsim to simulate the variants on the specific regions (defined by Granges) of chr8 from BSgenome.Hsapiens.UCSC.hg19. I have the error of "No regions on given chromosomes". The following is the code:
library("RSVSim")
library("GenomicFeatures")
library("BSgenome.Hsapiens.UCSC.hg19")
#for extracting 200 values in a random order.
getdel_para <- function(par){
set.seed(2546)
sel <- unlist(floor(runif(200, 1, 800)))
par.list <- c("list", 200)
for(i in 1:200){
sele <- sel[i]
par.list[[i]] <- par[sel[i]]
}
return(par.list)
}
#getting chromosome 8 from genome.
genome <- BSgenome.Hsapiens.UCSC.hg19
gchr8 <- DNAStringSet(genome$chr8)
names(gchr8) = "Chr8"
#the "deletions.csv" is the file that records the deletion positions, size and deletion sequence name.
delfile <- paste("/paedwy/disk1/wma/simulate_CNV/chr_sv_data/fasta_collected/sample_", 1, "/deletions.csv", sep = "")
assign(delfile, rnorm(3)+5)
delget <- read.table(delfile, header = TRUE, sep="\t",stringsAsFactors=FALSE, quote="")
#get the start list and end list for the Granges.
start <- as.integer(getdel_para(delget$Start))
end <- as.integer(getdel_para(delget$End))
size.list <- as.integer(getdel_para(delget$Size))
delname <- getdel_para(delget$Name)
regions.list <- GRanges(IRanges(c(start), c(end)), seqnames=delname)
simSV <- simulateSV(output=NA, genome=gchr8, dels=200, sizeDels=c(as.integer(size.list)), regionsDels=regions.list, bpSeqSize=100)
#error log:
Breakpoints will be distributed uniformly across the genome
Error in simulateSV(genome = gchr8, dels = 200, sizeDels = c(as.integer(size.list)), :
No regions on given chromosomes
#P.S. The following is how does the regions.list look like:
> regions.list
GRanges object with 200 ranges and 0 metadata columns:
seqnames ranges strand
<Rle> <IRanges> <Rle>
[1] deletion349 15777396-15778345 *
[2] deletion533 92473953-92480676 *
[3] deletion420 137584332-137586099 *
[4] deletion512 113994831-113998199 *
[5] deletion658 115948646-115957703 *
... ... ... ...
[196] deletion589 23523243-23534293 *
[197] deletion138 108525154-108525886 *
[198] deletion764 55632323-55658630 *
[199] deletion278 143013155-143013817 *
[200] deletion267 46843862-46844663 *
-------
seqinfo: 172 sequences from an unspecified genome; no seqlengths
Thanks
Dear Kevin,
Thanks for your suggestion. After I changed the "seqnames" to the chromosome name I set, "Chr8", the issue was solved.
Wen