コード例 #1
0
ファイル: UnsureSequenceRegion.cs プロジェクト: cpatmoore/bio
 /// <summary>
 /// Private constructor for clone method.
 /// </summary>
 /// <param name="other">Other UnsureSequenceRegion instance.</param>
 private UnsureSequenceRegion(UnsureSequenceRegion other)
     : base(other) { }
コード例 #2
0
 /// <summary>
 /// Private constructor for clone method.
 /// </summary>
 /// <param name="other">Other UnsureSequenceRegion instance.</param>
 private UnsureSequenceRegion(UnsureSequenceRegion other)
     : base(other)
 {
 }
コード例 #3
0
        /// <summary>
        ///     Validate GenBank UnsureSequenceRegion features
        /// </summary>
        /// <param name="nodeName">XML node name</param>
        /// <param name="genMetadata">GenBank Metadata</param>
        private void ValidateGenBankUnsureSequenceRegion(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);

            List<UnsureSequenceRegion> unsureSeqRegionFeatureList =
                genMetadata.Features.UnsureSequenceRegions;

            // Create a copy of Unsure Seq Region feature.
            UnsureSequenceRegion cloneUnSureSeqRegion =
                unsureSeqRegionFeatureList[0].Clone();
            var locBuilder = new LocationBuilder();

            // Validate Unsure Seq Region qualifiers.
            Assert.AreEqual(unsureSeqRegionFeatureList.Count.ToString((IFormatProvider) null)
                            , featureCount);
            Assert.AreEqual(cloneUnSureSeqRegion.DatabaseCrossReference[0],
                            expectedDbReference);
            Assert.AreEqual(cloneUnSureSeqRegion.GeneSymbol,
                            geneSymbol);
            Assert.AreEqual(unsureSeqRegionFeatureList[0].Allele,
                            expectedAllele);
            Assert.AreEqual(unsureSeqRegionFeatureList[0].Citation[0],
                            expectedCitation);
            Assert.AreEqual(unsureSeqRegionFeatureList[0].Experiment[0],
                            expectedExperiment);
            Assert.AreEqual(unsureSeqRegionFeatureList[0].GenomicMapPosition,
                            expectedMap);
            Assert.AreEqual(unsureSeqRegionFeatureList[0].Inference[0],
                            expectedInference);
            Assert.AreEqual(unsureSeqRegionFeatureList[0].Label,
                            expectedLabel);
            Assert.AreEqual(locBuilder.GetLocationString(
                genMetadata.Features.UnsureSequenceRegions[0].Location),
                            expectedLocation);
            Assert.AreEqual(unsureSeqRegionFeatureList[0].Note[0],
                            expectedNote);
            Assert.AreEqual(unsureSeqRegionFeatureList[0].GenomicMapPosition,
                            expectedMap);
            Assert.IsFalse(string.IsNullOrEmpty(unsureSeqRegionFeatureList[0].Compare.ToString()));
            Assert.IsTrue(string.IsNullOrEmpty(unsureSeqRegionFeatureList[0].Replace));

            // Create a new Unsure feature using constructor.
            var unsureRegion =
                new UnsureSequenceRegion(expectedLocation);
            var unsureRegionWithLoc =
                new UnsureSequenceRegion(
                    genMetadata.Features.UnsureSequenceRegions[0].Location);

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