Skip to content

Commit 3c9563b

Browse files
committed
Bio::EMBLDB::Common#references: don't drop RG (consortium name)
RG lines (reference group / consortium name, e.g. "International Human Genome Sequencing Consortium" and "Genome Reference Consortium", both real examples from human GRCh38 chromosome 1, accession CM000663) are common in large-scale genome assembly submissions, and increasingly so since 2013. #ref already captured RG into the raw reference Hash, but #references had no 'RG' branch, so the Bio::Reference built from it silently lost all authorship information whenever a reference was attributed to a consortium alone (authors ended up as an empty Array). Append the RG value to hash['authors'] (which 'RA' -- processed first, per the Hash key order in #ref -- has already set to an Array) so the consortium name is preserved instead of discarded.
1 parent c429e09 commit 3c9563b

2 files changed

Lines changed: 52 additions & 0 deletions

File tree

lib/bio/db/embl/common.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,16 @@ def references
311311
tag, xref = item.split(/\; /).map {|i| i.strip.sub(/\.\z/, '') }
312312
hash[ tag.downcase ] = xref
313313
}
314+
when 'RG'
315+
# RG (reference group / consortium name), e.g.
316+
# "International Human Genome Sequencing Consortium",
317+
# common in large-scale genome assembly submissions.
318+
# Note that 'RA' is always processed before 'RG' (see the
319+
# 'raw' Hash key order in #ref), so hash['authors'] is
320+
# already set to an Array at this point.
321+
unless value.to_s.strip.empty?
322+
hash['authors'].push value
323+
end
314324
end
315325
}
316326
Reference.new(hash)

test/unit/bio/db/embl/test_embl_new_part.rb

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,4 +118,46 @@ def test_co_absent
118118
assert_equal('', @obj.co)
119119
end
120120
end # class TestEMBL_CO_line_absent
121+
122+
class TestEMBL_RG_line < Test::Unit::TestCase
123+
def setup
124+
# Real example pattern (Homo sapiens chromosome 1, GRCh38,
125+
# accession CM000663): a reference authored solely by a
126+
# consortium (no RA line at all), and one with both individual
127+
# authors (RA) and a consortium name (RG).
128+
text = <<~THE_END_OF_THE_TEXT
129+
ID AB123456; SV 1; linear; genomic DNA; STD; PRO; 4 BP.
130+
XX
131+
AC AB123456;
132+
XX
133+
RN [1]
134+
RA Doe J., Roe R.;
135+
RG Example Genome Consortium
136+
RT ;
137+
RL Submitted (01-JAN-2020) to the INSDC.
138+
XX
139+
RN [2]
140+
RG Example Genome Consortium
141+
RT ;
142+
RL Submitted (01-JAN-2020) to the INSDC.
143+
XX
144+
SQ Sequence 4 BP; 1 A; 1 C; 1 G; 1 T; 0 other;
145+
acgt 4
146+
//
147+
THE_END_OF_THE_TEXT
148+
149+
@obj = Bio::EMBL.new(text)
150+
end
151+
152+
def test_references_authors_include_consortium_alongside_individuals
153+
# Regression test: RG (reference group/consortium name) used to
154+
# be silently dropped by Common#references.
155+
expected = ['Doe, J.', 'Roe, R.', 'Example Genome Consortium']
156+
assert_equal(expected, @obj.references[0].authors)
157+
end
158+
159+
def test_references_authors_is_consortium_only_when_no_ra
160+
assert_equal(['Example Genome Consortium'], @obj.references[1].authors)
161+
end
162+
end # class TestEMBL_RG_line
121163
end # module Bio

0 commit comments

Comments
 (0)