grenaud / glactools

command-line tools for the management of genotype likelihoods and allele counts
http://grenaud.github.io/glactools/
GNU General Public License v3.0
28 stars 2 forks source link

Need more details about program usepopsrootanc #11

Closed congzhouczcz closed 4 years ago

congzhouczcz commented 4 years ago

Hi , The commond line of program 'usepopsrootanc' glactools usepopsrootanc [options] What is the format of file ? the glac file contains root and ancestral samples? Thanks!

congzhouczcz commented 4 years ago

What is the format of file 'pop to use as root' and 'pop to use as anc' ? Thanks very much!

grenaud commented 4 years ago

Hello! Suppose you have a file with the populations you want to use as outgroup and ancestor. In the case of hominin, it would be the chimp as outgroup and the Chimp/human ancestor as the ancestor. For example I would have the following

file1.acf.gz:

#ACF
#PG:union AltaiNean.acf.gz Denisova.acf.gz FrenchB.acf.gz YorubaB.acf.gz AustralianB.acf.gz 
#GITVERSION: 6e48e0efbfb131a6723830fa98f655a36da8c574
#DATE: 2019-12-02
#SQ SN:1    LN:249250621
#SQ SN:2    LN:243199373
#chr    coord   REF,ALT root    anc chimp   ChimpHumanAncestor
2   100022  A,N 0,0:0   0,0:0   1,0:0   1,0:0
2   100023  G,N 0,0:0   0,0:0   1,0:0   1,0:0
2   100024  A,N 0,0:0   0,0:0   1,0:0   1,0:0
2   100025  C,N 0,0:0   0,0:0   1,0:0   1,0:0
2   100026  A,N 0,0:0   0,0:0   1,0:0   1,0:0
2   100027  G,N 0,0:0   0,0:0   1,0:0   1,0:0
2   100028  A,N 0,0:0   0,0:0   1,0:0   1,0:0
2   100029  A,N 0,0:0   0,0:0   1,0:0   1,0:0
2   100030  C,N 0,0:0   0,0:0   1,0:0   1,0:0
2   100031  T,N 0,0:0   0,0:0   1,0:0   1,0:0
2   100032  T,N 0,0:0   0,0:0   1,0:0   1,0:0
2   100033  C,N 0,0:0   0,0:0   1,0:0   1,0:0
2   100034  A,N 0,0:0   0,0:0   1,0:0   1,0:0
2   100035  T,N 0,0:0   0,0:0   1,0:0   1,0:0
2   100036  T,N 0,0:0   0,0:0   1,0:0   1,0:0
2   100037  G,N 0,0:0   0,0:0   1,0:0   1,0:0

And I would have a second file without root and ancestral information:

file2.acf.gz:

#ACF
#PG:union AltaiNean.acf.gz Denisova.acf.gz FrenchB.acf.gz YorubaB.acf.gz AustralianB.acf.gz 
#GITVERSION: 6e48e0efbfb131a6723830fa98f655a36da8c574
#DATE: 2019-12-02
#SQ SN:1    LN:249250621
#SQ SN:2    LN:243199373
#chr    coord   REF,ALT root    anc AltaiNean   Denisova    FrenchB YorubaB AustralianB
2   100022  A,N 0,0:0   0,0:0   2,0:0   2,0:0   2,0:0   2,0:0   2,0:0
2   100023  G,N 0,0:0   0,0:0   2,0:0   2,0:0   2,0:0   2,0:0   2,0:0
2   100024  A,N 0,0:0   0,0:0   2,0:0   2,0:0   2,0:0   2,0:0   2,0:0
2   100025  C,N 0,0:0   0,0:0   2,0:0   2,0:0   2,0:0   2,0:0   2,0:0
2   100026  A,N 0,0:0   0,0:0   2,0:0   2,0:0   2,0:0   2,0:0   2,0:0
2   100027  G,N 0,0:0   0,0:0   2,0:0   2,0:0   2,0:0   2,0:0   2,0:0
2   100028  A,N 0,0:0   0,0:0   2,0:0   2,0:0   2,0:0   2,0:0   2,0:0
2   100029  A,N 0,0:0   0,0:0   2,0:0   2,0:0   2,0:0   2,0:0   2,0:0
2   100030  C,N 0,0:0   0,0:0   2,0:0   2,0:0   2,0:0   2,0:0   2,0:0
2   100031  T,N 0,0:0   0,0:0   2,0:0   2,0:0   2,0:0   2,0:0   2,0:0
2   100032  T,N 0,0:0   0,0:0   2,0:0   2,0:0   2,0:0   2,0:0   2,0:0
2   100033  C,N 0,0:0   0,0:0   2,0:0   2,0:0   2,0:0   2,0:0   2,0:0
2   100034  A,N 0,0:0   0,0:0   2,0:0   2,0:0   2,0:0   2,0:0   2,0:0
2   100035  T,N 0,0:0   0,0:0   2,0:0   2,0:0   2,0:0   2,0:0   2,0:0
2   100036  T,N 0,0:0   0,0:0   2,0:0   2,0:0   2,0:0   2,0:0   2,0:0
2   100037  G,N 0,0:0   0,0:0   2,0:0   2,0:0   2,0:0   2,0:0   2,0:0

First we will go into file1 and it take our two populations as our root and ancestor and put it into file3.acf.gz:

glactools usepopsrootanc file1.acf.gz chimp ChimpHumanAncestor > file3.acf.gz

file3.acf.gz will look like this:

#ACF
#PG:usepopsrootanc /tmp/temp.acf.gz chimp ChimpHumanAncestor 
#GITVERSION: 9d3e4107ea445a16737fb841e2181dabf31acac9
#DATE: 2020-04-02
#USEPOPASROOTANC: chimp chimp
#USEPOPASROOTANC#1
#   #ACF
#   #PG:union AltaiNean.acf.gz Denisova.acf.gz FrenchB.acf.gz YorubaB.acf.gz AustralianB.acf.gz 
#   #GITVERSION: 6e48e0efbfb131a6723830fa98f655a36da8c574
#   #DATE: 2019-12-02
#   #chr    coord   REF,ALT root    anc chimp   ChimpHumanAncestor
#SQ SN:1    LN:249250621
#SQ SN:2    LN:243199373
#chr    coord   REF,ALT root    anc
2   100022  A,N 1,0:0   1,0:0
2   100023  G,N 1,0:0   1,0:0
2   100024  A,N 1,0:0   1,0:0
2   100025  C,N 1,0:0   1,0:0
2   100026  A,N 1,0:0   1,0:0
2   100027  G,N 1,0:0   1,0:0
2   100028  A,N 1,0:0   1,0:0
2   100029  A,N 1,0:0   1,0:0
2   100030  C,N 1,0:0   1,0:0
2   100031  T,N 1,0:0   1,0:0
2   100032  T,N 1,0:0   1,0:0
2   100033  C,N 1,0:0   1,0:0
2   100034  A,N 1,0:0   1,0:0
2   100035  T,N 1,0:0   1,0:0
2   100036  T,N 1,0:0   1,0:0
2   100037  G,N 1,0:0   1,0:0

Then you can use "replaceanc" to put the ancestral information into file2:

glactools replaceanc file2.acf.gz file3.acf.gz > file4.acf.gz

file4 should contain the same information as file to accept with the ancestral information of file1:

#ACF
#PG:replaceanc /tmp/temp2.acf.gz /tmp/file3.acf.gz 
#GITVERSION: 9d3e4107ea445a16737fb841e2181dabf31acac9
#DATE: 2020-04-02
#REPLACEANC:
#REPLACEANC#1
#   #ACF
#   #PG:union AltaiNean.acf.gz Denisova.acf.gz FrenchB.acf.gz YorubaB.acf.gz AustralianB.acf.gz 
#   #GITVERSION: 6e48e0efbfb131a6723830fa98f655a36da8c574
#   #DATE: 2019-12-02
#   #chr    coord   REF,ALT root    anc AltaiNean   Denisova    FrenchB YorubaB AustralianB
#REPLACEANC#2
#   #ACF
#   #PG:usepopsrootanc /tmp/temp.acf.gz chimp ChimpHumanAncestor 
#   #GITVERSION: 9d3e4107ea445a16737fb841e2181dabf31acac9
#   #DATE: 2020-04-02
#   #USEPOPASROOTANC: chimp chimp
#   #USEPOPASROOTANC#1
#   #   #ACF
#   #   #PG:union AltaiNean.acf.gz Denisova.acf.gz FrenchB.acf.gz YorubaB.acf.gz AustralianB.acf.gz 
#   #   #GITVERSION: 6e48e0efbfb131a6723830fa98f655a36da8c574
#   #   #DATE: 2019-12-02
#   #   #chr    coord   REF,ALT root    anc chimp   ChimpHumanAncestor
#   #chr    coord   REF,ALT root    anc
#SQ SN:1    LN:249250621
#SQ SN:2    LN:243199373
#chr    coord   REF,ALT root    anc AltaiNean   Denisova    FrenchB YorubaB AustralianB
2   100022  A,N 1,0:0   1,0:0   2,0:0   2,0:0   2,0:0   2,0:0   2,0:0
2   100023  G,N 1,0:0   1,0:0   2,0:0   2,0:0   2,0:0   2,0:0   2,0:0
2   100024  A,N 1,0:0   1,0:0   2,0:0   2,0:0   2,0:0   2,0:0   2,0:0
2   100025  C,N 1,0:0   1,0:0   2,0:0   2,0:0   2,0:0   2,0:0   2,0:0
2   100026  A,N 1,0:0   1,0:0   2,0:0   2,0:0   2,0:0   2,0:0   2,0:0
2   100027  G,N 1,0:0   1,0:0   2,0:0   2,0:0   2,0:0   2,0:0   2,0:0
2   100028  A,N 1,0:0   1,0:0   2,0:0   2,0:0   2,0:0   2,0:0   2,0:0
2   100029  A,N 1,0:0   1,0:0   2,0:0   2,0:0   2,0:0   2,0:0   2,0:0
2   100030  C,N 1,0:0   1,0:0   2,0:0   2,0:0   2,0:0   2,0:0   2,0:0
2   100031  T,N 1,0:0   1,0:0   2,0:0   2,0:0   2,0:0   2,0:0   2,0:0
2   100032  T,N 1,0:0   1,0:0   2,0:0   2,0:0   2,0:0   2,0:0   2,0:0
2   100033  C,N 1,0:0   1,0:0   2,0:0   2,0:0   2,0:0   2,0:0   2,0:0
2   100034  A,N 1,0:0   1,0:0   2,0:0   2,0:0   2,0:0   2,0:0   2,0:0
2   100035  T,N 1,0:0   1,0:0   2,0:0   2,0:0   2,0:0   2,0:0   2,0:0
2   100036  T,N 1,0:0   1,0:0   2,0:0   2,0:0   2,0:0   2,0:0   2,0:0
2   100037  G,N 1,0:0   1,0:0   2,0:0   2,0:0   2,0:0   2,0:0   2,0:0

In this case I have created two superfluous files, depending on your level of comfort with Unix file descriptors, you can do the same process without creating intermediate files.

Hope this answers your questions, should I add this to the readme? let me know if I can close this issue.

grenaud commented 4 years ago

Is this fine? Can I close the issue?

congzhouczcz commented 4 years ago

Thank you very much, grenaud. I get it and now it works. Thanks!