Exemple #1
0
 /// <summary>
 /// Private constructor for clone method.
 /// </summary>
 /// <param name="other">Other CodingSequence instance.</param>
 private CodingSequence(CodingSequence other)
     : base(other) { }
Exemple #2
0
 /// <summary>
 /// Private constructor for clone method.
 /// </summary>
 /// <param name="other">Other CodingSequence instance.</param>
 private CodingSequence(CodingSequence other)
     : base(other)
 {
 }
        /// <summary>
        ///     Validate GenBank CDS features
        /// </summary>
        /// <param name="nodeName">XML node name</param>
        /// <param name="genMetadata">GenBank Metadata</param>
        private void ValidateGenBankCDSFeatures(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 expectedInference = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.InferenceNode);
            string expectedLabel = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.LabelNode);
            string expectedNote = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.Note);
            string expectedMap = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.GenbankMapNode);
            string expectedTranslation = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.GenbankTranslationNode);
            string expectedCodonStart = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.CodonStartNode);

            List<CodingSequence> codingSequenceFeatureList =
                genMetadata.Features.CodingSequences;
            var locBuilder = new LocationBuilder();

            // Create a copy of Coding Seq Region feature.
            CodingSequence cloneCDS = codingSequenceFeatureList[0].Clone();

            // Validate Unsure Seq Region qualifiers.
            Assert.AreEqual(codingSequenceFeatureList.Count.ToString((IFormatProvider) null),
                            featureCount);
            Assert.AreEqual(cloneCDS.DatabaseCrossReference[0],
                            expectedDbReference);
            Assert.AreEqual(cloneCDS.GeneSymbol, geneSymbol);
            Assert.AreEqual(codingSequenceFeatureList[0].Allele,
                            expectedAllele);
            Assert.AreEqual(codingSequenceFeatureList[0].Citation[0],
                            expectedCitation);
            Assert.AreEqual(codingSequenceFeatureList[0].Experiment[0],
                            expectedExperiment);
            Assert.AreEqual(codingSequenceFeatureList[0].GenomicMapPosition,
                            expectedMap);
            Assert.AreEqual(codingSequenceFeatureList[0].Inference[0],
                            expectedInference);
            Assert.AreEqual(codingSequenceFeatureList[0].Label,
                            expectedLabel);
            Assert.AreEqual(locBuilder.GetLocationString(
                genMetadata.Features.CodingSequences[0].Location),
                            expectedLocation);
            Assert.AreEqual(codingSequenceFeatureList[0].Note[0],
                            expectedNote);
            Assert.AreEqual(codingSequenceFeatureList[0].GenomicMapPosition,
                            expectedMap);
            Assert.AreEqual(codingSequenceFeatureList[0].CodonStart[0],
                            expectedCodonStart);
            Assert.AreEqual(codingSequenceFeatureList[0].Translation,
                            expectedTranslation);
            Assert.IsFalse(string.IsNullOrEmpty(codingSequenceFeatureList[0].Codon.ToString()));
            Assert.IsTrue(string.IsNullOrEmpty(codingSequenceFeatureList[0].EnzymeCommissionNumber));
            Assert.IsTrue(string.IsNullOrEmpty(codingSequenceFeatureList[0].Number));
            Assert.IsTrue(string.IsNullOrEmpty(codingSequenceFeatureList[0].Operon));
            Assert.IsFalse(codingSequenceFeatureList[0].Pseudo);
            Assert.IsFalse(codingSequenceFeatureList[0].RibosomalSlippage);
            Assert.IsTrue(string.IsNullOrEmpty(codingSequenceFeatureList[0].StandardName));
            Assert.IsFalse(string.IsNullOrEmpty(codingSequenceFeatureList[0].TranslationalExcept.ToString()));
            Assert.IsTrue(string.IsNullOrEmpty(codingSequenceFeatureList[0].TranslationTable));
            Assert.IsFalse(codingSequenceFeatureList[0].TransSplicing);
            Assert.IsTrue(string.IsNullOrEmpty(codingSequenceFeatureList[0].Exception));

            // Create a new CDS feature using constructor.
            var cds = new CodingSequence(expectedLocation);
            var cdsWithLoc = new CodingSequence(
                genMetadata.Features.CodingSequences[0].Location);
            Sequence seq = cds.GetTranslation();
            Assert.IsNotNull(seq);

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