Created
March 24, 2017 18:23
-
-
Save nievergeltlab/7d6e6a71260d5c1e088e269d08da5c09 to your computer and use it in GitHub Desktop.
Algorithm: Find which file the SNP is in, then zgrep the SNP out. This script will output a .dosage file for each snp in the list. to combine them into a file, it's of course just a matter of using "cat"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires a list of SNPs written into snplist.txt | |
dosage_directory=write_path_to_dosage_files_here | |
for snp in $(cat snplist.txt) | |
do | |
filename=$(grep -w -m1 -l $snp "$dosage_directory"/*.map | sed 's/.map/.gz/g' ) | |
zgrep -w -m1 $snp $filename > "$snp".dosage | |
done | |
#Note: if you want a header for these data, just take the top line from the dosage file, e.g. | |
zcat dos_pts_psy4_mix_am-qc.hg19.ch.fl.chr1_027_030.out.dosage.gz | head -n1 > dosages.header |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment