ShatterSeek icon indicating copy to clipboard operation
ShatterSeek copied to clipboard

Error in statistical_criteria

Open chengwenxuan1997 opened this issue 2 years ago • 3 comments

Although I have used the code provided by Readme to merge adjacent regions with the same copy number value, it still reported an error in the function "statistical_criteria" that "error in evaluating the argument 'x' in selecting a method for function 'nrow': wrong sign in 'by' argument" . When cand=7 and chr_inter=21, it reported this error.

This is the sample, Thanks TRCC.zip

chengwenxuan1997 avatar Jun 14 '22 09:06 chengwenxuan1997

Hello, thanks for your comment. Can you please paste here the code you used? Thanks

isidroc avatar Jun 14 '22 20:06 isidroc

The code is as follows:

SV_data <- readRDS("TRCC-1T-mix.SV.rds")  
CN_data <- readRDS("TRCC-1T-mix.CNV.rds")
chromothripsis <- shatterseek(SV.sample = SV_data, seg.sample = CN_data, genome = "hg38")

And the adjacent regions with the same copy number value in CN_data have been merged in advance. The code is as follows:

MergeSegment <- function(cnv){
  dd <- data.frame(chrom = as.character(cnv@chrom),
                   start = cnv@start,
                   end = cnv@end,
                   total_cn = cnv@total_cn)
  
  dd$total_cn[dd$total_cn == 0] <- 150000
  dd$total_cn[is.na(dd$total_cn)] <- 0
  dd <- as(dd,"GRanges")
  cov <- coverage(dd,weight = dd$total_cn)
  dd1 <- as(cov,"GRanges")
  dd1 <- as.data.frame(dd1)
  dd1 <- dd1[dd1$score !=0,]
  dd1 <- dd1[,c(1,2,3,6)]
  names(dd1) <- c("chrom", "start", "end", "total_cn")
  if (sum(dd1$total_cn == 150000) > 0){
    dd1$total_cn[dd1$total_cn == 150000] <- 0
  }

  CN_data <- CNVsegs(chrom = as.character(dd1$chrom),
                     start = as.numeric(dd1$start),
                     end = as.numeric(dd1$end),
                     total_cn = as.numeric(dd1$total_cn))
}
CN_data <- MergeSegment(CN_data)

chengwenxuan1997 avatar Jun 15 '22 02:06 chengwenxuan1997

Could I get any suggestions to help solve this problem? Thanks.

chengwenxuan1997 avatar Jun 20 '22 07:06 chengwenxuan1997