Ejemplo n.º 1
0
            public ImmutableList <byte> GetNewTextId(ChromGroupHeaderInfo chromGroupHeaderInfo)
            {
                byte[] textIdBytes = _originalCache.GetTextIdBytes(chromGroupHeaderInfo.TextIdIndex, chromGroupHeaderInfo.TextIdLen);
                if (textIdBytes == null)
                {
                    return(null);
                }
                const CacheFormatVersion versionNewTextId = CacheFormatVersion.Thirteen;
                ImmutableList <byte>     newTextId;

                if (_originalCache.Version < versionNewTextId ||
                    _cacheFormat.FormatVersion >= versionNewTextId)
                {
                    newTextId = ImmutableList.ValueOf(textIdBytes);
                }
                else
                {
                    if (textIdBytes[0] == '#')
                    {
                        newTextId = ImmutableList.ValueOf(textIdBytes);
                    }
                    else
                    {
                        var oldKey = new PeptideLibraryKey(Encoding.UTF8.GetString(textIdBytes), 0);
                        var newKey = oldKey.FormatToOneDecimal();
                        newTextId = ImmutableList.ValueOf(Encoding.UTF8.GetBytes(newKey.ModifiedSequence));
                    }
                }
                return(newTextId);
            }