Skip to content

Commit

Permalink
Merge branch 'feature/dbxref' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbarton committed Mar 4, 2013
2 parents 7c3105d + 8deed8a commit ce1c73f
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 5 deletions.
43 changes: 39 additions & 4 deletions features/table/cds_entries.feature
Expand Up @@ -303,7 +303,7 @@ Feature: Producing cds annotation view from a scaffold
"""

@disable-bundler
Scenario: A CDS entry with duplicate note attributes
Scenario: A CDS entry with a single db_xref attribute
Given I successfully run `genomer init project`
And I cd to "project"
And I write to "assembly/scaffold.yml" with:
Expand All @@ -320,7 +320,7 @@ Feature: Producing cds annotation view from a scaffold
And I write to "assembly/annotations.gff" with:
"""
##gff-version 3
contig1 . gene 1 3 . - 1 ID=gene1;Note=val1;Note=val2
contig1 . gene 1 3 . - 1 ID=gene1;db_xref=GO:000001
"""
And I append to "Gemfile" with:
"""
Expand All @@ -335,8 +335,43 @@ Feature: Producing cds annotation view from a scaffold
locus_tag gene1
3 1 CDS
protein_id gene1
note val1
note val2
db_xref GO:000001
"""

@disable-bundler
Scenario: A CDS entry with multiple db_xref attributes
Given I successfully run `genomer init project`
And I cd to "project"
And I write to "assembly/scaffold.yml" with:
"""
---
- sequence:
source: contig1
"""
And I write to "assembly/sequence.fna" with:
"""
>contig1
AAAAATTTTTGGGGGCCCCC
"""
And I write to "assembly/annotations.gff" with:
"""
##gff-version 3
contig1 . gene 1 3 . - 1 ID=gene1;db_xref=GO:000001;db_xref=InterPro:IPR000111
"""
And I append to "Gemfile" with:
"""
gem 'genomer-plugin-view', :path => '../../../'
"""
When I run `genomer view table --identifier=genome --generate_encoded_features`
Then the exit status should be 0
And the output should contain:
"""
>Feature genome annotation_table
3 1 gene
locus_tag gene1
3 1 CDS
protein_id gene1
db_xref GO:000001
db_xref InterPro:IPR000111
"""
2 changes: 1 addition & 1 deletion lib/genomer-plugin-view/gff_record_helper.rb
Expand Up @@ -2,7 +2,7 @@

module GenomerPluginView::GffRecordHelper

DEFAULT_GFF_MAPPING = {'product' => 'product', 'Note' => 'note' }
DEFAULT_GFF_MAPPING = {'product' => 'product', 'Note' => 'note', 'db_xref' => 'db_xref'}

GFF_TO_TABLE = {
'gene' => {
Expand Down
4 changes: 4 additions & 0 deletions man/genomer-view.ronn
Expand Up @@ -99,6 +99,10 @@ section.
**product** attributes are present. See the next section for an explanation
of this.

* `db_xref`: Used to link the annotation to other database references. This
field is added to verbatim to generated output. Multiple entires of this
field may be used.

### OVERLAP BETWEEN NAME, PRODUCT AND FUNCTION FIELD

The genbank annotation table **product** fields may contain either a short four
Expand Down
1 change: 1 addition & 0 deletions spec/genomer-view-plugin/gff_record_helper_spec.rb
Expand Up @@ -216,6 +216,7 @@
['Note', 'note']],
:CDS => [
['ec_number', 'EC_number'],
['db_xref', 'db_xref'],
['function', 'function'],
['product', 'product'],
['Note', 'note'],
Expand Down
31 changes: 31 additions & 0 deletions spec/genomer-view-plugin/table_spec.rb
Expand Up @@ -306,6 +306,37 @@

end

describe "passed a gene with a single db_xref attribute" do

let(:attributes) do
{'db_xref' => 'InterPro:IPR000111'}
end

let(:annotations) do
[gene({:attributes => attributes})]
end

it "should not change attributes" do
subject.should have_identical_attributes cds({:attributes => attributes})
end

end

describe "passed a gene with multiple db_xref attribute" do

let(:attributes) do
{'db_xref' => 'InterPro:IPR000111','db_xref' => 'GO:000001'}
end

let(:annotations) do
[gene({:attributes => attributes})]
end

it "should not change attributes" do
subject.should have_identical_attributes cds({:attributes => attributes})
end

end
end

end

0 comments on commit ce1c73f

Please sign in to comment.