Skip to content

Instantly share code, notes, and snippets.

@yannickwurm
Created November 8, 2013 15:57
Show Gist options
  • Save yannickwurm/7373157 to your computer and use it in GitHub Desktop.
Save yannickwurm/7373157 to your computer and use it in GitHub Desktop.
def parse(signalp_hash, open_reading_frames_condensed, motif)
signalp_with_seq = {}
signalp_hash.each do |id, h|
current_orf = open_reading_frames_condensed[id]
sequence = current_orf.to_s.gsub('["', '').gsub('"]', '')
sp_clv = h[0][:cut_off].to_i - 1
signalp = sequence[0,sp_clv]
seq_end = sequence[sp_clv+1, sequence.length - (sp_clv+1)]
if seq_end.match(/#{motif}/)
signalp_with_seq[id + "~- S.P. Cleavage Site: #{sp_clv}:" \
"#{h[0][:cut_off]} - S.P. D-value: #{h[0][:d_value]}"] = \
"#{signalp}~#{seq_end}"
end
end
end
return signalp_with_seq
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment