Skip to content

Commit

Permalink
Revise SNPclip sort order, use user supplied input format;Fix LDpair …
Browse files Browse the repository at this point in the history
…multiallelic query for second SNP input
  • Loading branch information
xiaoyao00 committed May 24, 2022
1 parent e47e2fe commit 28ef9ab
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 6 deletions.
6 changes: 4 additions & 2 deletions LDlink/LDcommon.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def getRecomb(db, filename, chromosome, begin, end, genome_build):
}) + '\n')
return recomb_results_sanitized

def parse_vcf(vcf,snp_coords):
def parse_vcf(vcf,snp_coords,ifsorted):
delimiter = "#"
snp_lists = str('**'.join(vcf)).split(delimiter)
snp_dict = {}
Expand Down Expand Up @@ -258,7 +258,9 @@ def parse_vcf(vcf,snp_coords):
snp_rs_dict[s_key] = snp_dict[snp_coord[2]]
del snp_dict

sorted_snp_rs = OrderedDict(sorted(snp_rs_dict.items(),key=customsort))
sorted_snp_rs = snp_rs_dict
if ifsorted:
sorted_snp_rs = OrderedDict(sorted(snp_rs_dict.items(),key=customsort))

return sorted_snp_rs," ".join(missing_rs)

Expand Down
2 changes: 1 addition & 1 deletion LDlink/LDhap.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def set_alleles(a1, a2):
hap2.append([])

# parse vcf
snp_dict,missing_snp = parse_vcf(vcf[h+1:],snp_coords)
snp_dict,missing_snp = parse_vcf(vcf[h+1:],snp_coords,True)
# throw error if no data is returned from 1000G
if len(missing_snp.split()) == len(snp_pos):
output["error"] = "Input variant list does not contain any valid RS numbers or coordinates. " + str(output["warning"] if "warning" in output else "")
Expand Down
2 changes: 1 addition & 1 deletion LDlink/LDmatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def set_alleles(a1, a2):
for i in range(len(index) - 1):
hap2.append([])

snp_dict,missing_snp = parse_vcf(vcf[h+1:],snp_coords)
snp_dict,missing_snp = parse_vcf(vcf[h+1:],snp_coords,True)

# all lists does not contain data which is returned from 1000G
if len(missing_snp.split()) == len(snp_pos):
Expand Down
2 changes: 1 addition & 1 deletion LDlink/LDmatrix_plot_sub.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def set_alleles(a1, a2):
for i in range(len(index) - 1):
hap2.append([])

snp_dict,missing_snp = parse_vcf(vcf[h+1:],snp_coords)
snp_dict,missing_snp = parse_vcf(vcf[h+1:],snp_coords,True)

rsnum_lst = []
allele_lst = []
Expand Down
2 changes: 1 addition & 1 deletion LDlink/SNPclip.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def calc_r2(var1, var2):
if head[i] in pop_ids:
pop_index.append(i)

snp_dict,missing_snp = parse_vcf(vcf[h+1:],snp_coords)
snp_dict,missing_snp = parse_vcf(vcf[h+1:],snp_coords,False)

# throw error if no data is returned from 1000G
if len(missing_snp.split()) == len(snp_pos):
Expand Down
1 change: 1 addition & 0 deletions LDlink/news-5.3.3.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<p><b>LDlink 5.3.3 Release (05/24/2022)</b></p>
<ul>
<li>Revise SNPclip sort order, use user supplied input format;
<li>Fix LDpair multiallelic query for second SNP input</li>
</ul>
<br>
Expand Down

0 comments on commit 28ef9ab

Please sign in to comment.