ShixiangWang / sigminer

🌲 An easy-to-use and scalable toolkit for genomic alteration signature (a.k.a. mutational signature) analysis and visualization in R https://shixiangwang.github.io/sigminer/reference/index.html
https://shixiangwang.github.io/sigminer/
Other
147 stars 19 forks source link

所有SV的大小都被归类为<1kb了 #468

Closed 9421g closed 2 days ago

9421g commented 2 days ago

王诗翔老师您好,我遇到了一个bug,我的所有SV的大小都被归类为<1kb了。 我定位bug到get_sv.R中的getRearrSize函数,这个函数确实会出现这样的问题。 我把您的代码中的一段拿出来单独运行:

> tb0 <- tb0 %>%
  dplyr::mutate(
    length = tb0$end2 - tb0$start1,
    rearrsize = dplyr::case_when(
      .data$svclass == "translocation" ~ NA_character_,
      .data$length < 1000 ~ "<1Kb",
      .data$length >= 1000 & .data$length < 10000 ~ "1-10Kb",
      .data$length >= 10000 & .data$length < 100000 ~ "10-100Kb",
      .data$length >= 100000 & .data$length < 1000000 ~ "100Kb-1Mb",
      .data$length >= 1000000 & .data$length <= 10000000 ~ "1Mb-10Mb",
      .data$length > 10000000 ~ ">10Mb"
    )
  )

sum((tb0$svclass != "translocation") & (tb0$length > 1000 | tb0$length < -1000))
sum(tb0$rearrsize %in% c("1-10Kb", "10-100Kb", "100Kb-1Mb", "1Mb-10Mb", ">10Mb"))
[1] 9108
[1] 0
> 

显然这个逻辑判断似乎有问题。

9421g commented 2 days ago

ok抱歉,我明白了

> sum((tb0$svclass != "translocation") & (tb0$length > 1000))
[1] 0
> sum((tb0$svclass != "translocation") & (tb0$length < -1000))
[1] 9108
> 

似乎要进行交换,保证end2 > start1

ShixiangWang commented 2 days ago

great to hear that