Skip to content

Commit 0c88d11

Browse files
authored
Merge pull request #22 from unipept/fix/no-results-equate-i-l-disabled
Fix equate I/L not returning results in API
2 parents 2c663f9 + b4865b5 commit 0c88d11

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

app/controllers/mpa_controller.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ def pept2data
99
@equate_il = params[:equate_il].nil? ? true : params[:equate_il]
1010

1111
# If equate_il is set, we have to replace all I's by and L in the input peptides.
12-
equalized_pepts = peptides.map { |p| p.gsub('I', 'L') } if @equate_il
12+
equalized_pepts = @equate_il ? peptides.map { |p| p.gsub('I', 'L') } : peptides
1313

1414
@peptides = Sequence
1515
.includes(Sequence.lca_t_relation_name(@equate_il) => :lineage)
1616
.where(sequence: equalized_pepts)
1717
.where.not(Sequence.lca_t_relation_name(@equate_il) => nil)
1818
if missed
19-
@peptides += peptides
19+
@peptides += equalized_pepts
2020
.to_set.subtract(@peptides.map(&:sequence))
2121
.map { |p| Sequence.missed_cleavage(p, @equate_il) }
2222
.compact
@@ -34,7 +34,7 @@ def pept2data
3434
@original_pep_fas = {}
3535

3636
peptides.each do |original_seq|
37-
equalized_seq = original_seq.gsub('I', 'L')
37+
equalized_seq = @equate_il ? original_seq.gsub('I', 'L') : original_seq
3838
if eq_seq_to_info.key? equalized_seq
3939
@original_pep_results[original_seq] = eq_seq_to_info[equalized_seq]
4040
@original_pep_fas[original_seq] = eq_seq_to_fa[equalized_seq]

0 commit comments

Comments
 (0)