bacterial-annotator 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4279f5b2fc1e4d06ddaeb71c64e7202a344a58b2
4
- data.tar.gz: 8a41abd4a1d5dc494636f8a048f193c83330cb1b
3
+ metadata.gz: e6e8bf0af45b396f1d4744782ef0f929e293c0d6
4
+ data.tar.gz: 21bcec3c99368690310f7e49752c87b0fa3c3290
5
5
  SHA512:
6
- metadata.gz: 4ec21441d9c0d9666312972fed6ebd556115b59d0e8fc2b4d7579ac5b35169f6be02c5847a1fe2679fb24df36edf2002c56c926f02707253c3a0583633a7bc1e
7
- data.tar.gz: fa310f9eb690b1181c48fd96e7cf3e44065b6e0c7f0cdd00902f1c1c8fc42c612ebeac4b48f585338285bfed8fd66481ec271dbc622af0aa2611462ec0f7b2e4
6
+ metadata.gz: d67ddd90fb1e96418bbd6bd64cacd7a665f7645b8857b1aee71b9e5ec3c083917f2f8a35a55f14167eb5938274e1c0ab3dd2a4abce0f8bfc802814b2f1f69a39
7
+ data.tar.gz: 3436ea2e71a099632c2068e7679515a4bc7c85fccbea05fd4f8d79cebccd618b624d6c7e2c70c553fd366abb4142275ee3568de7cbe1d1b7e208290494bcdc48
@@ -102,7 +102,7 @@ class GenbankManip
102
102
 
103
103
 
104
104
  # add annotation to a genbank file produced by prodigal
105
- def add_annotation annotations, outdir, mode
105
+ def add_annotation annotations, outdir, mode, reference_locus
106
106
 
107
107
  nb_of_added_ft = 0
108
108
  i = 0
@@ -134,6 +134,7 @@ class GenbankManip
134
134
  gene = hit[:gene]
135
135
  product = hit[:product]
136
136
  note = hit[:note]
137
+ pId = hit[:pId]
137
138
 
138
139
  if gene != nil
139
140
  qGene = Bio::Feature::Qualifier.new('gene', gene)
@@ -146,7 +147,7 @@ class GenbankManip
146
147
  end
147
148
 
148
149
  if locus != nil
149
- qNote = Bio::Feature::Qualifier.new('note', "correspond to #{locus} locus")
150
+ qNote = Bio::Feature::Qualifier.new('note', "correspond to #{locus} locus (#{pId}% identity) from #{reference_locus.entry_id}")
150
151
  ftArray.push(qNote)
151
152
  end
152
153
 
@@ -174,7 +174,7 @@ class RemoteNCBI
174
174
  gsub("RecName: Full=","").
175
175
  split("; AltName")[0].
176
176
  split("; Flags:")[0].
177
- split(" ; Short=")[0]
177
+ split(" ; Short=")[0].strip
178
178
  gi = hit.hit_id.to_s.split("|")[1]
179
179
  organism = ""
180
180
  definition_clean = hit.definition.split(">")[0]
@@ -182,7 +182,7 @@ class RemoteNCBI
182
182
  organism = definition_clean[/\[.*\]/].gsub("[","").gsub("]","")
183
183
  end
184
184
  @aln_hits[prot_id] = {
185
- pId: hit.identity.to_f/hit.target_len.to_f*100,
185
+ pId: (hit.identity.to_f/hit.target_len.to_f*100).round(2),
186
186
  length: hit.target_len.to_i,
187
187
  evalue: hit.evalue,
188
188
  score: hit.bit_score.to_f,
@@ -44,7 +44,7 @@ class SyntenyManip
44
44
  if ! @aln_hits.has_key? key
45
45
  next if lA[2].to_f < @pidentity
46
46
  @aln_hits[key] = {
47
- pId: lA[2].to_f,
47
+ pId: lA[2].to_f.round(2),
48
48
  length: lA[3].to_i,
49
49
  evalue: lA[10],
50
50
  score: lA[11].to_f,
@@ -52,7 +52,7 @@ class SyntenyManip
52
52
  }
53
53
  elsif lA[11].to_f > @aln_hits[key][:score]
54
54
  @aln_hits[key] = {
55
- pId: lA[2].to_f,
55
+ pId: lA[2].to_f.round(2),
56
56
  length: lA[3].to_i,
57
57
  evalue: lA[10],
58
58
  score: lA[11].to_f,
@@ -101,6 +101,7 @@ class SyntenyManip
101
101
  h = @aln_hits[p][:hits][hit_index]
102
102
  hit = ref_cds[h]
103
103
  annotations[p] = hit
104
+ annotations[p][:pId] = @aln_hits[p][:pId]
104
105
  i+=1
105
106
 
106
107
  else
@@ -147,7 +147,7 @@ class BacterialAnnotator
147
147
 
148
148
  hit_gi = v[:hits][0]
149
149
 
150
- note = "correspond to gi:#{hit_gi}"
150
+ note = "Protein homology (#{v[:pId]}% identity) with gi:#{hit_gi}"
151
151
 
152
152
  # p v
153
153
  # p ref_cds[hit_gi]
@@ -200,7 +200,9 @@ class BacterialAnnotator
200
200
  if ! @contig_annotations.has_key? contig_of_protein
201
201
  @contig_annotations[contig_of_protein] = {}
202
202
  end
203
- note = "correspond to gi:#{v[:hits][0][:gi]}"
203
+
204
+ note = "Protein homology (#{v[:pId]}% identity) with gi:#{v[:hits][0][:gi]}"
205
+ # note = "correspond to gi:#{v[:hits][0][:gi]}"
204
206
  if v[:hits][0][:org] != ""
205
207
  note += " from #{v[:hits][0][:org]}"
206
208
  end
@@ -226,7 +228,7 @@ class BacterialAnnotator
226
228
  @contig_annotations.each do |contig, contig_prot_annotations|
227
229
  gbk_path = @fasta.prodigal_files[:gbk_path]
228
230
  gbk_to_annotate = GenbankManip.new("#{gbk_path}/#{contig}.gbk", "#{gbk_path}")
229
- gbk_to_annotate.add_annotation contig_prot_annotations, gbk_path, 0
231
+ gbk_to_annotate.add_annotation contig_prot_annotations, gbk_path, 0, @refgenome.gbk.locus
230
232
  end
231
233
 
232
234
  end # end of method
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bacterial-annotator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maxime Deraspe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-17 00:00:00.000000000 Z
11
+ date: 2015-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bio