当前位置: 首页>>代码示例>>C#>>正文


C# ISequence类代码示例

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


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


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