dirseq 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -1
  3. data/VERSION +1 -1
  4. data/bin/dirseq +16 -0
  5. data/spec/script_spec.rb +12 -12
  6. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f1af55dda3a8cfe508bf3cf49fb877dddfbda7b6
4
- data.tar.gz: e2334d82dfcaf555255234cb61e409a0c3bf262d
3
+ metadata.gz: 48124cb9d1c64721dce10b66a4ae9c6d1773ae5c
4
+ data.tar.gz: 7f7ee356e059956cc204be699d67fab65fa6c41e
5
5
  SHA512:
6
- metadata.gz: 43d4538cc5bd983468642056f80d3386663c93b7b7a64ecf2c2917fd84592c75787851c83c8657606f228dc1008e15e67733a48ac713e45bb9b2a95556ca37df
7
- data.tar.gz: 155d7a12624068d8cc8cf20ce2b672c027601a6cc39741ebf78d670cef22779899d26f1073ef2450c2f200bac31f3349262c4d8994094e5138430be692b63596
6
+ metadata.gz: 64263f1b13de9816f978c79961a188f4ab306ff1d7abd0f94d1bfdb6d9c4c807bec7b96b7651afbf1158b2dac38135b6970e273e018bb7f9fdf1fbc9cc736b5e
7
+ data.tar.gz: 6031c1e7952072c0c379a744bf067ae7f2aa9d7328dfec698ed4af84194ac407eb4b18948a3717ef7538f569cdd787a9f0ad4455025ac8148604834c7bb33988
data/README.md CHANGED
@@ -37,7 +37,8 @@ Optional parameters:
37
37
  --measure-type TYPE what to count for each gene [options: count, coverage][default: coverage]
38
38
  --accepted-feature-types TYPE
39
39
  Print only features of these type(s) [default CDS]
40
-
40
+ --comment-fields Print elements from the comments in the GFF file [default ID]
41
+
41
42
  Verbosity:
42
43
 
43
44
  -q, --quiet Run quietly, set logging to ERROR level [default INFO]
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.3.0
data/bin/dirseq CHANGED
@@ -24,6 +24,7 @@ options = {
24
24
  :count_type => COVERAGE_COUNT_TYPE,
25
25
  :forward_read_only => false,
26
26
  :accepted_feature_types => ['CDS'],
27
+ :comment_fields_to_print => ['ID'],
27
28
  }
28
29
  o = OptionParser.new do |opts|
29
30
  opts.banner = "
@@ -52,6 +53,10 @@ o = OptionParser.new do |opts|
52
53
  "Print only features of these type(s) [default #{options[:accepted_feature_types].join(',')}]") do |arg|
53
54
  options[:accepted_feature_types] = Set.new(arg)
54
55
  end
56
+ opts.on("--comment-fields", Array,
57
+ "Print elements from the comments in the GFF file [default #{options[:comment_fields_to_print].join(',')}]") do |arg|
58
+ options[:comment_fields_to_print] = arg
59
+ end
55
60
 
56
61
  # logger options
57
62
  opts.separator "\nVerbosity:\n\n"
@@ -246,6 +251,9 @@ else
246
251
  raise
247
252
  end
248
253
  headers.push 'annotation'
254
+ options[:comment_fields_to_print].each do |field|
255
+ headers.push field
256
+ end
249
257
  puts headers.join("\t")
250
258
 
251
259
  covs_fwd.each do |feature, cov_fwd|
@@ -268,5 +276,13 @@ covs_fwd.each do |feature, cov_fwd|
268
276
  ]
269
277
  to_print.push cov_rev unless options[:ignore_directions]
270
278
  to_print.push product
279
+ options[:comment_fields_to_print].each do |field|
280
+ answer1 = record.attributes.select{|a| a[0] == field}
281
+ if answer1.empty?
282
+ to_print.push ''
283
+ else
284
+ to_print.push answer1[0][1]
285
+ end
286
+ end
271
287
  puts to_print.join("\t")
272
288
  end
data/spec/script_spec.rb CHANGED
@@ -6,9 +6,9 @@ describe 'script' do
6
6
 
7
7
  it "should regular mode" do
8
8
  answer = %w(
9
- contig type start end strand forward_average_coverage reverse_average_coverage annotation
9
+ contig type start end strand forward_average_coverage reverse_average_coverage annotation ID
10
10
  ).join("\t")+"\n"+%w(
11
- contig_100 CDS 2 127 + 0.0 1.1428571428571428 unannotated
11
+ contig_100 CDS 2 127 + 0.0 1.1428571428571428 unannotated 40_1
12
12
  ).join("\t")+"\n"
13
13
 
14
14
  found = Bio::Commandeer.run "#{path_to_script} --bam #{data_dir}/eg.bam --gff #{data_dir}/eg.gff -q"
@@ -20,9 +20,9 @@ describe 'script' do
20
20
  found = Bio::Commandeer.run "#{path_to_script} --bam #{data_dir}/eg.bam --gff #{data_dir}/eg.gff -q --ignore-direction"
21
21
 
22
22
  answer = %w(
23
- contig type start end strand average_coverage annotation
23
+ contig type start end strand average_coverage annotation ID
24
24
  ).join("\t")+"\n"+%w(
25
- contig_100 CDS 2 127 + 1.1428571428571428 unannotated
25
+ contig_100 CDS 2 127 + 1.1428571428571428 unannotated 40_1
26
26
  ).join("\t")+"\n"
27
27
 
28
28
  found.should == answer
@@ -30,9 +30,9 @@ describe 'script' do
30
30
 
31
31
  it 'should not fail when the GFF has a FASTA section' do
32
32
  answer = %w(
33
- contig type start end strand forward_average_coverage reverse_average_coverage annotation
33
+ contig type start end strand forward_average_coverage reverse_average_coverage annotation ID
34
34
  ).join("\t")+"\n"+%w(
35
- contig_100 CDS 2 127 + 0.0 1.1428571428571428 unannotated
35
+ contig_100 CDS 2 127 + 0.0 1.1428571428571428 unannotated 40_1
36
36
  ).join("\t")+"\n"
37
37
 
38
38
  found = Bio::Commandeer.run "#{path_to_script} --bam #{data_dir}/eg.bam --gff #{data_dir}/eg_with_fasta.gff -q"
@@ -42,10 +42,10 @@ describe 'script' do
42
42
 
43
43
  it 'should print annotation out properly' do
44
44
  answer = %w(
45
- contig type start end strand forward_average_coverage reverse_average_coverage annotation
45
+ contig type start end strand forward_average_coverage reverse_average_coverage annotation ID
46
46
  ).join("\t")+"\n"+%w(
47
47
  contig_100 CDS 2 127 + 0.0 1.1428571428571428 putative
48
- ).join("\t")+" methyltransferase YcgJ\n"
48
+ ).join("\t")+" methyltransferase YcgJ PROKKA_00001\n"
49
49
 
50
50
  found = Bio::Commandeer.run "#{path_to_script} --bam #{data_dir}/eg.bam --gff #{data_dir}/realer.gff -q"
51
51
 
@@ -54,10 +54,10 @@ describe 'script' do
54
54
 
55
55
  it 'should print counts correctly' do
56
56
  answer = %w(
57
- contig type start end strand forward_read_count reverse_read_count annotation
57
+ contig type start end strand forward_read_count reverse_read_count annotation ID
58
58
  ).join("\t")+"\n"+%w(
59
59
  contig_100 CDS 2 127 + 0.0 2.0 putative
60
- ).join("\t")+" methyltransferase YcgJ\n"
60
+ ).join("\t")+" methyltransferase YcgJ PROKKA_00001\n"
61
61
 
62
62
  found = Bio::Commandeer.run "#{path_to_script} --bam #{data_dir}/eg.bam --gff #{data_dir}/realer.gff -q --measure-type count"
63
63
 
@@ -66,10 +66,10 @@ describe 'script' do
66
66
 
67
67
  it 'should count only the forward read when asked' do
68
68
  answer = %w(
69
- contig type start end strand forward_read_count reverse_read_count annotation
69
+ contig type start end strand forward_read_count reverse_read_count annotation ID
70
70
  ).join("\t")+"\n"+%w(
71
71
  contig_100 CDS 2 127 + 0.0 1.0 putative
72
- ).join("\t")+" methyltransferase YcgJ\n"
72
+ ).join("\t")+" methyltransferase YcgJ PROKKA_00001\n"
73
73
 
74
74
  found = Bio::Commandeer.run "#{path_to_script} --bam #{data_dir}/eg.bam --gff #{data_dir}/realer.gff -q --measure-type count --forward-read-only"
75
75
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dirseq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben J. Woodcroft
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-20 00:00:00.000000000 Z
11
+ date: 2018-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bio-commandeer