Skip to content

Instantly share code, notes, and snippets.

@explodecomputer
Created April 24, 2015 14:37
Show Gist options
  • Save explodecomputer/f2213f1b2c002f67aef7 to your computer and use it in GitHub Desktop.
Save explodecomputer/f2213f1b2c002f67aef7 to your computer and use it in GitHub Desktop.
update alspac ids
#!/bin/bash
cd /panfs/panasas01/shared/alspac/studies/latest/alspac/genetic/variants/arrays/gwas/imputed/1000genomes/released/27Feb2015/data/derived
mkdir -p ~/updated_ids
mkdir -p ~/updated_ids/kinships
mkdir -p ~/updated_ids/principal_components/all
mkdir -p ~/updated_ids/principal_components/unrelateds
mkdir -p ~/updated_ids/exclusion_ids
mkdir -p ~/updated_ids/unrelated_ids
cd kinships
awk '{ print $2, $2 }' hm3_autosomes.grm.id > ~/updated_ids/kinships/hm3_autosomes.grm.id
cd ../principal_components/all
awk '{ print $2, $2 }' children.eigenvec > ~/updated_ids/temp1
cut -d " " -f 3- children.eigenvec > ~/updated_ids/temp2
paste -d " " ~/updated_ids/temp1 ~/updated_ids/temp2 > ~/updated_ids/principal_components/all/children.eigenvec
awk '{ print $2, $2 }' mothers.eigenvec > ~/updated_ids/temp1
cut -d " " -f 3- mothers.eigenvec > ~/updated_ids/temp2
paste -d " " ~/updated_ids/temp1 ~/updated_ids/temp2 > ~/updated_ids/principal_components/all/mothers.eigenvec
cd ../unrelateds
awk '{ print $2, $2 }' children.eigenvec > ~/updated_ids/temp1
cut -d " " -f 3- children.eigenvec > ~/updated_ids/temp2
paste -d " " ~/updated_ids/temp1 ~/updated_ids/temp2 > ~/updated_ids/principal_components/unrelateds/children.eigenvec
awk '{ print $2, $2 }' mothers.eigenvec > ~/updated_ids/temp1
cut -d " " -f 3- mothers.eigenvec > ~/updated_ids/temp2
paste -d " " ~/updated_ids/temp1 ~/updated_ids/temp2 > ~/updated_ids/principal_components/unrelateds/mothers.eigenvec
cd ../unrelated_ids
awk '{ print $2, $2 }' children.txt > ~/updated_ids/unrelated_ids/children.txt
awk '{ print $2, $2 }' mothers.txt > ~/updated_ids/unrelated_ids/mothers.txt
cut -d "," -f 2-3 /panfs/panasas01/shared/alspac/ALSPAC_CONSENT_WITHDRAWN_LIST.csv | sed 1d | tr '-' 'M' | sed 's/,//g' > ~/updated_ids/exclusion_ids/exclusion_ids.txt
paste -d " " ~/updated_ids/exclusion_ids/exclusion_ids.txt ~/updated_ids/exclusion_ids/exclusion_ids.txt > ~/updated_ids/exclusion_ids/exclusion_ids.plink
awk '{ print $1, $2, "-9", "-9", "-9", "-9", "-9" }' ~/updated_ids/exclusion_ids/exclusion_ids.plink > ~/updated_ids/temp2
echo -e "ID_1 ID_2 missing father mother sex plink_pheno\n0 0 0 D D D B" > ~/updated_ids/temp1
cat ~/updated_ids/temp1 ~/updated_ids/temp2 > ~/updated_ids/exclusion_ids/exclusion_ids.sample
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment