popgenDK / SATC

Sex assignment through coverage
17 stars 10 forks source link

Error in scan() #12

Open athenasyarifa opened 1 year ago

athenasyarifa commented 1 year ago

Hi, Thanks for developing this useful tool! I am trying to use SATC both in R and using terminal, which both encountered errors.

1. SATC in R I ran the following lines in R:

   source("https://raw.githubusercontent.com/popgenDK/SATC/main/satcFunc.R")
   library(mclust)
   IDXFILE <- "/dss/dsslegfs01/pr53da/pr53da-dss-0026/projects/2022__Pmon_pop_gen/2__sexing/idx/list_idx"
   filenames <- scan(IDXFILE,what="sUp")
   idx <- lapply(filenames,read.table,as.is=T)
   names(idx) <- basename(filenames)
   rFilt <- filterScaffold(dat=idx,minLength=1e5,M=5)

After running the last line, I received this error message:

Error in order(dat[[1]]$V2, decreasing = T) : argument 1 is not a vector

2. SATC using terminal I run the following command on terminal:

     Rscript --vanilla /dss/dsslegfs01/pr53da/pr53da-dss-0026/projects/2022__Pmon_pop_gen/2__sexing/SATC/satc.R -i list_idx -o SATC_out

And received the following result:

Sex Assignment Trough Coverage (SATC): program to jointly identify sex linked scaffolds and infer individuals sex based on depht of coverage of NGS data.

Loading required package: mclust Package 'mclust' version 6.0.0 Type 'citation("mclust")' for citing this R package in publications. Running SATC with following parameters:

infile: list_idx outprefix: SATC_out K: 2 model: gaussian minLength: 1e+05 M: 5 normScaffolds: useMedian: FALSE

Read 147 items Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec, : line 1 did not have 4 elements Calls: satc -> lapply -> FUN -> scan Execution halted

I checked my idx files and it looks like this:

chr1 117081789 539663 582 chr1A 79529254 363884 466 chr2 156084800 718347 915 chr3 118306176 543479 650 chr4 76168615 344894 399 chr4A 21566085 109478 123 chr5 64446373 295172 321 chr6 37540000 226726 202 chr7 40934707 184190 184 chr8 33523242 152692 155

Is it because of the chromosome names? Can you point me what I did wrong for both cases? Many thanks in advance!

Cheers, Rifa