Skip to content

Commit b4f98c9

Browse files
author
Richard Liang
committed
A number of minor fixes.
1 parent d377fc8 commit b4f98c9

File tree

6 files changed

+19
-18
lines changed

6 files changed

+19
-18
lines changed

src/easyhla/bblab_lib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def summary_row(cls, interpretation: HLAInterpretation) -> "HLAInterpretationRow
230230
)
231231

232232
allele_pairs: AllelePairs = interpretation.best_matching_allele_pairs()
233-
alleles_all_str = allele_pairs.stringify()
233+
alleles_all_str = allele_pairs.stringify(sorted=True)
234234

235235
alleles_clean: str
236236
_, alleles_clean, __ = interpretation.best_common_allele_pair()

src/easyhla/hla_algorithm.rb

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,10 @@ def initialize(raw_result)
4444

4545
class HLAAlgorithm
4646
def initialize(
47-
hla_a_std_path=nil,
48-
hla_b_std_path=nil,
49-
hla_c_std_path=nil,
47+
hla_std_path=nil,
5048
hla_freq_path=nil
5149
)
52-
@hla_std_paths = {
53-
'A' => hla_a_std_path,
54-
'B' => hla_b_std_path,
55-
'C' => hla_c_std_path
56-
}
50+
@hla_std_path = hla_std_path
5751
@hla_freq_path = hla_freq_path
5852
end
5953

@@ -62,10 +56,17 @@ def analyze(seqs, locus='B')
6256
"seq1" => seqs[0],
6357
"seq2" => seqs[1],
6458
"locus" => locus,
65-
"hla_std_path" => File.expand_path(@hla_std_paths[locus]),
59+
"hla_std_path" => File.expand_path(@hla_std_path),
6660
"hla_freq_path" => File.expand_path(@hla_freq_path)
6761
}
6862

63+
if (!@hla_std_path.nil?)
64+
hla_input["hla_std_path"] = File.expand_path(@hla_std_path)
65+
end
66+
if (!@hla_freq_path.nil?)
67+
hla_input["hla_freq_path"] = File.expand_path(@hla_freq_path)
68+
end
69+
6970
python_stdout, python_stderr, wait_thread = Open3.capture3(
7071
"#{HLA_INTERPRET_FROM_JSON} -",
7172
stdin_data: JSON.generate(hla_input)

src/easyhla/interpret_from_json_lib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def build_from_interpretation(cls, interp: HLAInterpretation) -> "HLAResult":
117117

118118
return HLAResult(
119119
seqs=seqs,
120-
alleles_all=[f"{x[0]} - {x[1]}" for x in aps.allele_pairs],
120+
alleles_all=[f"{x[0]} - {x[1]}" for x in aps.sort_pairs()],
121121
alleles_clean=alleles_clean,
122122
alleles_for_mismatches=f"{rep_ap[0]} - {rep_ap[1]}",
123123
mismatches=[str(x) for x in match_details.mismatches],

tests/bblab_lib_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ def test_pair_exons(
759759
alleles_clean="B*10:01 - B*20",
760760
alleles=(
761761
"B*01:01:01 - B*02:02:02;B*10:01:10 - B*20:01;"
762-
"B*10:01:10 - B*22:22:22;B*10:01:15 - B*20:02:03"
762+
"B*10:01:10 - B*111:22:22;B*10:01:15 - B*20:02:03"
763763
),
764764
ambiguous=1,
765765
homozygous=0,

tests/clinical_hla_lib_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def dummy_matches(locus: HLA_LOCUS) -> dict[HLACombinedStandard, HLAMatchDetails
6161
standard_bin=(2, 4, 10, 2),
6262
possible_allele_pairs=(
6363
(f"{locus}*10:01:10", f"{locus}*20:01"),
64-
(f"{locus}*10:01:10", f"{locus}*22:22:22"),
64+
(f"{locus}*10:01:10", f"{locus}*111:22:22"),
6565
),
6666
): HLAMatchDetails(
6767
mismatch_count=1,
@@ -117,7 +117,7 @@ def test_hla_sequence_a_build_from_interpretation():
117117
alleles_clean="A*10:01 - A*20",
118118
alleles_all=(
119119
"A*01:01:01 - A*02:02:02;A*10:01:10 - A*20:01;"
120-
"A*10:01:10 - A*22:22:22;A*10:01:15 - A*20:02:03"
120+
"A*10:01:10 - A*111:22:22;A*10:01:15 - A*20:02:03"
121121
),
122122
ambiguous="True",
123123
homozygous="False",
@@ -196,7 +196,7 @@ def test_hla_sequence_b_build_from_interpretation_non_b5701():
196196
alleles_clean="B*10:01 - B*20",
197197
alleles_all=(
198198
"B*01:01:01 - B*02:02:02;B*10:01:10 - B*20:01;"
199-
"B*10:01:10 - B*22:22:22;B*10:01:15 - B*20:02:03"
199+
"B*10:01:10 - B*111:22:22;B*10:01:15 - B*20:02:03"
200200
),
201201
ambiguous="True",
202202
homozygous="False",
@@ -384,7 +384,7 @@ def test_hla_sequence_c_build_from_interpretation():
384384
alleles_clean="C*10:01 - C*20",
385385
alleles_all=(
386386
"C*01:01:01 - C*02:02:02;C*10:01:10 - C*20:01;"
387-
"C*10:01:10 - C*22:22:22;C*10:01:15 - C*20:02:03"
387+
"C*10:01:10 - C*111:22:22;C*10:01:15 - C*20:02:03"
388388
),
389389
ambiguous="True",
390390
homozygous="False",

tests/interpret_from_json_lib_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def test_hla_input_hla_sequence_locus_bc():
231231
alleles_all=[
232232
"A*01:01:01 - A*02:02:02",
233233
"A*10:01:10 - A*20:01",
234-
"A*10:01:10 - A*22:22:22",
234+
"A*10:01:10 - A*111:22:22",
235235
"A*10:01:15 - A*20:02:03",
236236
],
237237
alleles_clean="A*10:01 - A*20",
@@ -279,7 +279,7 @@ def test_hla_input_hla_sequence_locus_bc():
279279
alleles_all=[
280280
"C*01:01:01 - C*02:02:02",
281281
"C*10:01:10 - C*20:01",
282-
"C*10:01:10 - C*22:22:22",
282+
"C*10:01:10 - C*111:22:22",
283283
"C*10:01:15 - C*20:02:03",
284284
],
285285
alleles_clean="C*10:01 - C*20",

0 commit comments

Comments
 (0)