Code Monkey home page Code Monkey logo

Comments (4)

congzhouczcz avatar congzhouczcz commented on July 24, 2024

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

from glactools.

grenaud avatar grenaud commented on July 24, 2024

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.

from glactools.

grenaud avatar grenaud commented on July 24, 2024

Is this fine? Can I close the issue?

from glactools.

congzhouczcz avatar congzhouczcz commented on July 24, 2024

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

from glactools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.