Mercurial > repos > brinkmanlab > make_unique_id
changeset 3:a2258ce2d58c draft
"planemo upload for repository https://github.com/brinkmanlab/galaxy-tools/tree/master/make_unique_id commit 08b7b36e1eba516e4d7eb97086baf7ec8d177c5d"
author | brinkmanlab |
---|---|
date | Mon, 15 Jun 2020 19:32:32 -0400 |
parents | c8bda09480ae |
children | f2656e644641 |
files | make_unique_id.py |
diffstat | 1 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/make_unique_id.py Mon Jun 15 19:04:53 2020 -0400 +++ b/make_unique_id.py Mon Jun 15 19:32:32 2020 -0400 @@ -29,14 +29,14 @@ ids = defaultdict(int) def makeUnique(seq): - newid = seq.id[:16] # Genbank has a max length for the id and sequence length number, truncate the sequence id if too long + seqlenlen = len(str(len(seq))) + newid = seq.id[:26 - seqlenlen] # Genbank has a max length for the id and sequence length number, truncate the sequence id if too long count = ids[newid] ids[newid] += 1 if count: suffix = "_" + str(count) - seqlenlen = len(str(len(seq))) - if len(newid) + len(suffix) + 1 + seqlenlen > 16: - newid = newid[:16 - seqlenlen - len(suffix)] + if len(newid) + len(suffix) + 1 + seqlenlen > 26: + newid = newid[:25 - seqlenlen - len(suffix)] newid += suffix seq.name += suffix @@ -47,6 +47,7 @@ seq.id = newid return seq + paths = iter(sys.argv[2:]) for input, output in zip(paths, paths): @@ -56,3 +57,4 @@ format ) +