uqrmaie1 / admixtools

https://uqrmaie1.github.io/admixtools
74 stars 14 forks source link

Issue with extract_f2 #73

Open jaurbanChicago opened 4 months ago

jaurbanChicago commented 4 months ago

Hi Robert,

I've been running into this issue and I have no idea what might be causing it! I have run this command multiple times before and it's the first time I'm seeing it!

Any help would be really appreciated!

> extract_f2("./subset",pops=c("Mbuti.DG","Russia_MA1_HG.SG","China_Tianyuan","Russia_DevilsCave_N.SG","Ami.DG","China_Upper_YR_LN","Nepal_Mustang_Suila_LateC","Mixe.DG"), outdir = "./test_qpgraph",overwrite=TRUE, qpfstats =TRUE
)
i Reading metadata...
i Computing block lengths for 1067189 SNPs...
i Computing 406 f4-statistics for block 553 out of 553...
i Constructing matrix...
i Running regression...
NULL
Warning messages:
1: In extract_f2("./subset", pops = c("Mbuti.DG", "Russia_MA1_HG.SG",  :
  Most `extract_f2` options will be ignored when using the `qpfstats` option!
2: In is.character(pop1) && file.exists(pop1) :
  'length(x) = 8 > 1' in coercion to 'logical(1)'
3: In is.character(pop1) && file.exists(pop1) :
  'length(x) = 8 > 1' in coercion to 'logical(1)'
4: Specifying the `id_cols` argument by position was deprecated in tidyr 1.3.0.
i Please explicitly name `id_cols`, like `id_cols = 1:4`.
i The deprecated feature was likely used in the admixtools package.
  Please report the issue at <https://github.com/uqrmaie1/admixtools/issues>.
This warning is displayed once every 8 hours.
Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated. 

Best,

Toño

jaurbanChicago commented 4 months ago
> extract_f2("./SriLanka_ALG_1240Kpanel_overlappos_posImputemissing10p.norm.onlybiallelicsnps.removedup.fixREF.fixHead",pops = c("Mbuti.DG","Lodha","Rajput","Sinhalese","InteriorAdivasi","CoastalAdivasi","STU_KGP_35"),outdir = "./test",overwrite=TRUE)
i Reading allele frequencies from EIGENSTRAT files...
i SriLanka_ALG_1240Kpanel_overlappos_posImputemissing10p.norm.onlybiallelicsnps.removedup.fixREF.fixHead.geno has 17758 samples and 1105618 SNPs
i Calculating allele frequencies from 124 samples in 7 populations
! 1068732 SNPs remain after filtering. 1000687 are polymorphic.
i Allele frequency matrix for 1068732 SNPs and 7 populations is 137 MB
i Computing pairwise f2 for all SNPs and population pairs requires 1915 MB RAM without splitting
i Computing without splitting since 1915 < 8000 (maxmem)...
i Data written to /ess/scratch/scratch1/jaurban/SL_manuscript/qpAdm/test/
Warning messages:
1: In get_block_lengths(afdat$snpfile[sp, ], blgsize = blgsize) :
  No genetic linkage map found! Defining blocks by base pair distance of 2e+06
2: In get_block_lengths(afdat$snpfile[sn, ], blgsize = blgsize) :
  No genetic linkage map found! Defining blocks by base pair distance of 2e+06
> extract_f2("./SriLanka_ALG_1240Kpanel_overlappos_posImputemissing10p.norm.onlybiallelicsnps.removedup.fixREF.fixHead",pops = c("Mbuti.DG","Lodha","Rajput","Sinhalese","InteriorAdivasi","CoastalAdivasi","STU_KGP_35"),outdir = "./test",overwrite=TRUE,qpfstats=TRUE)
i Reading metadata...
i Computing block lengths for 1105618 SNPs...
i Computing 231 f4-statistics for block 1352 out of 1352...
i Constructing matrix...
i Running regression...
NULL
Warning messages:
1: In extract_f2("./SriLanka_ALG_1240Kpanel_overlappos_posImputemissing10p.norm.onlybiallelicsnps.removedup.fixREF.fixHead",  :
  Most `extract_f2` options will be ignored when using the `qpfstats` option!
2: In is.character(pop1) && file.exists(pop1) :
  'length(x) = 7 > 1' in coercion to 'logical(1)'
3: In is.character(pop1) && file.exists(pop1) :
  'length(x) = 7 > 1' in coercion to 'logical(1)'
4: In get_block_lengths(snpfile %>% filter(keep), blgsize = blgsize) :
  No genetic linkage map found! Defining blocks by base pair distance of 2e+06
> 

This seems to be related to qpfstats

uqrmaie1 commented 4 months ago

The warning Most `extract_f2` options will be ignored when using the `qpfstats` option! is just there in case you pass arguments to extract_f2() that will be ignored in the presence of qpfstats = TRUE. The named arguments that you provide (pops, outdir, overwrite) are not ignored. I should probably change this so that the warning is only generated when arguments are actually being ignored.

I can't reproduce the warning 'length(x) = 8 > 1' in coercion to 'logical(1)'. I think that was a bug in an older version, and should be fixed in the latest version. The same is true for Specifying the warningid_colsargument by position was deprecated in tidyr 1.3.0. Please let me know if you still get these warnings using the latest version!

The warning No genetic linkage map found! Defining blocks by base pair distance of 2e+06 is there to let you know that the centimorgan column in the .bim/.snp file is missing information, and that jackknife blocks are instead based on genomic positions