bacterial-annotator 0.3.6 → 0.3.7

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/bacterial-comparator.rb +22 -5
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 57201d0ab8b7b095e6c33f8e446f907360bdb99f
4
- data.tar.gz: cb08fd283c1d3c61b68d715c44217ad479dfba92
3
+ metadata.gz: 0f8c89d68e4afea5b49e88e68159f573b8fe44c1
4
+ data.tar.gz: a0742812f0e42a3346b63c79f590df774fb5e16c
5
5
  SHA512:
6
- metadata.gz: 74860f69f0c777a40c9417f840ffc388d4ce81ccd0bf10d92eab63a38d6a5d0e231a80d4e2021d4a0a079742e54042996abf12e957987912d29b5d9bd20b22ab
7
- data.tar.gz: 186cca9709f39f20e2cf5c6b4b57bea5df5cecfafd19bc9f3a635a3d22a709a09e4e3d75fa4bc42ade631d36d37e929418041bafe917abb88cf073475e9ab77a
6
+ metadata.gz: 0f8d59637356bc752bea3271d9f9d733eee83699928312becf7fbbf319ffc482e976c5dc7927f5ba300aa1b263b8909c63b8d17afb2e0c3d4a0b9497c5c49f80
7
+ data.tar.gz: 55857b474d7e88373d295f3bf8ea7d9d99d431b8192e8f24d63dec012a511725bad7f1e43edc6e7b1259688c9c84cc868d08c3add2b2e082efca085cf2636489
@@ -41,9 +41,11 @@ class BacterialComparator
41
41
  end
42
42
 
43
43
  def read_prot_synteny
44
+ puts "# Reading genomes synteny files (from genome annotations) .."
44
45
  synteny = {}
45
46
  @genomes_list.each do |g|
46
- puts "#{g}/Prot-Synteny.tsv"
47
+ puts " #{g}/Prot-Synteny.tsv"
48
+ genome_synteny = []
47
49
  file = File.open("#{g}/Prot-Synteny.tsv", "r")
48
50
  l = file.gets # skip header
49
51
  while l = file.gets
@@ -51,6 +53,12 @@ class BacterialComparator
51
53
  lA = l.chomp.split("\t")
52
54
  synteny[lA[0]] = [] if ! synteny.has_key? lA[0]
53
55
  synteny[lA[0]] << {ref_cov: lA[3].to_f, pId: lA[4].to_f, query_prot: lA[5], query_cov: lA[7].to_f}
56
+ genome_synteny << lA[0]
57
+ end
58
+ @ref_prot.each do |ref_prot|
59
+ if ! genome_synteny.include? ref_prot
60
+ synteny[lA[0]] << {ref_cov: "-", pId: "-", query_prot: "-", query_cov: "-"}
61
+ end
54
62
  end
55
63
  file.close
56
64
  end
@@ -124,7 +132,7 @@ class BacterialComparator
124
132
 
125
133
  def extract_syntenic_fasta min_cov, min_pid
126
134
 
127
- "# Extracting Proteins and Genes multifasta.."
135
+ puts "# Extracting Proteins and Genes multifasta.."
128
136
  nb_of_syntenic = 0
129
137
  stats = {}
130
138
  stats[:syntenic] = []
@@ -136,7 +144,7 @@ class BacterialComparator
136
144
  @synteny.each do |k,v|
137
145
  is_syntenic = 1
138
146
  v.each do |v_|
139
- if v_[:query_cov].nil?
147
+ if v_[:query_cov] == "-"
140
148
  is_syntenic = 0
141
149
  break
142
150
  elsif v_[:query_cov] > min_cov and
@@ -149,16 +157,25 @@ class BacterialComparator
149
157
  end
150
158
  end
151
159
 
160
+ fout.write("#{k}")
152
161
  if is_syntenic == 1
153
162
  nb_of_syntenic += 1
154
163
  # build_multifasta k, v
155
164
  to_build_multifasta << [k,v]
156
- fout.write("#{k}")
157
165
  v.each do |x|
158
- fout.write("\t#{x[:query_prot]}|#{x[:query_cov]}|#{x[:ref_cov]}")
166
+ fout.write("\t#{x[:query_prot]}|#{x[:pId]}|#{x[:query_cov]}|#{x[:ref_cov]}")
159
167
  stats[:syntenic] << k
160
168
  end
161
169
  fout.write("\n")
170
+ else
171
+ v.each do |x|
172
+ if x[:pId] == 0.0
173
+ fout.write("\t-")
174
+ else
175
+ fout.write("\t#{x[:query_prot]}|#{x[:pId]}|#{x[:query_cov]}|#{x[:ref_cov]}")
176
+ end
177
+ end
178
+ fout.write("\n")
162
179
  end
163
180
 
164
181
  end
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.3.6
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maxime Deraspe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-19 00:00:00.000000000 Z
11
+ date: 2017-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bio