Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
-
None
-
Operating System: other
Platform: Other
-
34254
Description
In order to generate identifiers for an instance of the Ensembl database [1], I needed a generator for
identifiers of the style ENSG000001, ENSG000002, ENST000001, ENST000002, ENSP000001, and so on.
Attached is a class PrefixedLeftPaddedNumericGenerator (sorry about the long class name) that solves
this use case and also PrefixedNumericGenerator and PrefixedAlphanumericGenerator for
completeness' sake.
new PrefixedLeftPaddedNumericGenerator("foo", true, 5); returns
foo01
foo02
foo03
foo04
foo05
foo06
foo07
foo08
foo09
foo10
foo11
new PrefixedNumericGenerator("foo", true, 0L) returns
foo1
foo2
foo3
foo4
foo5
foo6
foo7
foo8
foo9
foo10
foo11
new PrefixedAlphanumericGenerator("foo", true, 5); returns
foo01
foo02
foo03
foo04
foo05
foo06
foo07
foo08
foo09
foo0a
foo0b
[1]
> http://www.ensembl.org