28 February 1924

Script A: transfer final report to ped (fr2ped.pl)

use strict;
use Cwd;
chdir getcwd;
open F,shift @ARGV;
my $i=1;
while(<F>){
next if !/ZS/;
my($snp,$sam,$rs,$gc,$chr,$pos,$a1,$a2,undef)=split/\s+/;
if($i eq 1){
print "$sam $sam 0 0 0 0 $a1 $a2";
}else{
print " $a1 $a2";
}
$i++;
}
print "\n";

Script B: transfer final report to ped(fr2map.pl)

use strict;
use Cwd;
chdir getcwd;
open F,shift @ARGV;
while(<F>){
next if !/ZS/;
my($snp,$sam,$rs,$gc,$chr,$pos,$a1,$a2,undef)=split/\s+/;
print "$chr $rs 0 $pos\n";
}

Step 3.0: run the script to do the job

for i in `ls *.txt | rev | cut -c 17- | rev | uniq`
do
echo $i
perl ./fr2ped.pl $i\_FinalReport.txt > $i.ped
done

for i in `ls *.txt | rev | cut -c 17- | rev | uniq`
do
echo $i
perl ./fr2map.pl $i\_FinalReport.txt > $i.map
done

step 4.0: first time to merge

rm all_my_files.txt
for i in `ls *.txt | rev | cut -c 17- | rev | uniq`
do
echo $i >> all_my_files.txt
done
grep -v ZS10 all_my_files.txt > all_files.txt

step 5.0: secome time to merge (you will receive plink-merge.missnp in the above step).remove misssnp in this step

for i in `ls *.txt | rev | cut -c 17- | rev | uniq`
do
plink --file $i --exclude IL4-merge.missnp --make-bed --out $i
done

step 6.0: merge all the binary ped and map files

plink --bfile ZS10 --merge-list allfiles.txt --make-bed --out IL4

step 7.0: extract IL4 regions

plink --bfile IL4 --pheno IL4.phen --mpheno 2 --assoc --allow-no-sex --extract IL.range --range  --adjust


blog comments powered by Disqus