-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMake_bed_File.pl
More file actions
39 lines (23 loc) · 1.16 KB
/
Make_bed_File.pl
File metadata and controls
39 lines (23 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#! /usr/bin/perl
use strict;
use warnings;
#First drafted on July 2, 2019 by Dr. Jeff Chen
#Last updated on July 16, 2019 by Dr. Jeff Chen
#This script is to convert 23andme SNP genotype files to *.bed, *.bim, *.fam file formats via plink.
my $dir="/m/CPHG/KING/xc3m/23andme_file"; ## Directory where 23andme txt files are located.
opendir(DIR, $dir) or die $!;
while (my $file = readdir(DIR)) {
# A file test to check that it is a directory
# Use -f to test for a file
#next unless (-d "$dir/$file");
print "$file\n"; ## Get the file to see.
if ($file=~m/23andme/){
print "$file\n"; ## Only pick up 23andme files
system("cp /m/CPHG/KING/xc3m/openSNP/$file /m/CPHG/KING/xc3m/23andme_Run/."); ## Move files to working directory
system("/h4/t1/apps/statgen/bin/plink1.9 --23file $file $file -out $file"); ## Call plink 1.9 version to convert the files to binary fomart
}
#my $stop = <STDIN>; ## For error checking, and code and data QC purpose
}
closedir(DIR);
print "\n****** Completed to Convert All 23andme SNP Genonotype Files to KING and PLINK readable Binary Format *****\n";
exit(0);