Created
January 5, 2023 19:40
-
-
Save nievergeltlab/5795b47c74cf19752f01f49b2964f236 to your computer and use it in GitHub Desktop.
Extract LDSC results from a list of .log files. Makes it easy to put many results into a table.
This file contains hidden or 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
for files in $(ls | grep log | grep -v munge | grep ldsc) | |
do | |
h2snp=$(cat $files | grep "Observed scale" | sed 's/(//g' | sed 's/)//g' | awk '{print $5,$6, $5/$6}') | |
intercept=$(cat $files | grep "Intercept" | sed 's/(//g' | sed 's/)//g' | awk '{print $2,$3, ($2-1)/$3}' ) | |
ratio=$(cat $files | grep "Ratio" | sed 's/(//g' | sed 's/)//g' | awk '{print $2,$3, $2/$3}' ) | |
lambda=$(cat $files | grep "Lambda" | sed 's/(//g' | sed 's/)//g' | awk '{print $3}' ) | |
chisq=$(cat $files | grep "Mean Chi" | sed 's/(//g' | sed 's/)//g' | awk '{print $3}' ) | |
outname=$(echo $files | sed 's/.log//g') | |
echo $outname $lambda $chisq $intercept $h2snp $ratio > "$files".ref.log | |
done | |
cat *.ref.log > auditoryh2logs.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment