Esempio n. 1
0
        /// <summary>
        /// Method to merge higher-indexed item with new constructed contig.
        /// Merges consumed contig with new contig. For each sequence in consumed contig,
        /// compute sequence and offset to be added to new contig.
        /// </summary>
        /// <param name="newContig">New contig for merging</param>
        /// <param name="globalBest">Best Score, consensus, their offsets</param>
        /// <param name="consumedContig">Consumed Contig to be merged</param>
        private static void MergeHigherIndexedContig(Contig newContig, ItemScore globalBest, Contig consumedContig)
        {
            foreach (Contig.AssembledSequence aseq in consumedContig.Sequences)
            {
                Contig.AssembledSequence newASeq = new Contig.AssembledSequence();

                // as the higher-index item, this contig is never reversed or complemented, so:
                newASeq.IsReversed     = aseq.IsReversed;
                newASeq.IsComplemented = aseq.IsComplemented;

                // position in the new contig adjusted by alignment of the merged items.
                newASeq.Position = globalBest.SecondOffset + aseq.Position;
                newASeq.Sequence = SequenceWithoutTerminalGaps(aseq.Sequence);

                newContig.Sequences.Add(newASeq);
                if (Trace.Want(Trace.AssemblyDetails))
                {
                    ApplicationLog.WriteLine(
                        "\tseq (rev = {0} comp = {1} pos = {2}) {3}",
                        newASeq.IsReversed,
                        newASeq.IsComplemented,
                        newASeq.Position,
                        newASeq.Sequence);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Method to merge higher-indexed item with new constructed contig.
        /// Merges consumed sequence with new contig. For the consumed sequence,
        /// compute new sequence and offset to be added to new contig.
        /// </summary>
        /// <param name="newContig">New contig for merging</param>
        /// <param name="globalBest">Best Score, consensus, their offsets</param>
        /// <param name="consumedSequence">Consumed Sequence to be merged</param>
        private static void MergeHigherIndexedSequence(Contig newContig, ItemScore globalBest, ISequence consumedSequence)
        {
            Contig.AssembledSequence newASeq = new Contig.AssembledSequence();

            // as the higher-index item, this sequence is never reversed or complemented, so:
            newASeq.IsReversed     = false;
            newASeq.IsComplemented = false;
            newASeq.Position       = globalBest.SecondOffset;
            newASeq.Sequence       = SequenceWithoutTerminalGaps(consumedSequence);

            newContig.Sequences.Add(newASeq);
            if (Trace.Want(Trace.AssemblyDetails))
            {
                ApplicationLog.WriteLine(
                    "seq (rev = {0} comp = {1} pos = {2}) {3}",
                    newASeq.IsReversed,
                    newASeq.IsComplemented,
                    newASeq.Position,
                    newASeq.Sequence);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Method to merge lower-indexed item with new constructed contig
        /// Merges consumed sequence with new contig. For the consumed sequence,
        /// compute new sequence and offset to be added to new contig.
        /// </summary>
        /// <param name="newContig">New contig for merging</param>
        /// <param name="globalBest">Best Score, consensus, their offsets</param>
        /// <param name="consumedSequence">Consumed Sequence to be merged</param>
        private static void MergeLowerIndexedSequence(Contig newContig, ItemScore globalBest, ISequence consumedSequence)
        {
            Contig.AssembledSequence newASeq = new Contig.AssembledSequence();

            // lower-indexed item might be reversed or complemented.
            // Retreive information from globalBest
            newASeq.IsReversed     = globalBest.Reversed;
            newASeq.IsComplemented = globalBest.Complemented;
            newASeq.Position       = globalBest.FirstOffset;
            newASeq.Sequence       = SequenceWithoutTerminalGaps(consumedSequence);

            newContig.Sequences.Add(newASeq);
            if (Trace.Want(Trace.AssemblyDetails))
            {
                ApplicationLog.WriteLine(
                    "seq (rev = {0} comp = {1} pos = {2}) {3}",
                    newASeq.IsReversed,
                    newASeq.IsComplemented,
                    newASeq.Position,
                    newASeq.Sequence);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Method to merge lower-indexed item with new constructed contig.
        /// Merges consumed contig with new contig. For each sequence in consumed contig,
        /// compute sequence and offset to be added to new contig.
        /// </summary>
        /// <param name="newContig">New contig for merging</param>
        /// <param name="globalBest">Best Score along with offsets information</param>
        /// <param name="consumedContig">Contig to be merged</param>
        private static void MergeLowerIndexedContig(Contig newContig, ItemScore globalBest, Contig consumedContig)
        {
            foreach (Contig.AssembledSequence aseq in consumedContig.Sequences)
            {
                Contig.AssembledSequence newASeq = new Contig.AssembledSequence();

                // lower-indexed item might be reversed or complemented.
                // Construct new sequence based on setting in globalBest
                // reverse of reverse, or comp of comp, equals no-op. So use xor
                newASeq.IsReversed     = aseq.IsReversed ^ globalBest.Reversed;
                newASeq.IsComplemented = aseq.IsComplemented ^ globalBest.Complemented;

                // position in the new contig is adjusted by alignment of the merged items.
                // this depends on whether the contig is reverse-aligned.
                if (globalBest.Reversed)
                {
                    int rightOffset = consumedContig.Length - (aseq.Sequence.Count + aseq.Position);
                    newASeq.Position = globalBest.FirstOffset + rightOffset;
                }
                else
                {
                    newASeq.Position = globalBest.FirstOffset + aseq.Position;
                }

                newASeq.Sequence = SequenceWithoutTerminalGaps(aseq.Sequence);
                newContig.Sequences.Add(newASeq);
                if (Trace.Want(Trace.AssemblyDetails))
                {
                    ApplicationLog.WriteLine(
                        "\tseq (rev = {0} comp = {1} pos = {2}) {3}",
                        newASeq.IsReversed,
                        newASeq.IsComplemented,
                        newASeq.Position,
                        newASeq.Sequence);
                }
            }
        }