Example #1
0
 /// <summary>
 /// Private constructor for clone method.
 /// </summary>
 /// <param name="other">Other Attenuator instance.</param>
 private Attenuator(Attenuator other)
     : base(other) { }
Example #2
0
 /// <summary>
 /// Private constructor for clone method.
 /// </summary>
 /// <param name="other">Other Attenuator instance.</param>
 private Attenuator(Attenuator other)
     : base(other)
 {
 }
        public void ValidateGenBankAttenuatorFeatureQualifiers()
        {
            // Get Values from XML node.
            string filePath = utilityObj.xmlUtil.GetTextValue(
                Constants.GenBankAttenuatorQualifiers, Constants.FilePathNode);
            string attenuatorLocation = utilityObj.xmlUtil.GetTextValue(
                Constants.GenBankAttenuatorQualifiers, Constants.Location);
            string featureCount = utilityObj.xmlUtil.GetTextValue(
                Constants.GenBankAttenuatorQualifiers, Constants.QualifierCount);

            // Parse a GenBank file.
            ISequenceParser parserObj = new GenBankParser();
            IEnumerable<ISequence> seqList = parserObj.Parse(filePath);
            var locBuilder = new LocationBuilder();

            var metadata =
                (GenBankMetadata) seqList.ElementAt(0).Metadata[Constants.GenBank];

            List<Attenuator> attenuatorList = metadata.Features.Attenuators;

            // Create a clone of attenuator feature.
            Attenuator attenuatorClone = attenuatorList[0].Clone();
            Assert.AreEqual(attenuatorList.Count.ToString((IFormatProvider) null), featureCount);
            Assert.IsTrue(string.IsNullOrEmpty(attenuatorList[0].GeneSymbol));
            Assert.IsFalse(string.IsNullOrEmpty(attenuatorClone.DatabaseCrossReference.ToString()));
            Assert.IsTrue(string.IsNullOrEmpty(attenuatorClone.Allele));
            Assert.IsFalse(string.IsNullOrEmpty(attenuatorList[0].ToString()));
            Assert.IsFalse(string.IsNullOrEmpty(attenuatorClone.Experiment.ToString()));
            Assert.IsTrue(string.IsNullOrEmpty(attenuatorList[0].GenomicMapPosition));
            Assert.IsFalse(string.IsNullOrEmpty(attenuatorList[0].GeneSynonym.ToString()));
            Assert.IsFalse(string.IsNullOrEmpty(attenuatorList[0].Inference.ToString()));
            Assert.IsTrue(string.IsNullOrEmpty(attenuatorList[0].Label));
            Assert.AreEqual(locBuilder.GetLocationString(
                metadata.Features.Attenuators[0].Location), attenuatorLocation);
            Assert.IsFalse(string.IsNullOrEmpty(attenuatorList[0].Note.ToString()));
            Assert.IsTrue(string.IsNullOrEmpty(attenuatorList[0].Operon));
            Assert.IsFalse(string.IsNullOrEmpty(attenuatorList[0].OldLocusTag.ToString()));
            Assert.IsFalse(string.IsNullOrEmpty(attenuatorList[0].Phenotype.ToString()));
            Assert.IsFalse(string.IsNullOrEmpty(attenuatorList[0].LocusTag.ToString()));
            Assert.IsFalse(string.IsNullOrEmpty(attenuatorList[0].OldLocusTag.ToString()));

            // Create a new Attenuator and validate the same.
            var attenuator = new Attenuator(attenuatorLocation);
            var attenuatorWithILoc = new Attenuator(
                metadata.Features.Attenuators[0].Location);

            // Set qualifiers and validate them.
            attenuator.Allele = attenuatorLocation;
            attenuator.GeneSymbol = string.Empty;
            attenuatorWithILoc.GenomicMapPosition = string.Empty;
            Assert.IsTrue(string.IsNullOrEmpty(attenuator.GeneSymbol));
            Assert.AreEqual(attenuator.Allele, attenuatorLocation);
            Assert.IsTrue(string.IsNullOrEmpty(attenuatorWithILoc.GenomicMapPosition));

            // Log VSTest GUI.
            ApplicationLog.WriteLine(
                "GenBank Features P1: Successfully validated the GenBank Features");
        }