Skip to content

Instantly share code, notes, and snippets.

@kindlychung
Created July 4, 2016 17:36
Show Gist options
  • Save kindlychung/14a2a8e61e8ff28e918cfaf187119221 to your computer and use it in GitHub Desktop.
Save kindlychung/14a2a8e61e8ff28e918cfaf187119221 to your computer and use it in GitHub Desktop.
filter_by_corr = function(correlation_thresh, geno_cor) {
geno_cor_filter = abs(geno_cor) < correlation_thresh
diag(geno_cor_filter) = TRUE
i = 0
while(TRUE) {
i = i + 1
if(i > length(ordered_pairs)) break
pair = ordered_pairs[i]
if(! (pair %in% colnames(geno_cor_filter))) {
next
}
filter_by_ith_col = geno_cor_filter[, pair]
geno_cor_filter = geno_cor_filter[filter_by_ith_col, filter_by_ith_col]
}
geno_cor_filter
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment