Ejemplo n.º 1
0
 /// <summary>
 /// Private constructor for clone method.
 /// </summary>
 /// <param name="other">Other ModifiedBase instance.</param>
 private ModifiedBase(ModifiedBase other)
     : base(other) { }
Ejemplo n.º 2
0
 /// <summary>
 /// Private constructor for clone method.
 /// </summary>
 /// <param name="other">Other ModifiedBase instance.</param>
 private ModifiedBase(ModifiedBase other)
     : base(other)
 {
 }
Ejemplo n.º 3
0
        /// <summary>
        ///     Validate ModifiedBase features
        /// </summary>
        /// <param name="nodeName">XML node name</param>
        /// <param name="genMetadata">GenBank Metadata</param>
        private void ValidateGenBankModifiedBaseFeature(string nodeName,
                                                        GenBankMetadata genMetadata)
        {
            // Get Values from XML node.           
            string expectedLocation = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.Location);
            string expectedAllele = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.AlleleNode);
            string featureCount = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.QualifierCount);
            string expectedDbReference = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.DbReferenceNode);
            string geneSymbol = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.GeneSymbol);
            string expectedCitation = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.CitationNode);
            string expectedExperiment = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.ExperimentNode);
            string expectedGeneSynonym = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.GeneSynonymNode);
            string expectedInference = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.InferenceNode);
            string expectedLabel = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.LabelNode);
            string expectedLocusTag = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.LocusTagNode);
            string expectedNote = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.Note);
            string expectedOldLocusTag = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.OldLocusTagNode);
            string expectedMap = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.GenbankMapNode);

            List<ModifiedBase> modifiedBaseFeatureList =
                genMetadata.Features.ModifiedBases;
            var locBuilder = new LocationBuilder();

            // Create a copy of Modified base feature.
            ModifiedBase cloneModifiedBase = modifiedBaseFeatureList[0].Clone();

            // Validate Modified Base qualifiers.
            Assert.AreEqual(modifiedBaseFeatureList.Count.ToString((IFormatProvider) null),
                            featureCount);
            Assert.AreEqual(cloneModifiedBase.GeneSymbol,
                            geneSymbol);
            Assert.AreEqual(cloneModifiedBase.DatabaseCrossReference[0],
                            expectedDbReference);
            Assert.AreEqual(modifiedBaseFeatureList[0].Allele,
                            expectedAllele);
            Assert.AreEqual(modifiedBaseFeatureList[0].Citation[0],
                            expectedCitation);
            Assert.AreEqual(modifiedBaseFeatureList[0].Experiment[0],
                            expectedExperiment);
            Assert.AreEqual(modifiedBaseFeatureList[0].GenomicMapPosition,
                            expectedMap);
            Assert.AreEqual(modifiedBaseFeatureList[0].GeneSynonym[0],
                            expectedGeneSynonym);
            Assert.AreEqual(modifiedBaseFeatureList[0].Inference[0],
                            expectedInference);
            Assert.AreEqual(modifiedBaseFeatureList[0].Label,
                            expectedLabel);
            Assert.AreEqual(locBuilder.GetLocationString(
                genMetadata.Features.ModifiedBases[0].Location),
                            expectedLocation);
            Assert.AreEqual(modifiedBaseFeatureList[0].Note[0],
                            expectedNote);
            Assert.AreEqual(modifiedBaseFeatureList[0].OldLocusTag[0],
                            expectedOldLocusTag);
            Assert.AreEqual(modifiedBaseFeatureList[0].LocusTag[0],
                            expectedLocusTag);
            Assert.IsFalse(string.IsNullOrEmpty(modifiedBaseFeatureList[0].ModifiedNucleotideBase.ToString()));

            // Create a new ModifiedBase and validate the same.
            var modifiedBase = new ModifiedBase(expectedLocation);
            var modifiedBaseWithILoc = new ModifiedBase(
                genMetadata.Features.ModifiedBases[0].Location);

            // Set qualifiers and validate them.
            modifiedBase.Allele = expectedAllele;
            modifiedBase.GeneSymbol = geneSymbol;
            modifiedBaseWithILoc.GenomicMapPosition = expectedMap;
            Assert.AreEqual(modifiedBase.GeneSymbol, geneSymbol);
            Assert.AreEqual(modifiedBase.Allele, expectedAllele);
            Assert.AreEqual(modifiedBaseWithILoc.GenomicMapPosition,
                            expectedMap);
        }