ms-in_silico 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/History +7 -0
  2. data/lib/ms/in_silico/digest.rb +29 -12
  3. metadata +3 -3
data/History CHANGED
@@ -1,3 +1,10 @@
1
+ == 0.2.3 / 2009-03-31
2
+
3
+ * Digest now allows fasta entry inputs
4
+ * added min/max length filters to digest
5
+ * Digest removes whitespace from sequence
6
+ * updates for latest Tap
7
+
1
8
  == 0.2.2 / 2009-02-24
2
9
 
3
10
  * updated return value of Fragment
@@ -5,27 +5,44 @@ module Ms
5
5
  # Ms::InSilico::Digest::manifest digest a protein sequence into peptides
6
6
  # Digest a protein sequence into an array of peptides.
7
7
  #
8
- # % rap digest MIVIGRSIVHPYITNEYEPFAAEKQQILSIMAG --: dump --no-audit
8
+ # % rap digest MIVIGRSIVHPYITNEYEPFAAEKQQILSIMAG --:i dump
9
9
  # I[14:37:55] digest MIVIGRSIVHP... to 3 peptides
10
- # # date: 2008-09-15 14:37:55
11
- # ---
12
- # ms/in_silico/digest (23483900):
13
- # - - MIVIGR
14
- # - SIVHPYITNEYEPFAAEK
15
- # - QQILSIMAG
10
+ # MIVIGR
11
+ # SIVHPYITNEYEPFAAEK
12
+ # QQILSIMAG
16
13
  #
17
14
  class Digest < Tap::Task
18
15
 
19
- config :digester, 'Trypsin' # the name of the digester
20
- config :max_misses, 0, &c.integer # the max # of missed cleavage sites
21
- config :site_digest, false, &c.boolean # digest to sites (rather than sequences)
22
-
16
+ config :digester, 'Trypsin' # The name of the digester
17
+ config :min_length, nil, &c.integer_or_nil # Minimum peptide length
18
+ config :max_length, nil, &c.integer_or_nil # Maximum peptide length
19
+ config :max_misses, 0, &c.integer # The max # of missed cleavage sites
20
+ config :site_digest, false, &c.boolean # Digest to sites (rather than sequences)
21
+
23
22
  def process(sequence)
24
23
  unless d = Digester[digester]
25
24
  raise ArgumentError, "unknown digester: #{digester}"
26
25
  end
27
26
 
28
- peptides = site_digest ? d.site_digest(sequence, max_misses): d.digest(sequence, max_misses)
27
+ # extract sequence from FASTA entries
28
+ sequence = $1 if sequence =~ /\A>.*?\n(.*)\z/m
29
+ sequence.gsub!(/\s/, "")
30
+
31
+ peptides = if site_digest
32
+ d.site_digest(sequence, max_misses)
33
+ else
34
+ d.digest(sequence, max_misses)
35
+ end
36
+
37
+ # filter
38
+ peptides.delete_if do |peptide|
39
+ peptide.length < min_length
40
+ end if min_length
41
+
42
+ peptides.delete_if do |peptide|
43
+ peptide.length > max_length
44
+ end if max_length
45
+
29
46
  log 'digest', "#{sequence[0..10]}#{sequence.length > 10 ? '...' : ''} to #{peptides.length} peptides"
30
47
  peptides
31
48
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ms-in_silico
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Chiang
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-02-24 00:00:00 -07:00
12
+ date: 2009-03-31 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.12.0
23
+ version: 0.12.4
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: molecules