예제 #1
0
        /// <summary>
        /// Constructs a Mismatcher object to compare against a refreence sequence.
        /// </summary>
        /// <param name="referenceSequence">The sequence against which query sequences will be compared,</param>
        public Mismatcher(ISequence referenceSequence)
        {
            if (referenceSequence == null)
            {
                throw new ArgumentNullException("referenceSequence");
            }

            this.mummer = new MUMmer.MUMmer(referenceSequence);
            this.ReferenceSequence = referenceSequence;
        }
예제 #2
0
파일: NUCmer.cs 프로젝트: cpatmoore/bio
        /// <summary>
        /// 
        /// </summary>
        /// <param name="suffixTree"></param>
        public NUCmer(ISuffixTree suffixTree)
        {
            if (suffixTree == null)
            {
                throw new ArgumentNullException("suffixTree");
            }

            // Mummer with the reference sequence.
            _internalMummer = new MUMmer.MUMmer(suffixTree);
            _internalReferenceSequence = _internalMummer.ReferenceSequence;

            SetDefaults();
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the NUCmer class.
        /// </summary>
        public NUCmer(ISequence referenceSequence)
        {
            if (referenceSequence == null)
            {
                throw new ArgumentNullException("referenceSequence");
            }

            // Mummer with the reference sequence.
            _internalMummer            = new MUMmer.MUMmer(referenceSequence);
            _internalReferenceSequence = referenceSequence;

            SetDefaults();
        }
예제 #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="suffixTree"></param>
        public NUCmer(ISuffixTree suffixTree)
        {
            if (suffixTree == null)
            {
                throw new ArgumentNullException("suffixTree");
            }

            // Mummer with the reference sequence.
            _internalMummer            = new MUMmer.MUMmer(suffixTree);
            _internalReferenceSequence = _internalMummer.ReferenceSequence;

            SetDefaults();
        }
예제 #5
0
파일: NUCmer.cs 프로젝트: cpatmoore/bio
        /// <summary>
        /// Initializes a new instance of the NUCmer class.
        /// </summary>
        public NUCmer(ISequence referenceSequence)
        {
            if (referenceSequence == null)
            {
                throw new ArgumentNullException("referenceSequence");
            }

            // Mummer with the reference sequence.
            _internalMummer = new MUMmer.MUMmer(referenceSequence);
            _internalReferenceSequence = referenceSequence;

            SetDefaults();
        }
예제 #6
0
        /// <summary>
        /// Generates Delta Alignments.
        /// </summary>
        /// <param name="referenceSequences">Enumerable of Reference Sequences.</param>
        /// <param name="querySequences">Enumerable of Query Sequences.</param>
        /// <param name="isUniqueInReference">Whether MUMs are unique in query or not.</param>
        /// <returns>List of enumerable of delta alignments.</returns>
        public List <IEnumerable <DeltaAlignment> > GetDeltaAlignments(
            IEnumerable <ISequence> referenceSequences,
            IEnumerable <ISequence> querySequences,
            bool isUniqueInReference = true)
        {
            internalReferenceSequence = referenceSequences.ElementAt(0);
            List <IEnumerable <DeltaAlignment> > result = new List <IEnumerable <DeltaAlignment> >();

            if (1 > LengthOfMUM)
            {
                string message = Properties.Resource.MUMLengthTooSmall;
                Trace.Report(message);
                throw new ArgumentException(message);
            }

            // Step:1 concat all the sequences into one sequence
            if (referenceSequences.Count() > 1)
            {
                internalReferenceSequence = ConcatSequence(referenceSequences);
            }

            Sequence seq = internalReferenceSequence as Sequence;

            if (seq == null)
            {
                throw new ArgumentException(Properties.Resource.OnlySequenceClassSupported);
            }

            long referenceSequenceCount = seq.Count;

            // Mummer for performaing step 3
            MUMmer.MUMmer internalMummer = new MUMmer.MUMmer(seq)
            {
                LengthOfMUM = LengthOfMUM
            };

            foreach (ISequence sequence in querySequences)
            {
                if (sequence.Equals(internalReferenceSequence))
                {
                    continue;
                }

                // Step3 : streaming process is performed with the query sequence

                IEnumerable <Match> matches;
                if (isUniqueInReference)
                {
                    matches = internalMummer.GetMatchesUniqueInReference(sequence);
                }
                else
                {
                    matches = internalMummer.GetMatches(sequence);
                }

                // Convert matches to matchextensions
                internalMumList = new List <MatchExtension>();
                long mumOrder = 1;
                foreach (Match currentMatch in matches)
                {
                    internalMumList.Add(new MatchExtension(currentMatch)
                    {
                        ReferenceSequenceMumOrder = mumOrder,
                        QuerySequenceMumOrder     = mumOrder,
                        Query = sequence
                    });
                }

                if (internalMumList.Count > 0)
                {
                    // Step 5 : Get the list of Clusters
                    internalClusterList = GetClusters(internalMumList);

                    // Step 7: Process Clusters and get delta
                    result.Add(ProcessCluster(
                                   referenceSequences,
                                   internalClusterList, referenceSequenceCount));
                }
            }

            return(result);
        }