Quick Way To Combine Two Datasets Using Only Common Markers
Is there a quick way to combine two datasets so that only the common markers are kept? Currently, if I have two datasets, I have to first get the intersection of the two BIM/MAP files, then extract those markers for each dataset, then merge the two.
The merge-mode doesn’t seem to have the option I’m looking for either
• 16k views
Hi I suggest to combine R & Plink this way:
> R code:
> map2 = read.delim("file2.map", header=F, quote="")
> map1 = read.delim("file1.map", header=F, quote="")
> common.snps = which(map2$V2 %in% map1$V2)
> write.table(map2$V2[common.snps], file="list.snps", sep="t", col.names=F, row.names=F, quote=F )
and finally
> the Plink commands:
> plink --bfile <file1> --extract list.snps --make-bed --out data1
> plink --bfile <file2> --extract list.snps --make-bed --out data2
> plink --bfile data1 --bmerge data2.bed data2.bim data2.fam --make-bed --out merge
Why don’t you figure out the common snps between the two datasets using a shell command (awk) or a R one-liner. You can then reduce each of those datasets to the same set of SNPS using the “–extract” option and then merge the datasets. Also, you should check if the two datasets have the same build.
Traffic: 1624 users visited in the last hour
Read more here: Source link