ShixiangWang / DoAbsolute

:package: Automate Absolute Copy Number Calling using 'ABSOLUTE' package
Other
37 stars 11 forks source link

Error message: the condition has length > 1 #21

Closed HengqiLiu closed 2 years ago

HengqiLiu commented 2 years ago

Hi, Mr. Wang

When I ran the example data and my own data on Linux server with R 4.2.0 , the following error occurred, 

Error in DoAbsolute(Seg = Seg, Maf = Maf, platform = "SNP_6.0", copy.num.type = "total", : No result file to proceed.

and the following information is recorded in the log file,
        Detected error in sample TCGA-DK-A1A6-10 
        Error message: the condition has length > 1 
        Skipping this sample.
        ========
        Detected error in sample TCGA-DK-A1A6-06 
        Error message: the condition has length > 1 
        Skipping this sample.
        ========
        Detected error in sample TCGA-DK-A1A6-01 
        Error message: the condition has length > 1 
        Skipping this sample.
        ========
Interestingly, I have DoAbsolute running smoothly on my  macOS  with  R 4.1.0 .

Would like to ask if you have any good suggestions to solve this problem?

Best wishes, Hengqi Liu

ShixiangWang commented 2 years ago

@HengqiLiu Would you mind set verbose = TRUE to see where the error occurs, if it's only occur inside the DoAbsolute instead of ABSOLUTE, there shall be a way to fix it.

HengqiLiu commented 2 years ago

Hi, Mr. Wang

Below is my code to run the example data,

example_path = system.file("extdata", package = "DoAbsolute", mustWork = T)

# segmentation file
seg_normal =  file.path(example_path, "SNP6_blood_normal.seg.txt")
seg_solid  =  file.path(example_path, "SNP6_solid_tumor.seg.txt")
seg_metastatic  = file.path(example_path, "SNP6_metastatic_tumor.seg.txt")
# MAF file
maf_solid  = file.path(example_path, "solid_tumor.maf.txt")
maf_metastatic  = file.path(example_path, "metastatic_tumor.maf.txt")

# read data
seg_normal = fread(seg_normal)
seg_solid = fread(seg_solid)
seg_metastatic = fread(seg_metastatic)
maf_solid = fread(maf_solid)
maf_metastatic = fread(maf_metastatic)

# merge data
Seg = Reduce(rbind, list(seg_normal, seg_solid, seg_metastatic))
Maf = Reduce(rbind, list(maf_solid, maf_metastatic))

Seg$Sample = substr(Seg$Sample, 1, 15)
Maf$Tumor_Sample_Barcode = substr(Maf$Tumor_Sample_Barcode, 1, 15)

# test function
DoAbsolute(Seg = Seg, 
           Maf = Maf, 
           platform = "SNP_6.0", 
           copy.num.type = "total",
           results.dir = "test", 
           nThread = 4, 
           keepAllResult = TRUE, 
           verbose = TRUE,
           temp.dir = "test/tmpdir")

and after running the code it returns the following,

-> Removed previous error log file.
-> Loading segmentation data...
-> Loading Maf data...
-> Checking data format of segmentation file...
-> Keeping only chr 1-23 for CNV data...
-> Keeping only chr 1-23 for Maf data...
-> Creating temp directory ...
-> Spliting seg data of samples to different files...
--> Processing sample  TCGA-DK-A1A6-10 ...
---> This sample has not Maf data, skipping...
--> Processing sample  TCGA-DK-A1A6-01 ...
---> Filtering mutations which vaf< 0.1 ...
---> Filtering Maf which count< 5 ...
---> Outputing corresponding Maf file...
--> Processing sample  TCGA-DK-A1A6-06 ...
---> Filtering mutations which vaf< 0.1 ...
---> Filtering Maf which count< 5 ...
---> Outputing corresponding Maf file...
-> Spliting seg data of samples done.
-> Running RunAbsolute...(be patient)
-> RunAbsolute done. Retrieving results...
-> Checking result files...
Warning in DoAbsolute(Seg = Seg, Maf = Maf, platform = "SNP_6.0", copy.num.type = "total",  :
  --> Result file test/tmpdir/cache/TCGA-DK-A1A6-10.ABSOLUTE.RData does not exist, drop it.
Warning in DoAbsolute(Seg = Seg, Maf = Maf, platform = "SNP_6.0", copy.num.type = "total",  :
  --> Result file test/tmpdir/cache/TCGA-DK-A1A6-01.ABSOLUTE.RData does not exist, drop it.
Warning in DoAbsolute(Seg = Seg, Maf = Maf, platform = "SNP_6.0", copy.num.type = "total",  :
  --> Result file test/tmpdir/cache/TCGA-DK-A1A6-06.ABSOLUTE.RData does not exist, drop it.
Error in DoAbsolute(Seg = Seg, Maf = Maf, platform = "SNP_6.0", copy.num.type = "total",  : 
  No result file to proceed.

Here is my sessionInfo()

R version 4.2.0 (2022-04-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.4 LTS

Matrix products: default
BLAS/LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.8.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] numDeriv_2016.8-1.1   dplyr_1.0.9         data.table_1.14.2   DoAbsolute_2.1.0   

loaded via a namespace (and not attached):
 [1] rstudioapi_0.13   magrittr_2.0.3    hms_1.1.1         rsthemes_0.3.1    tidyselect_1.1.2 
 [6] doParallel_1.0.17 R6_2.5.1          rlang_1.0.3       foreach_1.5.2     fansi_1.0.3      
[11] tools_4.2.0       parallel_4.2.0    utf8_1.2.2        cli_3.3.0         DBI_1.1.3        
[16] iterators_1.0.14  ellipsis_0.3.2    assertthat_0.2.1  tibble_3.1.7      lifecycle_1.0.1  
[21] crayon_1.5.1      purrr_0.3.4       vctrs_0.4.1       codetools_0.2-18  glue_1.6.2       
[26] compiler_4.2.0    pillar_1.7.0      generics_0.1.2    ABSOLUTE_1.0.6    pkgconfig_2.0.3  

Best wishes, Hengqi Liu

ShixiangWang commented 2 years ago

Hi, Mr. Wang

Below is my code to run the example data,

example_path = system.file("extdata", package = "DoAbsolute", mustWork = T)

# segmentation file
seg_normal =  file.path(example_path, "SNP6_blood_normal.seg.txt")
seg_solid  =  file.path(example_path, "SNP6_solid_tumor.seg.txt")
seg_metastatic  = file.path(example_path, "SNP6_metastatic_tumor.seg.txt")
# MAF file
maf_solid  = file.path(example_path, "solid_tumor.maf.txt")
maf_metastatic  = file.path(example_path, "metastatic_tumor.maf.txt")

# read data
seg_normal = fread(seg_normal)
seg_solid = fread(seg_solid)
seg_metastatic = fread(seg_metastatic)
maf_solid = fread(maf_solid)
maf_metastatic = fread(maf_metastatic)

# merge data
Seg = Reduce(rbind, list(seg_normal, seg_solid, seg_metastatic))
Maf = Reduce(rbind, list(maf_solid, maf_metastatic))

Seg$Sample = substr(Seg$Sample, 1, 15)
Maf$Tumor_Sample_Barcode = substr(Maf$Tumor_Sample_Barcode, 1, 15)

# test function
DoAbsolute(Seg = Seg, 
           Maf = Maf, 
           platform = "SNP_6.0", 
           copy.num.type = "total",
           results.dir = "test", 
           nThread = 4, 
           keepAllResult = TRUE, 
           verbose = TRUE,
           temp.dir = "test/tmpdir")

and after running the code it returns the following,

-> Removed previous error log file.
-> Loading segmentation data...
-> Loading Maf data...
-> Checking data format of segmentation file...
-> Keeping only chr 1-23 for CNV data...
-> Keeping only chr 1-23 for Maf data...
-> Creating temp directory ...
-> Spliting seg data of samples to different files...
--> Processing sample  TCGA-DK-A1A6-10 ...
---> This sample has not Maf data, skipping...
--> Processing sample  TCGA-DK-A1A6-01 ...
---> Filtering mutations which vaf< 0.1 ...
---> Filtering Maf which count< 5 ...
---> Outputing corresponding Maf file...
--> Processing sample  TCGA-DK-A1A6-06 ...
---> Filtering mutations which vaf< 0.1 ...
---> Filtering Maf which count< 5 ...
---> Outputing corresponding Maf file...
-> Spliting seg data of samples done.
-> Running RunAbsolute...(be patient)
-> RunAbsolute done. Retrieving results...
-> Checking result files...
Warning in DoAbsolute(Seg = Seg, Maf = Maf, platform = "SNP_6.0", copy.num.type = "total",  :
  --> Result file test/tmpdir/cache/TCGA-DK-A1A6-10.ABSOLUTE.RData does not exist, drop it.
Warning in DoAbsolute(Seg = Seg, Maf = Maf, platform = "SNP_6.0", copy.num.type = "total",  :
  --> Result file test/tmpdir/cache/TCGA-DK-A1A6-01.ABSOLUTE.RData does not exist, drop it.
Warning in DoAbsolute(Seg = Seg, Maf = Maf, platform = "SNP_6.0", copy.num.type = "total",  :
  --> Result file test/tmpdir/cache/TCGA-DK-A1A6-06.ABSOLUTE.RData does not exist, drop it.
Error in DoAbsolute(Seg = Seg, Maf = Maf, platform = "SNP_6.0", copy.num.type = "total",  : 
  No result file to proceed.

Here is my sessionInfo()

R version 4.2.0 (2022-04-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.4 LTS

Matrix products: default
BLAS/LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.8.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] numDeriv_2016.8-1.1   dplyr_1.0.9         data.table_1.14.2   DoAbsolute_2.1.0   

loaded via a namespace (and not attached):
 [1] rstudioapi_0.13   magrittr_2.0.3    hms_1.1.1         rsthemes_0.3.1    tidyselect_1.1.2 
 [6] doParallel_1.0.17 R6_2.5.1          rlang_1.0.3       foreach_1.5.2     fansi_1.0.3      
[11] tools_4.2.0       parallel_4.2.0    utf8_1.2.2        cli_3.3.0         DBI_1.1.3        
[16] iterators_1.0.14  ellipsis_0.3.2    assertthat_0.2.1  tibble_3.1.7      lifecycle_1.0.1  
[21] crayon_1.5.1      purrr_0.3.4       vctrs_0.4.1       codetools_0.2-18  glue_1.6.2       
[26] compiler_4.2.0    pillar_1.7.0      generics_0.1.2    ABSOLUTE_1.0.6    pkgconfig_2.0.3  

Best wishes, Hengqi Liu

Hi, I cannot find message Error message: the condition has length > 1 here.

HengqiLiu commented 2 years ago

Ahh... messageError message: the condition has length > 1 was written to the error.log file, and all the information in the error.log is as follows,

Detected error in sample TCGA-DK-A1A6-01 
Error message: the condition has length > 1 
Skipping this sample.
========
Detected error in sample TCGA-DK-A1A6-10 
Error message: the condition has length > 1 
Skipping this sample.
========
Detected error in sample TCGA-DK-A1A6-06 
Error message: the condition has length > 1 
Skipping this sample.
========
ShixiangWang commented 2 years ago

@HengqiLiu Thanks, I still cannot see where the error occur. I am trying to deploy an R4.2 conda environment and see if I can reproduce this. I will let you know if I can fix it.

HengqiLiu commented 2 years ago

OK, Mr. Wang, thank you very much !!

ShixiangWang commented 2 years ago

I can reproduce this, this is caused by new error rendering introduced by R4.2 (https://stackoverflow.com/questions/72090706/new-error-no-first-element-being-used-when-condition-has-length-1)

I need to see if I can modify the source code of ABSOLUTE.

HengqiLiu commented 2 years ago

I can reproduce this, this is caused by new error rendering introduced by R4.2 (https://stackoverflow.com/questions/72090706/new-error-no-first-element-being-used-when-condition-has-length-1)

I need to see if I can modify the source code of ABSOLUTE.

That will be a great work, thanks a lot, Mr. Wang.

ShixiangWang commented 2 years ago

@HengqiLiu I have included a new version of ABSOLUTE, please try installing it and see how it works? You can also download it from here. Also please install the latest version of DoAbsolute from Github, it will return more message into error.log for debugging.

ABSOLUTE_1.0.6.tar.gz

HengqiLiu commented 2 years ago

@HengqiLiu I have included a new version of ABSOLUTE, please try installing it and see how it works? You can also download it from here. Also please install the latest version of DoAbsolute from Github, it will return more message into error.log for debugging.

ABSOLUTE_1.0.6.tar.gz

DoAbsolute can now run smoothly, thank you for your generous help!!!