Skip to content

Commit

Permalink
Fix mds csv file creation if it already exists
Browse files Browse the repository at this point in the history
Do not append but overwrite the file if it already exists
  • Loading branch information
HippocampusGirl committed Nov 28, 2023
1 parent 7d83b68 commit a86c0d0
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions bin/enigma-mds
Original file line number Diff line number Diff line change
Expand Up @@ -86,24 +86,19 @@ run_cmd plink --bfile "${REFERENCE}" --extract "local.snplist.txt" --make-bed --
run_cmd plink --bfile "local" --bmerge "external.bed" "external.bim" "external.fam" --make-bed --noweb --out "merge"

if [ -f "merge-merge.missnp" ]; then

run_cmd plink --bfile "local" --flip "merge-merge.missnp" --make-bed --noweb --out "flipped"
run_cmd mv "merge-merge.missnp" "merge-merge.flipped.missnp"

run_cmd plink --bfile "flipped" --bmerge "external.bed" "external.bim" "external.fam" --make-bed --noweb --out "merge"
fi

if [ -f "merge-merge.missnp" ]; then

run_cmd plink --bfile "flipped" --exclude "merge-merge.missnp" --make-bed --noweb --out "no-missnp"

run_cmd plink --bfile "no-missnp" --bmerge "external.bed" "external.bim" "external.fam" --make-bed --noweb --out "merge"

fi

run_cmd plink --bfile "merge" --cluster --mind "0.05" --mds-plot "4" --extract "local.snplist.txt" --noweb --out "HM3_b37mds"

run_cmd "awk 'BEGIN{OFS=\",\"}; {print \$1, \$2, \$3, \$4, \$5, \$6, \$7}' HM3_b37mds.mds >> HM3_b37mds2R.mds.csv"
run_cmd "awk 'BEGIN{OFS=\",\"}; {print \$1, \$2, \$3, \$4, \$5, \$6, \$7}' HM3_b37mds.mds > HM3_b37mds2R.mds.csv"

run_cmd "Rscript - <<EOF
mds.cluster = read.csv(\"HM3_b37mds2R.mds.csv\", header=T)
Expand Down

0 comments on commit a86c0d0

Please sign in to comment.