Skip to content

Commit

Permalink
Merge pull request #22 from unipept/fix/no-results-equate-i-l-disabled
Browse files Browse the repository at this point in the history
Fix equate I/L not returning results in API
  • Loading branch information
pverscha authored Jul 4, 2023
2 parents 2c663f9 + b4865b5 commit 0c88d11
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/controllers/mpa_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ def pept2data
@equate_il = params[:equate_il].nil? ? true : params[:equate_il]

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

@peptides = Sequence
.includes(Sequence.lca_t_relation_name(@equate_il) => :lineage)
.where(sequence: equalized_pepts)
.where.not(Sequence.lca_t_relation_name(@equate_il) => nil)
if missed
@peptides += peptides
@peptides += equalized_pepts
.to_set.subtract(@peptides.map(&:sequence))
.map { |p| Sequence.missed_cleavage(p, @equate_il) }
.compact
Expand All @@ -34,7 +34,7 @@ def pept2data
@original_pep_fas = {}

peptides.each do |original_seq|
equalized_seq = original_seq.gsub('I', 'L')
equalized_seq = @equate_il ? original_seq.gsub('I', 'L') : original_seq
if eq_seq_to_info.key? equalized_seq
@original_pep_results[original_seq] = eq_seq_to_info[equalized_seq]
@original_pep_fas[original_seq] = eq_seq_to_fa[equalized_seq]
Expand Down

0 comments on commit 0c88d11

Please sign in to comment.