Skip to content

Commit eefd947

Browse files
committed
First codebase release
1 parent 5719d3f commit eefd947

File tree

11 files changed

+453
-1
lines changed

11 files changed

+453
-1
lines changed

.github/workflows/build.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: build
2+
on: [push, pull_request]
3+
jobs:
4+
publish:
5+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
6+
runs-on: ubuntu-latest
7+
name: Release new version
8+
steps:
9+
- uses: actions/checkout@v4
10+
with:
11+
submodules: 'recursive'
12+
- name: Check release candidates
13+
id: release
14+
run: |
15+
gem_version="$(ruby -r rubygems -e \
16+
"puts Gem::Specification::load('$(ls *.gemspec)').version")"
17+
unset STABLE
18+
[[ "$gem_version" == *.rc* ]] || STABLE='true'
19+
echo "STABLE=${STABLE}" >> $GITHUB_OUTPUT
20+
- name: Tag and deploy
21+
id: publish
22+
uses: discourse/publish-rubygems-action@v2
23+
if: steps.release.outputs.STABLE
24+
env:
25+
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
26+
GIT_EMAIL: bot@seqco.de
27+
GIT_NAME: Automated Release
28+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
*.swp
12
*.gem
23
*.rbc
34
/.config

README.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,30 @@
1-
# strain-code
1+
# StrainCode
2+
3+
A gem for parsing and formatting strain numbers
4+
from microbiological culture collections
5+
6+
## Installation
7+
8+
```bash
9+
gem install strain-code
10+
```
11+
12+
## Usage
13+
14+
```ruby
15+
require 'strain_code'
16+
17+
# Parse one or more numbers in a variety of formats
18+
str_no = StrainCode.parse <<STR_NO
19+
ATCC 33152 = CCUG 9568 = CIP 103854 ;
20+
DSM 25069 = DSM_7513 = JCM:7571;
21+
NBIMCC:8848 = NCTC 11192, Strain Philadelphia 1
22+
STR_NO
23+
24+
# Get the URLs to the entry in the corresponding catalogues
25+
str_no.map(&:url)
26+
27+
# Get the name and country of each catalogue (if available)
28+
str_no.map(&:catalogue).map { |i| [i.name, i.country_code] if i }
29+
```
30+

data/catalogues.yaml

Lines changed: 251 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,251 @@
1+
# List of catalogues following the scheme (all optional except `codes`):
2+
# - codes: (mandatory) Array of catalogue codes
3+
# - country_code: ISO 3166-1 two-letter country code
4+
# - name: Name of the culture collection, ideally using the spelling that
5+
# matches a catalogue code
6+
# - name_en: Name of the culture collection in English, if +name+ is spelled in
7+
# a different language
8+
# - organization: Name of the organization generating the catalogue. If a
9+
# well-known acronym exists, this field should start with this acronym
10+
# followed by colon (:) and the spelled-out name of the organization
11+
# - url: URL of the catalogue's main website
12+
# - url_pattern: URL pattern indicating how to form links to catalogue entries,
13+
# with "%s" indicating the non-code part of the culture number
14+
#
15+
# Additionally, fields starting with `_` are ignored in the basecode, and
16+
# notably include `_examples` (an array of strain numbers) and `_tested`
17+
# (the date in which the website was last tested)
18+
catalogues:
19+
- codes: [ ABB ]
20+
country_code: KR
21+
name: Asian Bacterial Bank
22+
organization: Samsung Biomedical Research Institute
23+
- codes: [ ACAM ]
24+
country_code: AU
25+
name: Australian Collection of Antarctic Microorganisms
26+
organization: University of Tasmania
27+
- codes: [ ACCC ]
28+
country_code: CN
29+
name: Agricultural Culture Collection of China
30+
organization: Chinese Academy of Agricultural Sciences
31+
- codes: [ ACM, UQM ]
32+
country_code: AU
33+
name: Australian Collection of Microorganisms
34+
organization: The University of Queensland
35+
- codes: [ AHN ]
36+
country_code: FI
37+
name: Anaerobe Reference Laboratory, Helsinki Collection
38+
- codes: [ AHU ]
39+
country_code: JP
40+
name: |
41+
Laboratory of Culture Collection of Microorganisms,
42+
Faculty of Agriculture, Hokkaido University
43+
organization: Hokkaido University
44+
- codes: [ AJ ]
45+
country_code: JP
46+
name: Central Research Laboratories, Ajinomoto Co. Inc.
47+
organization: Ajinomoto Co. Inc.
48+
- codes: [ AKU ]
49+
country_code: JP
50+
name: Faculty of Agriculture, Kyoto University
51+
organization: Kyoto University
52+
- codes: [ AMP ]
53+
country_code: AU
54+
name: Australian Mycological Panel
55+
- codes: [ ANMR ]
56+
name: Asian Network on Microbial Researches
57+
- codes: [ ATCC ]
58+
country_code: US
59+
name: American Type Culture Collection
60+
url: 'https://www.atcc.org'
61+
url_pattern: 'https://www.atcc.org/products/%s'
62+
- codes: [ DSM ]
63+
country_code: DE
64+
name: Deutsche Sammlung von Mikroorganismen und Zellkulturen
65+
name_en: German Collection of Microorganisms and Cell Cultures
66+
organization: |
67+
Leibniz Institute DSMZ - German Collection of Microorganisms and
68+
Cell Cultures GmbH
69+
url: 'https://www.dsmz.de/collection/catalogue'
70+
url_pattern:
71+
'https://www.dsmz.de/collection/catalogue/details/culture/DSM-%s'
72+
- codes: [ IFO, NBRC ]
73+
country_code: JP
74+
name: 'NITE Biological Resource Center'
75+
organization: 'NITE: National Institute of Technology and Evaluation'
76+
url: 'https://www.nite.go.jp/nbrc/catalogue/'
77+
url_pattern:
78+
'https://www.nite.go.jp/nbrc/catalogue/NBRCCatalogueDetailServlet?ID=IFO&CAT=%s'
79+
- codes: [ JCM ]
80+
country_code: JP
81+
name: 'Japan Collection of Microorganisms'
82+
organization: RIKEN
83+
url: 'https://jcm.brc.riken.jp/en/'
84+
url_pattern: 'https://www.jcm.riken.jp/cgi-bin/jcm/jcm_number?JCM=%s'
85+
- codes: [ KCTC ]
86+
country_code: KR
87+
name: Korean Collection for Type Cultures
88+
organization:
89+
'KRIBB: Korea Research Institute of Bioscience and Biotechnology'
90+
url: 'https://kctc.kribb.re.kr/en/collection/'
91+
url_pattern: 'https://kctc.kribb.re.kr/collection/view?sn=%s'
92+
_examples: [ KCTC 92132 ]
93+
_tested: 2025-03-18
94+
- codes: [ NCTC ]
95+
country_code: UK
96+
name: National Collection of Type Cultures
97+
organization: Health Security Agency
98+
url: 'https://www.culturecollections.org.uk/products/bacteria-and-mycoplasmas/'
99+
url_pattern:
100+
'https://www.culturecollections.org.uk/products/bacteria/detail.jsp?collection=nctc&refId=NCTC+%s'
101+
- codes: [ BCRC ]
102+
country_code: TW
103+
name: Bioresource Collection and Research Center
104+
organization: Food Industry Research and Development Insitute
105+
url: 'https://catalog.bcrc.firdi.org.tw/'
106+
url_pattern: 'https://catalog.bcrc.firdi.org.tw/BcrcContent?bid=%s'
107+
- codes: [ CAIM ]
108+
country_code: MX
109+
name: Collection of Aquatic Important Microorganisms
110+
organization: 'CIAD: Centro de Investigación en Alimentación y Desarrollo'
111+
url: 'https://www.ciad.mx/caim'
112+
url_pattern:
113+
'https://www.ciad.mx/caim/busqueda.php?searchtype=caim&criterio=%s'
114+
- codes: [ CCALA ]
115+
name: Culture Collection of Autotrophic Organisms
116+
organization: Czech Academy of Sciences
117+
country_code: CZ
118+
url_pattern: 'https://ccala.butbn.cas.cz/strain/%s'
119+
- codes: [ CCM ]
120+
name: Czech Collection of Microorganisms
121+
organization: Masaryk University
122+
country_code: CZ
123+
url_pattern: 'https://www.sci.muni.cz/ccm/bakterie/camb/%s'
124+
- codes: [ CGMCC, AS ]
125+
name: China General Microbiological Culture Collection Center
126+
organization: National Science and Technology Infrastructure
127+
country_code: CN
128+
url_pattern: 'https://cgmcc.net/english/search?stn=%s'
129+
# From NCBI Taxonomy (not working):
130+
# 'http://www.cgmcc.net/english/cata.php?stn=CGMCC%%20%s'
131+
_examples: [ CGMCC 1.19149 ]
132+
_tested: 2025-03-18
133+
- codes: [ CCMP ]
134+
name: |
135+
NCMA: National Center for Marine Algae and Microbiota,
136+
formerly Culture Collection for Marine Phytoplankton
137+
organization: Bigelow Laboratory for Ocean Sciences
138+
country_code: US
139+
url_pattern: 'https://ncma.bigelow.org/CCMP%s'
140+
- codes: [ CCUG ]
141+
name: Culture Collection University of Gothenburg
142+
organization: University of Gothenburg
143+
country_code: SE
144+
url_pattern: 'https://www.ccug.se/strain?id=%s'
145+
- codes: [ CICC ]
146+
name: China Center of Industrial Culture Collection
147+
organization:
148+
China National Research Institute of Food & Fermentation Industries
149+
country_code: CN
150+
url_pattern: 'http://www.china-cicc.org/search/?classtype=1&keyword=%s'
151+
- codes: [ CIP ]
152+
name: Collection de l'Institut Pasteur
153+
name_en: Collection of the Institut Pasteur
154+
organization: Institut Pasteur
155+
country_code: FR
156+
url_pattern:
157+
'https://catalogue-crbip.pasteur.fr/fiche_catalogue.xhtml?crbip=CIP%%20%s'
158+
- codes: [ GDMCC ]
159+
country_code: CN
160+
name: Guangdong Microbial Culture Collection Center
161+
organization: Guangdong Academy of Sciences
162+
url:
163+
'http://english.gdim.cn/research/researchdivisions/guangdongmicrobialculturecollectioncentergdmcc/'
164+
- codes: [ ITM ]
165+
name: |
166+
Belgian Coordinated Collections of Microorganisms (BCCM),
167+
Institute of Tropical Medicine Antwerp Mycobacteria Collection
168+
organization: 'BELSPO: Belgian Science Policy'
169+
country_code: BE
170+
url_pattern:
171+
'https://bccm.belspo.be/catalogues/bm-details?accession_number=ITM%%20%s'
172+
- codes: [ JMRC ]
173+
name: Jena Microbial Resource Collection
174+
organization: Friedrich Schiller University Jena
175+
country_name: DE
176+
url_pattern: 'http://www.jmrc.uni-jena.de/data.php?fsu=%s'
177+
- codes: [ KACC ]
178+
name: Korean Agricultural Culture Collection
179+
organization: National Academy of Agricultural Science
180+
country_code: KR
181+
url_pattern:
182+
'https://genebank.rda.go.kr/eng/mic/cat/MicrobeSearch.do?sSearchWith=no&sTxt1=%s'
183+
- codes: [ LMG ]
184+
name: |
185+
Belgian Coordinated Collections of Microorganisms (BCCM),
186+
Bacteria Collection Laboratorium voor Microbiologie Universiteit Gent
187+
name_en: |
188+
Belgian Coordinated Collections of Microorganisms (BCCM),
189+
Bacteria Collection Laboratory of Microbiology, University of Ghent
190+
organization: 'BELSPO: Belgian Science Policy'
191+
country_code: BE
192+
url_pattern: 'https://bccm.belspo.be/catalogues/lmg-strain-details?NUM=%s'
193+
- codes: [ MCCC ]
194+
name: Marine Culture Collection of China
195+
organization: Third Institute of Oceanography
196+
country_code: CN
197+
url_pattern: 'https://mccc.org.cn/detailRecord3.asp?bcbh=%s'
198+
- codes: [ NEPCC ]
199+
name: North East Pacific Culture Collection
200+
organization: The University of British Columbia
201+
country_code: CA
202+
url_pattern: 'https://db.botany.ubc.ca/cccm/mfa/%s'
203+
- codes: [ NIES ]
204+
name: National Institute for Environmental Studies Collection
205+
organization: National Institute for Environmental Studies
206+
country_code: JP
207+
url_pattern: 'https://mcc.nies.go.jp/numberSearch.do?strainNumber=%s'
208+
- codes: [ NRRL ]
209+
name: |
210+
Agricultural Research Service Culture Collection,
211+
formerly Northern Regional Research Laboratory
212+
organization: National Center for Agricultural Utilization Research
213+
country_code: US
214+
url_pattern:
215+
'https://nrrl.ncaur.usda.gov/cgi-bin/usda/prokaryote/report.html?nrrlcodes=%s'
216+
- codes: [ PCC ]
217+
name: Pasteur Cultures of Cyanobacteria
218+
organization: Institut Pasteur
219+
country_code: FR
220+
url_pattern:
221+
'https://catalogue-crbip.pasteur.fr/fiche_catalogue.xhtml?crbip=PCC%%20%s'
222+
- codes: [ SAG ]
223+
name: Sammlung von Algenkulturen
224+
name_en: Culture Collection of Algae
225+
organization: University of Göttingen
226+
country_code: DE
227+
url_pattern:
228+
'https://sagdb.uni-goettingen.de/detailedList.php?str_number=%s'
229+
- codes: [ TBRC ]
230+
name: Thailand Bioresource Research Center
231+
organization: Thailand Bioresource Research Center
232+
country_code: TH
233+
url_pattern: 'https://tbrcnetwork.org/microb_detail.php?code=TBRC_%s'
234+
- codes: [ ULC ]
235+
name: |
236+
Belgian Coordinated Collections of Microorganisms (BCCM),
237+
University of Liège Cyanobacteria Collection
238+
organization: 'BELSPO: Belgian Science Policy'
239+
country_code: BE
240+
url_pattern:
241+
'https://bccm.belspo.be/catalogues/bm-details?accession_number=ULC%%20%s'
242+
- codes: [ VKM ]
243+
name: ВСЕРОССИЙСКАЯ КОЛЛЕКЦИЯ МИКРООРГАНИЗМОВ
244+
name_en: All-Russian Collection of Microorganisms
245+
organization: |
246+
Pushchino Scientific Center for Biological Research of the
247+
Russian Academy of Sciences
248+
country_code: RU
249+
url_pattern: 'http://www.vkm.ru/strains.php?vkm=%s'
250+
manifest:
251+
update: 2025-03-18

lib/strain_code.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
require 'strain_code/common'
2+
require 'strain_code/parser'
3+
#require 'strain_code/styler'

lib/strain_code/catalogue.rb

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
class StrainCode::Catalogue
3+
class << self
4+
def catalogues_path
5+
File.join(StrainCode.data_path, 'catalogues.yaml')
6+
end
7+
8+
def catalogues_source
9+
@catalogues_source ||= YAML.load_file(
10+
catalogues_path,
11+
permitted_classes: [OpenStruct, Symbol, Date]
12+
)
13+
end
14+
15+
def catalogue_hash(code)
16+
hsh = catalogues_source['catalogues'].find do |i|
17+
i['codes'].include? code.to_s.upcase
18+
end
19+
end
20+
21+
def catalogue(code)
22+
hsh = catalogue_hash(code)
23+
new(hsh) if hsh
24+
end
25+
end
26+
27+
attr_accessor :codes, :country_code, :name, :name_en, :organization
28+
attr_accessor :url, :url_pattern
29+
30+
def initialize(code)
31+
code = self.class.catalogue_hash(code) unless code.is_a?(Hash)
32+
code.each { |k, v| self.send("#{k}=", v) unless k =~ /^_/ } if code
33+
end
34+
end

lib/strain_code/common.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
require 'yaml'
2+
require 'ostruct'
3+
require 'strain_code/version'
4+
require 'strain_code/catalogue'
5+
6+
class StrainCode
7+
class << self
8+
def root_path
9+
File.expand_path('../../..', __FILE__)
10+
end
11+
12+
def data_path
13+
File.join(root_path, 'data')
14+
end
15+
end
16+
end

0 commit comments

Comments
 (0)