Esempio n. 1
0
 /// <summary>
 /// Private constructor for clone method.
 /// </summary>
 /// <param name="other">Other MiscSignal instance.</param>
 private MiscSignal(MiscSignal other)
     : base(other) { }
Esempio n. 2
0
 /// <summary>
 /// Private constructor for clone method.
 /// </summary>
 /// <param name="other">Other MiscSignal instance.</param>
 private MiscSignal(MiscSignal other)
     : base(other)
 {
 }
        public void ValidateGenBankMiscSignalFeatureQualifiers()
        {
            // Get Values from XML node.
            string filePath = utilityObj.xmlUtil.GetTextValue(
                Constants.GenBankMiscSignalNode, Constants.FilePathNode);
            string miscSignalLocation = utilityObj.xmlUtil.GetTextValue(
                Constants.GenBankMiscSignalNode, Constants.Location);
            string featureCount = utilityObj.xmlUtil.GetTextValue(
                Constants.GenBankMiscSignalNode, Constants.QualifierCount);
            string geneSymbol = utilityObj.xmlUtil.GetTextValue(
                Constants.GenBankMiscSignalNode, Constants.GeneSymbol);
            string function = utilityObj.xmlUtil.GetTextValue(
                Constants.GenBankMiscSignalNode, Constants.FunctionNode);
            string dbReferenceNode = utilityObj.xmlUtil.GetTextValue(
                Constants.GenBankMiscSignalNode, Constants.DbReferenceNode);

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

                // Validate Minus35Signal feature all qualifiers.
                var metadata =
                    (GenBankMetadata) seqList.ElementAt(0).Metadata[Constants.GenBank];
                List<MiscSignal> miscSignalList = metadata.Features.MiscSignals;

                // Create a clone of MiscSignal feature feature.
                MiscSignal cloneMiscSignal = miscSignalList[0].Clone();
                Assert.AreEqual(miscSignalList.Count.ToString((IFormatProvider) null), featureCount);
                Assert.AreEqual(cloneMiscSignal.GeneSymbol, geneSymbol);
                Assert.AreEqual(cloneMiscSignal.DatabaseCrossReference[0], dbReferenceNode);
                Assert.IsTrue(string.IsNullOrEmpty(miscSignalList[0].Allele.ToString(null)));
                Assert.IsFalse(string.IsNullOrEmpty(miscSignalList[0].Citation.ToString()));
                Assert.IsFalse(string.IsNullOrEmpty(miscSignalList[0].Experiment.ToString()));
                Assert.IsTrue(string.IsNullOrEmpty(miscSignalList[0].GenomicMapPosition));
                Assert.IsFalse(string.IsNullOrEmpty(miscSignalList[0].GeneSynonym.ToString()));
                Assert.IsFalse(string.IsNullOrEmpty(miscSignalList[0].Inference.ToString()));
                Assert.IsTrue(string.IsNullOrEmpty(miscSignalList[0].Label));
                Assert.AreEqual(locBuilder.GetLocationString(
                    metadata.Features.MiscSignals[0].Location), miscSignalLocation);
                Assert.IsFalse(string.IsNullOrEmpty(miscSignalList[0].Note.ToString()));
                Assert.IsFalse(string.IsNullOrEmpty(miscSignalList[0].OldLocusTag.ToString()));
                Assert.IsFalse(string.IsNullOrEmpty(miscSignalList[0].LocusTag.ToString()));
                Assert.AreEqual(miscSignalList[0].Function[0], function);
                Assert.IsTrue(string.IsNullOrEmpty(miscSignalList[0].Operon.ToString(null)));

                // Create a new MiscSignal signal and validate the same.
                var miscSignal = new MiscSignal(miscSignalLocation);
                var miscSignalWithIloc = new MiscSignal(
                    metadata.Features.MiscSignals[0].Location);

                // Set qualifiers and validate them.
                miscSignal.GeneSymbol = geneSymbol;
                miscSignalWithIloc.GeneSymbol = geneSymbol;
                Assert.AreEqual(miscSignal.GeneSymbol, geneSymbol);
                Assert.AreEqual(miscSignalWithIloc.GeneSymbol, geneSymbol);

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