Results 1 to 7 of 7

Thread: admixtools2 TUTORIAL for WINDOWS.

  1. #1
    researcher
    Apricity Funding Member
    "Friend of Apricity"

    eupator's Avatar
    Join Date
    Jan 2022
    Last Online
    Today @ 08:43 AM
    Meta-Ethnicity
    Eastern Rhomaios
    Ethnicity
    Greek
    Country
    Greece
    Y-DNA
    R-A12332*
    mtDNA
    W6c*
    Taxonomy
    Pontid
    Religion
    ΙϹ ΧϹ ΝΙ ΚΑ
    Relationship Status
    Married parent
    Gender
    Posts
    894
    Thumbs Up
    Received: 712
    Given: 671

    9 Not allowed!

    Default admixtools2 TUTORIAL for WINDOWS.

    Download and install R-Studio for Windows: https://www.rstudio.com/products/rstudio/

    Download and install R-tools 4.2 for Windows: https://cran.r-project.org/bin/windows/Rtools/

    After you complete the installation, run it (R-Studio) and install admixtools2 and dependencies by following the instructions on the INSTALLATION part of this page: https://uqrmaie1.github.io/admixtools/index.html Just copy paste the commands given to your prompt and it'll do the trick.

    Go to the Reich dataset page and download the sample files:

    1240+HO dataset has manier moderns but less SNPs (500K), compared to 1240K. You can find the description of each sample in the .anno files. You can rename the samples (for example I renamed Kotias to CHG, Iran_Ganj_Dareh to Iran_N, etc) in the .ind file for your convenience w/o changing the order/position of each sample, but do not mix together .DG and .SG files to non .DG/.SG ones, the former are shotgun sequences.

    In the command prompt of your R-Studio, you need the following commands (each time you run the program from scratch):

    Code:
    prefix = "C:/Users/eupator/Downloads/eupator_qpAdm_files/HO/v50.0_1240K_public"
    my_f2_dir = "C:/Users/eupator/Downloads/eupator_qpAdm_files/my_f2_dir_eupator"
    library(admixtools)
    library(tidyverse)
    The prefix needs to be the path linking to the .geno file that you are using 1240K/or HO (and the name you've given it, if you have) w/o the .geno extension at the end. Be careful and specific, a lot of people get temp stuck here.
    The my_f2_dir needs to be a directory where the generated f2 stats are going to be stored each time, I named it my_f2_dir_eupator.

    Now you are ready to do some runs, you require

    a) a left list, which will be comprised of your target on top and its components below (4-5).
    b) a right list, which is going to be your source populations (before the split) that the target is going to be compared against, there is an ongoing debate of how the right list should be built, some suggest using a few very distant populations, other insist on using recent source populations, you can use either methods or both (I use a mix). Some people suggest using no more than 15 pops, you can probably use up to 30 according to this.

    Example:

    I want to run the Lazaridis' modern Greek references, as a 3-way component model, in order to check the value of their ancient Greek (IA) part (empuries2), their Slavic part (I will use Polish.DG for this reason) and their West Asian part (I will use Armenian.DG for this reason).

    I renamed all 3 empuries_2 samples (I8215, I8208, I8205) to "Greek_Emporion".

    First, I will set my target and left with the following commands:

    Code:
    target = c('Greek')
    Code:
    left= c('Greek_Emporion','Polish.DG','Armenian.DG')
    And for my right list, I use a modified (with more recents) Lazaridis et al. (2017) right list as a prototype:

    Code:
    right = c('Mbuti.DG', 'Ethiopia_4500BP_published.SG', 'Russia_Ust_Ishim.DG', 'Czech_Vestonice16', 'Belgium_UP_GoyetQ116_1_published', 'Russia_Kostenki14.SG', 'Russia_AfontovaGora3', 'Italy_North_Villabruna_HG', 'Han.DG', 'Papuan.DG',  'Karitiana.DG', 'Georgia_Satsurblia.SG', 'Iran_GanjDareh_N', 'Turkey_Epipaleolithic', 'Morocco_Iberomaurusian', 'Jordan_PPNB', 'Russia_HG_Karelia.SG', 'Russia_Samara_EBA_Yamnaya', 'Czech_Bohemia_CordedWare', 'Armenia_LBA.SG', 'ONG.SG')
    Before I run the model, I need to generate the f2 stats for the total of both my left, right and target.

    Code:
    mypops = c('Mbuti.DG', 'Ethiopia_4500BP_published.SG', 'Russia_Ust_Ishim.DG', 'Czech_Vestonice16', 'Belgium_UP_GoyetQ116_1_published', 'Russia_Kostenki14.SG', 'Russia_AfontovaGora3', 'Italy_North_Villabruna_HG', 'Han.DG', 'Papuan.DG',  'Karitiana.DG', 'Georgia_Satsurblia.SG', 'Iran_GanjDareh_N', 'Turkey_Epipaleolithic', 'Morocco_Iberomaurusian', 'Jordan_PPNB', 'Russia_HG_Karelia.SG', 'Russia_Samara_EBA_Yamnaya', 'Czech_Bohemia_CordedWare', 'Armenia_LBA.SG', 'ONG.SG','Greek','Greek_Emporion','Polish.DG','Armenian.DG')
    extract_f2(prefix, my_f2_dir, pops = mypops, overwrite = TRUE, maxmiss = 1)
    f2_blocks = f2_from_precomp(my_f2_dir, pops = mypops, afprod = TRUE)
    Now I can run the model using the following commands:

    Code:
    results = qpadm(prefix, left, right, target, allsnps = TRUE)
    results$weights
    results$popdrop
    The model is a success. It has a good p-value (above 5%) of 0.0892 and low std. errors (around or below 5%).

    Code:
    > results$weights
    # A tibble: 3  5
      target left           weight     se     z
                      
    1 Greek  Greek_Emporion  0.416 0.0612  6.79
    2 Greek  Polish.DG       0.371 0.0391  9.48
    3 Greek  Armenian.DG     0.213 0.0458  4.66
    > results$popdrop
    # A tibble: 7  14
      pat      wt   dof chisq        p f4rank Greek_Emporion Polish.DG
                              
    1 000       0    18  26.5 8.92e- 2      2          0.416     0.371
    2 001       1    19  48.6 2.07e- 4      1          0.630     0.370
    3 010       1    19  93.0 9.83e-12      1          1.01     NA    
    4 100       1    19  76.6 7.17e- 9      1         NA         0.598
    5 011       2    20  95.8 7.08e-12      0          1        NA    
    6 101       2    20 131.  2.74e-18      0         NA         1    
    7 110       2    20 313.  2.00e-54      0         NA        NA    
    # … with 6 more variables: Armenian.DG , feasible ,
    #   best , dofdiff , chisqdiff , p_nested 

    The Greek reference can be successfully modeled as 41.6% Greek Emporion, 37.1% Polish.DG and 21.3% Armenian.DG.




    That's all for now.


    PS. Shout out to blogger Vasistha for helping me learn admixr on linux and poster Ijustlikehistory for helping me out with the Windows stuff.
    Last edited by eupator; 06-11-2022 at 09:00 AM.

  2. #2
    researcher
    Apricity Funding Member
    "Friend of Apricity"

    eupator's Avatar
    Join Date
    Jan 2022
    Last Online
    Today @ 08:43 AM
    Meta-Ethnicity
    Eastern Rhomaios
    Ethnicity
    Greek
    Country
    Greece
    Y-DNA
    R-A12332*
    mtDNA
    W6c*
    Taxonomy
    Pontid
    Religion
    ΙϹ ΧϹ ΝΙ ΚΑ
    Relationship Status
    Married parent
    Gender
    Posts
    894
    Thumbs Up
    Received: 712
    Given: 671

    3 Not allowed!

    Default

    You can also use the following command to calculate FST distances to a target population.

    Here, I am going to do just that by comparing various moderns to the Israel_Natufian_published samples:

    Code:
    fst(prefix, pop1 = "Israel_Natufian_published", pop2 = c("Egyptian", "Greek", "Lebanese", "Jordanian", "Saudi", "Somali"))
    The results look like this (lower is closer, taking the standard error into account):

    Code:
     A tibble: 6  4
      pop1                      pop2         est      se
                                    
    1 Israel_Natufian_published Egyptian  0.0715 0.00702
    2 Israel_Natufian_published Greek     0.0874 0.00729
    3 Israel_Natufian_published Jordanian 0.0789 0.00720
    4 Israel_Natufian_published Lebanese  0.0735 0.00728
    5 Israel_Natufian_published Saudi     0.0760 0.00755
    6 Israel_Natufian_published Somali    0.109  0.00701
    It's good practice not to mix .DG/.SG samples with non .DG/.SG, because there is inherent bias towards the first, if you absolutely need to do this, you can adjust the command by adding: adjust_pseudohaploid = FALSE, at the end of the command.

  3. #3
    researcher
    Apricity Funding Member
    "Friend of Apricity"

    eupator's Avatar
    Join Date
    Jan 2022
    Last Online
    Today @ 08:43 AM
    Meta-Ethnicity
    Eastern Rhomaios
    Ethnicity
    Greek
    Country
    Greece
    Y-DNA
    R-A12332*
    mtDNA
    W6c*
    Taxonomy
    Pontid
    Religion
    ΙϹ ΧϹ ΝΙ ΚΑ
    Relationship Status
    Married parent
    Gender
    Posts
    894
    Thumbs Up
    Received: 712
    Given: 671

    0 Not allowed!

    Default

    I would like to add that people can use plink files perfectly fine with admixtools2 on R-studio, one of the perks of the 2nd ed.

    .bed would be the equivalent to .geno, .bim to .snp and .fam to .ind.

    The process is exactly the same.

    The only you thing you need is a code viewer like visualcodestudio, which I use, to read and edit the index .fam file.
    Converting/merging your commercial DNA files for use with admixtools2, PM for details.


  4. #4
    researcher
    Apricity Funding Member
    "Friend of Apricity"

    eupator's Avatar
    Join Date
    Jan 2022
    Last Online
    Today @ 08:43 AM
    Meta-Ethnicity
    Eastern Rhomaios
    Ethnicity
    Greek
    Country
    Greece
    Y-DNA
    R-A12332*
    mtDNA
    W6c*
    Taxonomy
    Pontid
    Religion
    ΙϹ ΧϹ ΝΙ ΚΑ
    Relationship Status
    Married parent
    Gender
    Posts
    894
    Thumbs Up
    Received: 712
    Given: 671

    0 Not allowed!

    Default

    I forgot to mention in the OP, that you can produce f4-generated results (instead of f2) by skipping the extraction process into f2blocks entirely.
    Converting/merging your commercial DNA files for use with admixtools2, PM for details.


  5. #5
    Veteran Member vikiingMallorcaSpain's Avatar
    Join Date
    Feb 2021
    Last Online
    Today @ 01:17 PM
    Ethnicity
    Spanish,Italic,Anglo-Saxon,minor East European
    Country
    Spain
    Y-DNA
    R1b
    Religion
    Death Metal
    Gender
    Posts
    2,222
    Thumbs Up
    Received: 2,807
    Given: 3,732

    0 Not allowed!

    Default

    Hi, is there any tutorial for Linux?
    80.0 Reconquista_Northern_Settler
    14.4 Great_Britain_&_Ireland
    5.6 Morisco

  6. #6
    researcher
    Apricity Funding Member
    "Friend of Apricity"

    eupator's Avatar
    Join Date
    Jan 2022
    Last Online
    Today @ 08:43 AM
    Meta-Ethnicity
    Eastern Rhomaios
    Ethnicity
    Greek
    Country
    Greece
    Y-DNA
    R-A12332*
    mtDNA
    W6c*
    Taxonomy
    Pontid
    Religion
    ΙϹ ΧϹ ΝΙ ΚΑ
    Relationship Status
    Married parent
    Gender
    Posts
    894
    Thumbs Up
    Received: 712
    Given: 671

    1 Not allowed!

    Default

    Quote Originally Posted by vikiingMallorcaSpain View Post
    Hi, is there any tutorial for Linux?

    You can run R on linux, the process is the same for admixtools2.
    Converting/merging your commercial DNA files for use with admixtools2, PM for details.


  7. #7
    Colonial Brasiliense Member Jingle Bell's Avatar
    Join Date
    Aug 2022
    Last Online
    Today @ 12:22 PM
    Location
    Inhabitant of Caatinga and Mata Atlantica since ~1500 CE
    Meta-Ethnicity
    Iberian (Al-Andalus/Gallaecia-Lusitania/Suebi-Visigoth Kingdom), West African & Bantu, SE American
    Ethnicity
    Brasileiro: Portugus (Pred Aveiro, Porto & Minho), Nigeriano e Tupi-Macro-J
    Ancestry
    100% Brasileiro: 53% - 47% Medieval Iberian 50% - 44% SSA & Horner 3% - 2% Tupi-J
    Country
    Brazil
    Region
    Minas Gerais
    Y-DNA
    P YDNA: E-L515/ M YDNA: ?
    mtDNA
    P mtDNA: ? / M mtDNA: L2c4
    Taxonomy
    Gracile-Mediterranid + Sudanid & Ethiopid, um pouco Dinarizado
    Politics
    Apolitical
    Hero
    Tongio, McCandless, Luis Alberto Spinetta, Chico Buarque, Erik Satie, Cartola
    Religion
    Idk maybe Nietzsche are changing my mind
    Relationship Status
    Esse no o meu ponto forte XD
    Age
    14
    Gender
    Posts
    3,062
    Thumbs Up
    Received: 2,503
    Given: 2,886

    2 Not allowed!

    Default

    Well, i think im doing it right?

    XD, now im downloading dependecies i think lol


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Tutorial for autosomal calculators
    By Petalpusher in forum Autosomal DNA
    Replies: 19
    Last Post: 09-09-2022, 10:52 AM
  2. Tutorial: How to make 3D PCA in RStudio
    By Lemgrant in forum Autosomal DNA
    Replies: 7
    Last Post: 02-24-2021, 07:20 PM
  3. Replies: 8
    Last Post: 09-29-2018, 03:17 PM
  4. How to be a proper boss:Tutorial
    By Linebacker in forum Off-topic
    Replies: 12
    Last Post: 02-22-2017, 07:06 AM
  5. Tutorial preparing spaghetti...
    By Enflamme in forum The Lounge
    Replies: 0
    Last Post: 01-05-2017, 03:42 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •