예제 #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);
            }
예제 #2
0
 // ReSharper disable NonLocalizedString
 public static int GetStructSize(CacheFormatVersion formatVersion)
 {
     if (formatVersion >= CacheFormatVersion.Thirteen)
     {
         return(52);
     }
     if (formatVersion > CacheFormatVersion.Eight)
     {
         return(48);
     }
     else if (formatVersion > CacheFormatVersion.Five)
     {
         return(36);
     }
     else if (formatVersion > CacheFormatVersion.Four)
     {
         return(28);
     }
     else if (formatVersion > CacheFormatVersion.Three)
     {
         return(24);
     }
     else if (formatVersion > CacheFormatVersion.Two)
     {
         return(20);
     }
     else
     {
         return(12);
     }
 }
예제 #3
0
 private SkylineVersion(Func <String> getLabelFunc, String versionName, CacheFormatVersion cacheFormatVersion, DocumentFormat srmDocumentVersion)
 {
     _getLabelFunc        = getLabelFunc;
     InvariantVersionName = versionName;
     CacheFormatVersion   = cacheFormatVersion;
     SrmDocumentVersion   = srmDocumentVersion;
 }
예제 #4
0
파일: PanoramaUtil.cs 프로젝트: zrolfs/pwiz
        public ShareType DecideShareType(FolderInformation folderInfo, SrmDocument document)
        {
            ShareType shareType = ShareType.DEFAULT;

            var settings = document.Settings;

            Assume.IsTrue(document.IsLoaded);
            var cacheVersion = settings.HasResults ? settings.MeasuredResults.CacheVersion : null;

            if (!cacheVersion.HasValue)
            {
                // The document may not have any chromatogram data.
                return(shareType);
            }

            CacheFormatVersion supportedVersion = GetSupportedSkydVersion(folderInfo);

            if (supportedVersion >= cacheVersion.Value)
            {
                return(shareType);
            }
            var skylineVersion = SkylineVersion.SupportedForSharing().FirstOrDefault(ver => ver.CacheFormatVersion <= supportedVersion);

            if (skylineVersion == null)
            {
                throw new PanoramaServerException(string.Format(
                                                      Resources.PublishDocumentDlg_ServerSupportsSkydVersion_, (int)cacheVersion.Value));
            }
            return(shareType.ChangeSkylineVersion(skylineVersion));
        }
예제 #5
0
        public static CacheFormat FromVersion(CacheFormatVersion formatVersion)
        {
            if (formatVersion > CacheFormatVersion.CURRENT)
            {
                throw new NotSupportedException();
            }
            CacheFormatVersion versionRequired;

            if (formatVersion.CompareTo(CacheHeaderStruct.WithStructSizes) >= 0)
            {
                versionRequired = CacheHeaderStruct.WithStructSizes;
            }
            else
            {
                versionRequired = formatVersion;
            }
            return(new CacheFormat
            {
                FormatVersion = formatVersion,
                VersionRequired = versionRequired,
                ChromPeakSize = ChromPeak.GetStructSize(formatVersion),
                ChromTransitionSize = ChromTransition.GetStructSize(formatVersion),
                CachedFileSize = CachedFileHeaderStruct.GetStructSize(formatVersion),
                ChromGroupHeaderSize = ChromGroupHeaderInfo.GetStructSize(formatVersion)
            });
        }
예제 #6
0
 public static StructSerializer <CacheHeaderStruct> GetStructSerializer(CacheFormatVersion cacheFormatVersion)
 {
     return(new StructSerializer <CacheHeaderStruct>()
     {
         ItemSizeOnDisk = GetStructSize(cacheFormatVersion),
         PadFromStart = true
     });
 }
예제 #7
0
 public CacheHeaderStruct(CacheFormat cacheFormat) : this()
 {
     chromPeakSize        = cacheFormat.ChromPeakSize;
     chromTransitionSize  = cacheFormat.ChromTransitionSize;
     chromGroupHeaderSize = cacheFormat.ChromGroupHeaderSize;
     cachedFileSize       = cacheFormat.CachedFileSize;
     formatVersion        = cacheFormat.FormatVersion;
     versionRequired      = cacheFormat.VersionRequired;
 }
예제 #8
0
 public static int GetStructSize(CacheFormatVersion cacheFormatVersion)
 {
     if (cacheFormatVersion >= WithStructSizes)
     {
         return(Marshal.SizeOf <CacheHeaderStruct>());
     }
     if (cacheFormatVersion >= CacheFormatVersion.Nine)
     {
         return(Marshal.SizeOf <CacheHeaderStruct>() - (int)Marshal.OffsetOf <CacheHeaderStruct>(@"locationScanIds"));
     }
     if (cacheFormatVersion >= CacheFormatVersion.Five)
     {
         return(Marshal.SizeOf <CacheHeaderStruct>() - (int)Marshal.OffsetOf <CacheHeaderStruct>(@"numScoreTypes"));
     }
     return(Marshal.SizeOf <CacheHeaderStruct>() - (int)Marshal.OffsetOf <CacheHeaderStruct>(@"formatVersion"));
 }
예제 #9
0
 private SkylineVersion(Func <String> getLabelFunc, String versionName, CacheFormatVersion cacheFormatVersion,
                        DocumentFormat srmDocumentVersion) : base(versionName, getLabelFunc)
 {
     CacheFormatVersion = cacheFormatVersion;
     SrmDocumentVersion = srmDocumentVersion;
 }