Skip to content

Instantly share code, notes, and snippets.

@nievergeltlab
Created August 17, 2022 20:37
Show Gist options
  • Save nievergeltlab/b7d82627e3c825d023a6eac6d4b476ce to your computer and use it in GitHub Desktop.
Save nievergeltlab/b7d82627e3c825d023a6eac6d4b476ce to your computer and use it in GitHub Desktop.
Determine if a SNP is within a locus by applying a TRUE/FALSE criteria to each required bound. If all bounds are true, the SNP is within a given locus..
d1$replicated <- NA
#All 3 must be true
for (i in 1:dim(d1)[1])
{
d1[i,]$replicated <- any(d1[i,]$chr == d2$CHR & d1[i,]$pos >= d2$START & d1[i,]$pos <= d2$STOP)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment