This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Use plink to extract data using common SNPs and merge this into one file

I am using Plink 1.9 to merge two data sets, I have found out the common SNPs among them and now how do I separate out overlapping sample data, common in both the data set from any one of them?

snp sequencing

Thank you, I should have read it earlier. Sorry for the inconvenience.

You can still edit your post and change the title to something more appropriate.

EDIT: I see you've changed the title, but it's not concise yet. I'll make a suggestion: "Use plink to extract data using common SNPs and merge this into one file"

1 answer

If you literally have the list of common SNPs in a text file, then you can do the following (assumes that the SNPs are listed in SNPsForFiltering.list) :

plink --noweb --bfile DataSetA --extract SNPsForFiltering.list --make-bed --out DataSetA.Common ;
plink --noweb --bfile DataSetB --extract SNPsForFiltering.list --make-bed --out DataSetB.Common ;

You can then attempt to merge these together if you have a merge file that lists the datasets to be merged:

cat ForMerge.list
DataSetA.Common
DataSetB.Common


plink --merge-list ForMerge.list --out AB.Merge ;

Thank you very much for your kind answer. I have the common SNP file in .bim format. Maybe I have to figure out how to make text file from it containing the SNPs.

You should be able to just output and transpose that, and then you will have your SNP listing. How did you create it? Perhaps, you can re-create it but not specify binary format (BIM is similar to plain-text MAP format).

Thank you Sir! I have generated a SNP list text file from my previous common SNP file in bim format using awk. Using which I have hopefully separated out the unique individual samples from overlapping ngs data.

No problem kind Sir. Everything is okay now, in that case?

Yes Sir, it is okay now. I am an undergrad student, no need to address me as Sir. Thank you for your kind suggestion.

An undergrad student is the future of our society and the future of research. In that sense, you deserve more respect than Senior Professors.

I am humbled by your words, your encouragement means a lot to me. I'm quite excited about the future but equally confused and worried, whether I will really get to work in my areas of interests or not which is human evolutionary and population genetics, and also archaeogenetics. I am grateful to you for your kind guidance.

All I can say is to continue to work hard and then you will achieve your dreams over the course of time. You will face road blocks along the way, but do not give up hope.

Thank you Sir for your kind words, I'll surely work hard.

Log in to answer this question.