Class: Identifier::Global::GenBankAccessionCode
- Inherits:
-
Identifier::Global
- Object
- Identifier
- Identifier::Global
- Identifier::Global::GenBankAccessionCode
- Defined in:
- app/models/identifier/global/gen_bank_accession_code.rb
Overview
From NCBI-GenBank Flat File Release 220.0 at ftp://ftp.ncbi.nih.gov/genbank/gbrel.txt section 3.4.6 ACCESSION format There are 2 formats, one format with 1 upper case letter followed by 5 numbers and another format with 2 upper case letters followed by 6 numbers Format 1: A12345 Format 2: AB123456 For use with GenBank sequences
Constant Summary
Constants included from SoftValidation
SoftValidation::ANCESTORS_WITH_SOFT_VALIDATIONS
Instance Attribute Summary
Attributes inherited from Identifier::Global
Instance Method Summary collapse
Methods inherited from Identifier::Global
#build_cached, #dwc_occurrences, #is_global?, #sv_resolves?
Methods included from SoftValidation
#clear_soft_validations, #fix_for, #fix_soft_validations, #soft_fixed?, #soft_valid?, #soft_validate, #soft_validated?, #soft_validations, #soft_validators
Instance Method Details
#sequences_only ⇒ Object (private)
31 32 33 |
# File 'app/models/identifier/global/gen_bank_accession_code.rb', line 31 def sequences_only errors.add(:identifier_object_type, 'is not a Sequence') if identifier_object_type != 'Sequence' end |
#valid_gen_bank_accession_code ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/models/identifier/global/gen_bank_accession_code.rb', line 13 def valid_gen_bank_accession_code if identifier.present? matched = false if /\A[A-Z][A-Z][0-9]{6}\Z/.match(identifier) matched = true elsif /\A[A-Z][0-9]{5}\Z/.match(identifier) matched = true end if !matched errors.add(:identifier, 'invalid format') end end end |