Admixtools 2
#31
(07-22-2024, 02:20 AM)AimSmall Wrote:
(07-22-2024, 02:15 AM)TanTin Wrote: There is a newer version of Admixtools 2  where a small fix has been applied so now this issue should be fixed.
To update your Admixtools2 try:  install_github()  or devtools::install_github("uqrmaie1/admixtools")  depending how it is installed on your system.
With this update Admixtools 2 should be running smootly with plink files  without any issues.
The new version that I have after the update is version 2.0.5.

changed permutation p-value correction in compare_fits
https://github.com/uqrmaie1/admixtools/c...c7d250d9dc

placed rightfix before right in qpadm_rotate
https://github.com/uqrmaie1/admixtools/c...a8c516124b

Think this is the fix for the plink reads... v2.0.3
Added checks for unused arguments in functions with ...
https://github.com/uqrmaie1/admixtools/c...01109e61a1
Reply
#32
The only constant is change....

Admixtools2 is now at 2.0.6


.jpg   admix_206.JPG (Size: 7.76 KB / Downloads: 189)

prevent integer overflow in cpp_readplink.cpp
master
v2.0.6
@uqrmaie1
uqrmaie1 committed 3 days ago
Reply
#33
admixtools 2 is trash and gives false results i advice any user to use the original admixtools
Reply
#34
(07-25-2024, 06:44 PM)masta Wrote: admixtools 2 is trash and gives false results i advice any user to use the original admixtools

Could you provide examples for such false results?
With the last update we are expecting to get the same results. I am not a user of admixtools ver.1. so I can't do such test.
Reply
#35
(07-27-2024, 01:13 AM)TanTin Wrote:
(07-25-2024, 06:44 PM)masta Wrote: admixtools 2 is trash and gives false results i advice any user to use the original admixtools

Could you provide examples for such false results?
With the last update we are expecting to get the same results. I am not a user of admixtools ver.1. so I can't do such test.


When i first tested it 3 years go , it was very bad and gave wrong admixture proportions  , it has improved now  for this
but its p-value is always wrong it gives constant high p-value.
Reply
#36
(07-24-2024, 11:46 PM)AimSmall Wrote: The only constant is change....

Admixtools2 is now at 2.0.6



prevent integer overflow in cpp_readplink.cpp
master
v2.0.6
@uqrmaie1
uqrmaie1 committed 3 days ago

How do we update to the latest version or know what version we are on
Reply
#37
> packageVersion("admixtools")
[1] ‘2.0.6’

Might have to load it first, not sure.
library(admixtools)


As far as updating, follow install instructions here.

https://github.com/uqrmaie1/admixtools
Reply
#38
Is there any way to display fitted F4 statistics, or 'gendstats' (to use Admixtools1 terminology) when running qpadm in admixtools2?
If a model fails you look to the gendstats to see where/why. Surely that has to be accessable somewhere in admixtools2 yes?
Reply
#39
(10-12-2024, 05:28 PM)Kale Wrote: Is there any way to display fitted F4 statistics, or 'gendstats' (to use Admixtools1 terminology) when running qpadm in admixtools2?
If a model fails you look to the gendstats to see where/why. Surely that has to be accessable somewhere in admixtools2 yes?

No their is not a way to do that directly you can go and do it in a roundabout way 

from admix.tools import qpadm, f4


from admix.tools import qpadm, f4


test = ['PopulationA']
sources = ['Source1', 'Source2']
outgroups = ['Outgroup1', 'Outgroup2', 'Outgroup3']

Step 1: Perform whatever analysis you want to don
qpadm_result = qpadm(test, sources, outgroups)

Step 2: you are then gonna get your observed f4 statistics from your dataset
f4_result = f4(pop_data, populations=[test, sources, outgroups])


observed_f4 = f4_result.f4_statistics

Step 3: you are gonna extract the fitted proportions 
fitted_proportions = qpadm_result.fitted_proportions

Step 4: Compute is the f4 statistics 
# Assuming linearity: F4(fitted) = sum(admixture_proportion_i * F4(observed))
fitted_f4 = sum(p * f4 for p, f4 in zip(fitted_proportions, observed_f4))

 Step 5: Compare observed-fitted 
residuals = observed_f4 - fitted_f4

Output the residuals and fitted statistics
print(f"Fitted F4 statistics: {fitted_f4}")
print(f"Residuals: {residuals}")
Reply
#40
Sorry to trouble you, but I'm pretty much code illiterate.
I've gotten this far, substituting in a sample set of pops and the directory of my dataset.

left = c('Natufian', 'Mesopotamia_PPN', 'Morocco_KTG005_EN.SG')
right = c('Congo_Mbuti.DG', 'ZlatyKun.SG', 'Anatolia_Barcin_N.SG', 'Anatolia_Boncuklu_N.SG', 'Iran_Wezmeh_N.SG', 'Iran_TepeAbdulHosein_N.SG', 'CHG.SG', 'Morocco_OUB002_Epipaleolithic.SG', 'Italy_GrottaContinenza_HG.SG', 'RUS_Arkhangelsk_HG.SG', 'Botai.SG', 'Andaman_100BP.SG', 'RUS_Primorsky_DevilsCave_N.SG', 'Peru_RioUncallane_1800BP.SG')
target = 'Morocco_SKH001_MN.SG'
data = "C:/Users/User/Desktop/Dataset/Kale52h"
qpadm_result = qpadm(data, left, right, target, allsnps=TRUE)
f4_result = qpdstat(data,
pop1 = target,
pop2 = left,
pop3 = c('Congo_Mbuti.DG'),
pop4 = right,
f4mode = TRUE
)
___________________________________________________
None of these things are recognizing as ojbects/variables though?

observed_f4 = f4_result
fitted_proportions = qpadm_result.fitted_proportions
fitted_f4 = sum(p * f4 for p, f4 in zip(fitted_proportions, observed_f4))
residuals = observed_f4 - fitted_f4
print(f"Fitted F4 statistics: {fitted_f4}")
print(f"Residuals: {residuals}")
___________________________

One major hurdle I see though is that qpadm computes the F4 statistics, but doesn't show the results, just the snp count.
EDIT: Actually nvm, the newer version does allow that, with return_f4 = TRUE
EDIT: nvm, those are the actual f4, not the fitted...
Reply
#41
(10-14-2024, 02:50 PM)Kale Wrote: Sorry to trouble you, but I'm pretty much code illiterate.
I've gotten this far, substituting in a sample set of pops and the directory of my dataset.

left = c('Natufian', 'Mesopotamia_PPN', 'Morocco_KTG005_EN.SG')
right = c('Congo_Mbuti.DG', 'ZlatyKun.SG', 'Anatolia_Barcin_N.SG', 'Anatolia_Boncuklu_N.SG', 'Iran_Wezmeh_N.SG', 'Iran_TepeAbdulHosein_N.SG', 'CHG.SG', 'Morocco_OUB002_Epipaleolithic.SG', 'Italy_GrottaContinenza_HG.SG', 'RUS_Arkhangelsk_HG.SG', 'Botai.SG', 'Andaman_100BP.SG', 'RUS_Primorsky_DevilsCave_N.SG', 'Peru_RioUncallane_1800BP.SG')
target = 'Morocco_SKH001_MN.SG'
data = "C:/Users/User/Desktop/Dataset/Kale52h"
qpadm_result = qpadm(data, left, right, target, allsnps=TRUE)
f4_result = qpdstat(data,
pop1 = target,
pop2 = left,
pop3 = c('Congo_Mbuti.DG'),
pop4 = right,
f4mode = TRUE
)
___________________________________________________
None of these things are recognizing as ojbects/variables though?

observed_f4 = f4_result
fitted_proportions = qpadm_result.fitted_proportions
fitted_f4 = sum(p * f4 for p, f4 in zip(fitted_proportions, observed_f4))
residuals = observed_f4 - fitted_f4
print(f"Fitted F4 statistics: {fitted_f4}")
print(f"Residuals: {residuals}")
___________________________

One major hurdle I see though is that qpadm computes the F4 statistics, but doesn't show the results, just the snp count.
EDIT: Actually nvm, the newer version does allow that, with return_f4 = TRUE
EDIT: nvm, those are the actual f4, not the fitted...

When I  get home I’ll edit it, actually I’m almost on my break I’ll have a Quick Look
Reply
#42
(10-12-2024, 05:28 PM)Kale Wrote: Is there any way to display fitted F4 statistics, or 'gendstats' (to use Admixtools1 terminology) when running qpadm in admixtools2?
If a model fails you look to the gendstats to see where/why. Surely that has to be accessable somewhere in admixtools2 yes?

Do you have qpf4ratio?
Reply
#43
Yes, never tried it though.
Reply
#44
(10-14-2024, 03:02 PM)Genetics189291 Wrote:
(10-14-2024, 02:50 PM)Kale Wrote: Sorry to trouble you, but I'm pretty much code illiterate.
I've gotten this far, substituting in a sample set of pops and the directory of my dataset.

left = c('Natufian', 'Mesopotamia_PPN', 'Morocco_KTG005_EN.SG')
right = c('Congo_Mbuti.DG', 'ZlatyKun.SG', 'Anatolia_Barcin_N.SG', 'Anatolia_Boncuklu_N.SG', 'Iran_Wezmeh_N.SG', 'Iran_TepeAbdulHosein_N.SG', 'CHG.SG', 'Morocco_OUB002_Epipaleolithic.SG', 'Italy_GrottaContinenza_HG.SG', 'RUS_Arkhangelsk_HG.SG', 'Botai.SG', 'Andaman_100BP.SG', 'RUS_Primorsky_DevilsCave_N.SG', 'Peru_RioUncallane_1800BP.SG')
target = 'Morocco_SKH001_MN.SG'
data = "C:/Users/User/Desktop/Dataset/Kale52h"
qpadm_result = qpadm(data, left, right, target, allsnps=TRUE)
f4_result = qpdstat(data,
pop1 = target,
pop2 = left,
pop3 = c('Congo_Mbuti.DG'),
pop4 = right,
f4mode = TRUE
)
___________________________________________________
None of these things are recognizing as ojbects/variables though?

observed_f4 = f4_result
fitted_proportions = qpadm_result.fitted_proportions
fitted_f4 = sum(p * f4 for p, f4 in zip(fitted_proportions, observed_f4))
residuals = observed_f4 - fitted_f4
print(f"Fitted F4 statistics: {fitted_f4}")
print(f"Residuals: {residuals}")
___________________________

One major hurdle I see though is that qpadm computes the F4 statistics, but doesn't show the results, just the snp count.
EDIT: Actually nvm, the newer version does allow that, with return_f4 = TRUE
EDIT: nvm, those are the actual f4, not the fitted...

When I  get home I’ll edit it, actually I’m almost on my break I’ll have a Quick Look


f4_result <- f4(
  pop1 = "TargetPop",
  pop2 = "SourcePop1",
  pop3 = "Outgroup1",
  pop4 = "Outgroup2",
  geno_prefix = genotype_file
)

print(f4_result)
Reply
#45
AT2 qpf4ratio is garbage
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)