• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ISequence类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ISequence的典型用法代码示例。如果您正苦于以下问题:C# ISequence类的具体用法?C# ISequence怎么用?C# ISequence使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ISequence类属于命名空间,在下文中一共展示了ISequence类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: FindMatch

        /// <summary>
        /// Find the matches for given searchStrings in sequence and returns
        /// the matched strings with indices found at.
        /// </summary>
        /// <param name="sequence">Input sequence.</param>
        /// <param name="searchPatterns">Strings to be searched.</param>
        /// <returns>Matches found in sequence.</returns>
        public IDictionary<string, IList<int>> FindMatch(ISequence sequence, IList<string> searchPatterns)
        {
            if (sequence == null)
            {
                throw new ArgumentNullException("sequence");
            }

            if (searchPatterns == null)
            {
                throw new ArgumentNullException("searchPatterns");
            }

            // Create tasks
            IList<Task<KeyValuePair<string, IList<int>>>> tasks = searchPatterns.Select(
                    searchString => Task<KeyValuePair<string, IList<int>>>.Factory.StartNew(
                            t => new KeyValuePair<string, IList<int>>(searchString, FindMatch(sequence, searchString)),
                            TaskCreationOptions.None)).ToList();

            // Wait for all the task
            Task.WaitAll(tasks.ToArray());

            IDictionary<string, IList<int>> results = new Dictionary<string, IList<int>>();
            foreach (Task<KeyValuePair<string, IList<int>>> task in tasks)
            {
                results.Add(task.Result.Key, task.Result.Value);
            }

            return results;
        }
开发者ID:cpatmoore,项目名称:bio,代码行数:36,代码来源:BoyerMoore.cs


示例2: WaitFor

        /// <summary>
        /// <see cref="IWaitStrategy.WaitFor"/>
        /// </summary>
        public long WaitFor(long sequence, Sequence cursor, ISequence dependentSequence, ISequenceBarrier barrier)
        {
            long startTime = 0;
            int counter = _spinTries;

            do
            {
                long availableSequence;
                if ((availableSequence = dependentSequence.Value) >= sequence)
                    return availableSequence;

                if (0 == --counter)
                {
                    if (0 == startTime)
                    {
                        startTime = GetSystemTimeTicks();
                    }
                    else
                    {
                        var timeDelta = GetSystemTimeTicks() - startTime;
                        if (timeDelta > _yieldTimeoutTicks)
                        {
                            return _fallbackStrategy.WaitFor(sequence, cursor, dependentSequence, barrier);
                        }

                        if (timeDelta > _spinTimeoutTicks)
                        {
                            Thread.Yield();
                        }
                    }
                    counter = _spinTries;
                }
            }
            while (true);
        }
开发者ID:disruptor-net,项目名称:Disruptor-net,代码行数:38,代码来源:PhasedBackoffWaitStrategy.cs


示例3: WaitFor

        /// <summary>
        /// <see cref="IWaitStrategy.WaitFor"/>
        /// </summary>
        public long WaitFor(long sequence, Sequence cursor, ISequence dependentSequence, ISequenceBarrier barrier)
        {
            var timeSpan = _timeout;
            if (cursor.Value < sequence)
            {
                lock (_gate)
                {
                    while (cursor.Value < sequence)
                    {
                        barrier.CheckAlert();
                        if (!Monitor.Wait(_gate, timeSpan))
                        {
                            throw TimeoutException.Instance;
                        }
                    }
                }
            }

            long availableSequence;
            while ((availableSequence = dependentSequence.Value) < sequence)
            {
                barrier.CheckAlert();
            }

            return availableSequence;
        }
开发者ID:disruptor-net,项目名称:Disruptor-net,代码行数:29,代码来源:TimeoutBlockingWaitStrategy.cs


示例4: RemoveSequence

        public static bool RemoveSequence(ref ISequence[] sequences, ISequence sequence)
        {
            int numToRemove;
            ISequence[] oldSequences;
            ISequence[] newSequences;

            do
            {
                oldSequences = Volatile.Read(ref sequences);

                numToRemove = CountMatching(oldSequences, sequence);

                if (numToRemove == 0)
                    break;

                var oldSize = oldSequences.Length;
                newSequences = new ISequence[oldSize - numToRemove];

                for (int i = 0, pos = 0; i < oldSize; i++)
                {
                    var testSequence = oldSequences[i];
                    if (sequence != testSequence)
                    {
                        newSequences[pos++] = testSequence;
                    }
                }
            }
            while (Interlocked.CompareExchange(ref sequences, newSequences, oldSequences) != oldSequences);

            return numToRemove != 0;
        }
开发者ID:disruptor-net,项目名称:Disruptor-net,代码行数:31,代码来源:SequenceGroups.cs


示例5: SequenceIDHeaderToRange

 /// <summary>
 /// Convert fasta sequence id to a string array
 /// </summary>
 public static string[,] SequenceIDHeaderToRange(ISequence sequence)
 {
     var formattedData = new string[1,2];
     formattedData[0, 0] = Properties.Resources.Sequence_ID;
     formattedData[0, 1] = (sequence != null) ? sequence.ID : "";
     return formattedData;
 }
开发者ID:cpatmoore,项目名称:bio,代码行数:10,代码来源:ExcelFormatter.cs


示例6: DeltaAlignment

 ///<summary>
 /// Initializes a new instance of the DeltaAlignment class
 /// </summary>
 /// <param name="referenceSequence">Reference Sequence</param>
 /// <param name="querySequence">Query Sequence</param>
 public DeltaAlignment(ISequence referenceSequence, ISequence querySequence)
 {
     this.internalDeltas = new List<long>();
     ReferenceSequence = referenceSequence;
     QuerySequence = querySequence;
     QueryDirection = Cluster.ForwardDirection;
 }
开发者ID:cpatmoore,项目名称:bio,代码行数:12,代码来源:DeltaAlignment.cs


示例7: AddSequences

        public static void AddSequences(ref ISequence[] sequences, ICursored cursor, params ISequence[] sequencesToAdd)
        {
            long cursorSequence;
            ISequence[] updatedSequences;
            ISequence[] currentSequences;

            do
            {
                currentSequences = Volatile.Read(ref sequences);
                updatedSequences = new ISequence[currentSequences.Length + sequencesToAdd.Length];
                Array.Copy(currentSequences, updatedSequences, currentSequences.Length);
                cursorSequence = cursor.Cursor;

                var index = currentSequences.Length;
                foreach (var sequence in sequencesToAdd)
                {
                    sequence.SetValue(cursorSequence);
                    updatedSequences[index++] = sequence;
                }
            }
            while (Interlocked.CompareExchange(ref sequences, updatedSequences, currentSequences) != currentSequences);

            cursorSequence = cursor.Cursor;
            foreach (var sequence in sequencesToAdd)
            {
                sequence.SetValue(cursorSequence);
            }
        }
开发者ID:disruptor-net,项目名称:Disruptor-net,代码行数:28,代码来源:SequenceGroups.cs


示例8: Transcribe

        /// <summary>
        /// Transcribes a DNA sequence into an RNA sequence. The length
        /// of the resulting sequence will equal the length of the source
        /// sequence. Gap and ambiguous characters will also be transcribed.
        /// For example:
        /// Sequence dna = new Sequence(Alphabets.DNA, "TACCGC");
        /// Sequence rna = Transcription.Transcribe(dna);
        /// rna.ToString() would produce "AUGGCG"
        /// </summary>
        /// <param name="dnaSource">The dna source sequence to be transcribed.</param>
        /// <returns>The transcribed RNA sequence.</returns>
        public static ISequence Transcribe(ISequence dnaSource)
        {
            if (dnaSource == null)
            {
                throw new ArgumentNullException("dnaSource");
            }

            if (dnaSource.Alphabet != Alphabets.DNA && dnaSource.Alphabet != Alphabets.AmbiguousDNA)
            {
                throw new InvalidOperationException(Properties.Resource.InvalidAlphabetType);
            }

            byte[] transcribedResult = new byte[dnaSource.Count];
            long counter = 0;

            foreach (byte n in dnaSource)
            {
                transcribedResult[counter] = GetRnaComplement(n);
                counter++;
            }

            var alphabet = dnaSource.Alphabet == Alphabets.DNA ? Alphabets.RNA : Alphabets.AmbiguousRNA;
            Sequence result = new Sequence(alphabet, transcribedResult);
            result.ID = "Complement: " + dnaSource.ID;

            return result;
        }
开发者ID:cpatmoore,项目名称:bio,代码行数:38,代码来源:Transcription.cs


示例9: _UseSequenceData

 private void _UseSequenceData(ISequence sequence)
 {
     if (!_persistPreFilterCache) {
         _intentPreFilter.ClearCache();
     }
     _intentPreFilter.Data = sequence.SequenceData.EffectData;
 }
开发者ID:stewmc,项目名称:vixen,代码行数:7,代码来源:PreFilteringBufferingDataSource.cs


示例10: ExportDialog

        public ExportDialog(ISequence sequence)
        {
            InitializeComponent();

            ForeColor = ThemeColorTable.ForeColor;
            BackColor = ThemeColorTable.BackgroundColor;
            ThemeUpdateControls.UpdateControls(this);
            Icon = Resources.Icon_Vixen3;

            _sequence = sequence;
            _exportOps = new Export();
            _exportOps.SequenceNotify += SequenceNotify;

            _sequenceFileName = _sequence.FilePath;

            IEnumerable<string> mediaFileNames =
                (from media in _sequence.SequenceData.Media
                 where media.GetType().ToString().Contains("Audio")
                 where media.MediaFilePath.Length != 0
                 select media.MediaFilePath);

            _audioFileName = "";
            if (mediaFileNames.Count() > 0)
            {
                _audioFileName = mediaFileNames.First();
            }

            exportProgressBar.Visible = false;
            currentTimeLabel.Visible = false;

            _cancelled = false;

            backgroundWorker1.DoWork += new DoWorkEventHandler(backgroundWorker1_DoWork);
            backgroundWorker1.ProgressChanged += new ProgressChangedEventHandler(backgroundWorker1_ProgressChanged);
        }
开发者ID:naztrain,项目名称:vixen,代码行数:35,代码来源:ExportDialog.cs


示例11: WaitFor

        /// <summary>
        /// <see cref="IWaitStrategy.WaitFor"/>.
        /// </summary>
        public long WaitFor(long sequence, Sequence cursor, ISequence dependentSequence, ISequenceBarrier barrier)
        {
            var milliseconds = _timeoutInMilliseconds;

            long availableSequence;
            if (cursor.Value < sequence)
            {
                lock (_lock)
                {
                    while (cursor.Value < sequence)
                    {
                        Interlocked.Exchange(ref _signalNeeded, 1);

                        barrier.CheckAlert();

                         if (!Monitor.Wait(_lock, milliseconds))
                        {
                            throw TimeoutException.Instance;
                        }
                    }
                }
            }

            while ((availableSequence = dependentSequence.Value) < sequence)
            {
                barrier.CheckAlert();
            }

            return availableSequence;
        }
开发者ID:disruptor-net,项目名称:Disruptor-net,代码行数:33,代码来源:LiteTimeoutBlockingWaitStrategy.cs


示例12: GetTypeMapping

 public virtual RelationalTypeMapping GetTypeMapping(ISequence sequence)
     => GetTypeMapping(
         /*specifiedType:*/ null,
         sequence.Name,
         sequence.Type,
         isKey: false,
         isConcurrencyToken: false);
开发者ID:aishaloshik,项目名称:EntityFramework,代码行数:7,代码来源:RelationalTypeMapper.cs


示例13: BuildKmerDictionary

        /// <summary>
        /// For input sequence, constructs k-mers by sliding 
        /// a frame of size kmerLength along the input sequence.
        /// Track positions of occurance for each kmer in sequence.
        /// Constructs KmersOfSequence for sequence and associated k-mers.
        /// </summary>
        /// <param name="sequence">Input sequence.</param>
        /// <param name="kmerLength">K-mer length.</param>
        /// <returns>KmersOfSequence constructed from sequence and associated k-mers.</returns>
        public static KmerPositionDictionary BuildKmerDictionary(ISequence sequence, int kmerLength)
        {
            if (sequence == null)
            {
                throw new ArgumentNullException("sequence");
            }

            if (kmerLength > sequence.Count)
            {
                throw new ArgumentException(Properties.Resource.KmerLengthIsTooLong);
            }

            // kmers maintains the map between k-mer strings to list of positions in sequence.
            KmerPositionDictionary kmers = new KmerPositionDictionary();

            // Sequence 'kmer' stores the k-mer in each window.
            // Construct each k-mer using range from sequence.
            for (long i = 0; i <= sequence.Count - kmerLength; ++i)
            {
                ISequence kmerString = sequence.GetSubSequence(i, kmerLength);
                if (kmers.ContainsKey(kmerString))
                {
                    kmers[kmerString].Add(i);
                }
                else
                {
                    kmers[kmerString] = new List<long>() { i };
                }
            }

            return kmers;
        }
开发者ID:cpatmoore,项目名称:bio,代码行数:41,代码来源:SequenceToKmerBuilder.cs


示例14: SequenceStartedEventArgs

 public SequenceStartedEventArgs(ISequence sequence, ITiming timingSource, TimeSpan startTime, TimeSpan endTime)
 {
     Sequence = sequence;
     TimingSource = timingSource;
     StartTime = startTime;
     EndTime = endTime;
 }
开发者ID:stewmc,项目名称:vixen,代码行数:7,代码来源:SequenceStartedEventArgs.cs


示例15: Construct

 /// <summary>
 /// Pre-optimized Construct constructor.
 /// </summary>
 /// <param name="fragList">Fragment list.</param>
 public Construct(List<Overlap> overlaps, ISequence sequence, DesignerSettings settings)
     : base()
 {
     this.Overlaps = overlaps;
     this.Sequence = sequence;
     this.Settings = settings;
 }
开发者ID:MelaniaNowicka,项目名称:MUFASA,代码行数:11,代码来源:Construct.cs


示例16: Synteny

 /// <summary>
 /// Initializes a new instance of the Synteny class
 /// </summary>
 /// <param name="referenceSequence">Reference sequence</param>
 /// <param name="querySequence">Query sequence</param>
 public Synteny(
         ISequence referenceSequence,
         ISequence querySequence)
 {
     internalReferenceSequence = referenceSequence;
     internalQuerySequence = querySequence;
     internalClusters = new List<Cluster>();
 }
开发者ID:cpatmoore,项目名称:bio,代码行数:13,代码来源:Synteny.cs


示例17: Save

        public void Save(ISequence sequence, string filePath)
        {
            if (sequence == null) throw new ArgumentNullException("sequence");
            if (string.IsNullOrWhiteSpace(filePath))
                throw new InvalidOperationException("File path must be a file name or path.");

            FileService.Instance.SaveSequenceFile(sequence, filePath);
        }
开发者ID:Jchuchla,项目名称:vixen,代码行数:8,代码来源:SequenceService.cs


示例18: Fragment

 /// <summary>
 /// Fragment constructor.
 /// </summary>
 /// <param name="source">Filename or URL.</param>
 /// <param name="name">Fragment name.</param>
 public Fragment(String source, String name, ISequence sequence, bool vector = false)
 {
     this.Source = source;
     this.Name = name;
     this.Sequence = sequence;
     this.Length = sequence.Count;
     this.IsVector = vector;
 }
开发者ID:MelaniaNowicka,项目名称:MUFASA,代码行数:13,代码来源:Fragment.cs


示例19: AlignSequences

        /// <summary>
        /// Method to align two sequences, this sample code uses NeedlemanWunschAligner.
        /// </summary>
        /// <param name="referenceSequence">Reference sequence for alignment</param>
        /// <param name="querySequence">Query sequence for alignment</param>
        /// <returns>List of IPairwiseSequenceAlignment</returns>
        public static IList<IPairwiseSequenceAlignment> AlignSequences(ISequence referenceSequence, ISequence querySequence)
        {
            // Initialize the Aligner
            NeedlemanWunschAligner aligner = new NeedlemanWunschAligner();

            // Calling align method to do the alignment.
            return aligner.Align(referenceSequence, querySequence);
        }
开发者ID:igemsoftware,项目名称:CBNU_KOREA_2012,代码行数:14,代码来源:BioUtilities.cs


示例20: EnumeratorSequence

 private EnumeratorSequence(IEnumerator enumerator, object first, ISequence rest, IPersistentMap metadata)
     : base(metadata)
 {
     this.enumerator = enumerator;
     this.first = first;
     this.rest = rest;
     this.restWasCalculated = true;
 }
开发者ID:ajlopez,项目名称:AjSharpure,代码行数:8,代码来源:EnumeratorSequence.cs



注:本文中的ISequence类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ISerializable类代码示例发布时间:2022-05-24
下一篇:
C# ISeq类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap