Esempio n. 1
0
        void TestAlign()
        {
            Alignment     x  = new Alignment();
            Macromolecule y1 = new Macromolecule();

            y1.Sequence   = "ACTGGGTAGA";
            y1.Name       = "TestSeq1";
            y1.identifier = 1;
            int[] y11 = new int[10] {
                0, 1, 2, 3, 4, 5, 6, 7, 8, 9
            };
            //Macromolecule y2 = new Macromolecule();
            //y2.Sequence = "CTGGTAG";
            //y2.Name = "TestSeq1";
            //y2.identifier = 1;
            //int[] y22 = new int[7] { 1, 2, 4, 5, 6, 7, 8 };

            x.AlignmentLength = 10; // Need to set up Alignment to do this automatically when a sequence is added.

            //x.AddAlignedMacromolecule(Tuple.Create(y1, y11));
            x.AddAlignedMacromolecule(new AlignedMacromolecule(y1, y11));
            //x.AddAlignedMacromolecule(Tuple.Create(y2, y22));

            //.NudgeSequences(new List<int>{1}, 6, 6, 4);

            DataContext = x;
        }
Esempio n. 2
0
 public AlignedMacromolecule(Macromolecule newMacromolecule, int[] newAlignedPositions)
     : base(newMacromolecule)
 {
     alignedPositions = newAlignedPositions;
     sequenceWeight   = 0;
     newGaps          = new List <int>();
 }
Esempio n. 3
0
        public AlignedMacromolecule(Macromolecule newMacromolecule)
            : base(newMacromolecule)
        {
            alignedPositions = new int[newMacromolecule.Sequence.Length];

            for (int i = 0; i < newMacromolecule.Sequence.Length; i++)
            {
                alignedPositions[i] = i;
            }

            sequenceWeight = 0;
        }
Esempio n. 4
0
        //internal void AddAlignedMacromolecule(Tuple<Macromolecule, int[]> newAlignedMacromolecule, bool doAdjustments = true)
        internal void AddAlignedMacromolecule(AlignedMacromolecule newAlignedMacromolecule, bool doAdjustments = true)
        // Provides an interface to add an aligned macromolecule to the list.
        // Adjust the name if it is not unique, adjust the alignmentLength, and add it to the list.
        {
            //Macromolecule newMacromolecule = newAlignedMacromolecule.Item1;
            Macromolecule newMacromolecule = newAlignedMacromolecule;

            // Rename the macromolecule if another with the same name is already loaded.
            // Appends a "1" if already exists; then if this new name matches another, add "2", etc.
            // Could lead to some weirdness if the loaded sequences were "seq1" "seq4" "seq4", which would
            // become "seq1", "seq4", "seq4 1", but this is tolerable.
            int nameInteger = 1;

            for (int i = 0; i < alignedMacromolecules.Count; i++)
            {
                //Macromolecule testMacromolecule = alignedMacromolecules[i].Item1;
                Macromolecule testMacromolecule = alignedMacromolecules[i];
                if (newMacromolecule.Name == testMacromolecule.Name) // same name
                {
                    newMacromolecule.Name += " " + nameInteger.ToString();
                    nameInteger++;
                }
            }

            alignedMacromolecules.Add(newAlignedMacromolecule);

            if (doAdjustments)
            { // Make into another sub so the Add routines can be synced?
                NormalizeAlignedPositions();
                CalculateAlignmentLength();
                NotifyPropertyChanged("AlignedMacromolecules");
                //isNucleicAcid = newAlignedMacromolecule.Item1.IsNucleicAcid;
                isNucleicAcid = newAlignedMacromolecule.IsNucleicAcid;
                NotifyPropertyChanged("IsNucleicAcid");
                RecalculateMaximumLength();
            }
        }
Esempio n. 5
0
 protected Macromolecule(Macromolecule newMacromolecule)
 {
     sequence      = newMacromolecule.Sequence;
     name          = newMacromolecule.Name;
     isNucleicAcid = newMacromolecule.IsNucleicAcid;
 }