1 - If a gwas SNP has unknown position, its chromosome and position are recorded as {-1,-1}. If we can't fill in the position from the rs number, via the build, then the GWAS SNP will be deleted. This is part of the original design
2 - If a SNP is known in one build, but not another, then it's position is recorded is recorded for all builds, but is recorded as {-1, -1} in the builds where the rs-number isn't known.
3 - When copying SNPs from the build database into the GWAS , we often have to add one to the position. The system for detecting the build number doesn't only decide among three builds, it also estimates whether we need to add one to the position. This gives six different possibilities
The problem occurs where all three of these come together, Instead of copying {-1,-1} from the build database into the GWAS, it copies {-1,0} (because one has been added). Then we have a GWAS SNP with an invalid position, but it's not removed.
The easiest way to understand this fix, and the bug that it resolves, is to look at the function add_one_if_not_negative that is added here. When adding one to the position, it leaves -1 unchanged
There are multiple parts to the bug:
1 - If a gwas SNP has unknown position, its chromosome and position are recorded as {-1,-1}. If we can't fill in the position from the rs number, via the build, then the GWAS SNP will be deleted. This is part of the original design
2 - If a SNP is known in one build, but not another, then it's position is recorded is recorded for all builds, but is recorded as {-1, -1} in the builds where the rs-number isn't known.
3 - When copying SNPs from the build database into the GWAS , we often have to add one to the position. The system for detecting the build number doesn't only decide among three builds, it also estimates whether we need to add one to the position. This gives six different possibilities
The problem occurs where all three of these come together, Instead of copying {-1,-1} from the build database into the GWAS, it copies {-1,0} (because one has been added). Then we have a GWAS SNP with an invalid position, but it's not removed.
The easiest way to understand this fix, and the bug that it resolves, is to look at the function
add_one_if_not_negative
that is added here. When adding one to the position, it leaves -1 unchanged