-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allowing pgen file format to be used to get chrx to work in regenie
- Loading branch information
1 parent
6ae67ff
commit 1fefdbb
Showing
4 changed files
with
124 additions
and
11 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/bash | ||
|
||
# strict stop if there are any errors | ||
set -e | ||
|
||
# get environmental variables | ||
source config.env | ||
|
||
# create results directory | ||
mkdir -p ${results_dir}/04 | ||
|
||
# log everything from this script to a logfile in the results director | ||
exec &> >(tee ${results_dir}/04/logfile_aggregate) | ||
|
||
nchr=$(cat ${genotype_input_list} | grep -c '^') | ||
echo $nchr | ||
|
||
Rscript ${results_dir}/04 $nchr ${phenotype_processed_dir}/phenolist | ||
|
||
|
||
|
||
nphen=$(cat ${phenotype_processed_dir}/phenolist | grep -c '^') | ||
|
||
cat ${phenotype_processed_dir}/phenolist | xargs basename | ||
|
||
phenotype_processed_dir="/local-scratch/projects/Lifecourse-GWAS/gib/alspac/phen_proc2" | ||
echo $phenotype_processed_dir | ||
|
||
gwas=${phenotype_processed_dir}/$(cat ${phenotype_processed_dir}/phenolist | head -n 10 | tail -n 1) | ||
echo $gwas | ||
for gwas in $(cat ${phenotype_processed_dir}/phenolist) | ||
do | ||
bn=$(basename $gwas | sed "s/.phen$//g") | ||
echo $bn | ||
out=${results_dir}/04/${bn}.regenie.gz | ||
> ${out} | ||
echo $out | ||
# for i in 1:nchr | ||
for i in $(seq 1 $nchr) | ||
do | ||
cat ${phenotype_processed_dir}/regenie/step2_${i}_${bn}.regenie.gz >> $out | ||
done | ||
done | ||
|
||
ls -l /local-scratch/projects/Lifecourse-GWAS/gib/alspac/phen_proc2/regenie/step2_*_bmi_10-11_both.regenie.gz | ||
|
||
ls -lh $out | ||
ls -lh $out | ||
|
||
|
||
less | ||
|
||
libr | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
source config.env | ||
|
||
pgendir=$1 | ||
|
||
if [ -z $pgendir ]; then | ||
echo "Usage: ./bgen_to_pgen.sh <pgendir>" | ||
exit 1 | ||
fi | ||
|
||
mkdir -p ${pgendir} | ||
|
||
nchr=$(cat ${genotype_input_list} | grep -c '^') | ||
dn=$(head -n 1 ${genotype_input_list} | awk '{ print $1 }' | xargs dirname) | ||
mkdir -p $dn/pgen | ||
|
||
tf=$(mktemp) | ||
for i in $(seq 1 ${nchr}) | ||
do | ||
bgen=$(awk -v i=$i 'NR==i { print $1 }' ${genotype_input_list}) | ||
sample=$(awk -v i=$i 'NR==i { print $2 }' ${genotype_input_list}) | ||
bn=$(basename $bgen .bgen) | ||
dn=$(dirname $bgen) | ||
|
||
./bin/plink2 --bgen ${bgen} ref-first --sample ${sample} --make-pgen --out ${pgendir}/${bn} --threads ${env_threads} | ||
echo "${pgendir}/${bn}" >> $tf | ||
done | ||
|
||
cp ${genotype_input_list} ${genotype_input_list}.original | ||
mv ${tf} ${genotype_input_list} | ||
|
||
echo "Original bgen files are now listed in ${genotype_input_list}.original" | ||
echo "New pgen files are now listed in ${genotype_input_list}" | ||
|
||
echo "Successfully converted to bgen files to pgen" |
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