示例#1
0
        /// <summary>
        /// Creates an DensePairAnsi with values missing.
        /// </summary>
        /// <param name="rowKeySequence">A sequence of row keys. The items will become the RowKeys of the Matrix.</param>
        /// <param name="colKeySequence">A sequence of colKeys. The items will come the ColKeys of the Matrix.</param>
        /// <param name="missingValue">The special Missing value, which must be (UO '?','?')</param>
        /// <returns>A new, empty, DensePairAnsi</returns>
        static public DensePairAnsi CreateEmptyInstance(IEnumerable <string> rowKeySequence, IEnumerable <string> colKeySequence, UOPair <char> missingValue)
        {
            Helper.CheckCondition(missingValue.Equals(StaticMissingValue), "For DensePairAnsi the missingValue must be (UO '?', '?')"); //OK to use Equals because UOPair<char> can't be null.
            DensePairAnsi densePairAnsi = new DensePairAnsi();

            densePairAnsi.InternalCreateEmptyInstance(rowKeySequence, colKeySequence);
            return(densePairAnsi);
        }
示例#2
0
        /// <summary>
        /// Creates an DensePairAnsi with values missing.
        /// </summary>
        /// <param name="rowKeySequence">A sequence of row keys. The items will become the RowKeys of the Matrix.</param>
        /// <param name="colKeySequence">A sequence of colKeys. The items will come the ColKeys of the Matrix.</param>
        /// <param name="missingValue">The special Missing value, which must be (UO '?','?')</param>
        /// <returns>A new, empty, DensePairAnsi</returns>
        static public DensePairAnsi CreateEmptyInstance(IEnumerable <string> rowKeySequence, IEnumerable <string> colKeySequence, UOPair <char> missingValue)
        {
            //OK to use Equals because UOPair<char> can't be null.
            Helper.CheckCondition(missingValue.Equals(StaticMissingValue), Properties.Resource.DensePairAnsiMissingValueSignatureMustBe);
            DensePairAnsi densePairAnsi = new DensePairAnsi();

            densePairAnsi.InternalCreateEmptyInstance(rowKeySequence, colKeySequence);
            return(densePairAnsi);
        }
示例#3
0
        /// <summary>
        /// This awkward method is provided for the sake of MatrixFactory. Right now it simply catches exceptions. Should switch and make it fail silently when doesn't work.
        /// </summary>
        public static bool TryGetInstance(string genomePopFileName, UOPair <char> mustProvide_StaticMissingValue_OrExceptionWillBeThrown, ParallelOptions parallelOptions, out Matrix <string, string, UOPair <char> > paddedPair)
        {
            paddedPair = null;
            if (!mustProvide_StaticMissingValue_OrExceptionWillBeThrown.Equals(DensePairAnsi.StaticMissingValue)) //OK to use Equals because double can't be null
            {
                Console.Error.WriteLine("Missing value {0} doesn't match expected value {1}", DensePairAnsi.StaticMissingValue, mustProvide_StaticMissingValue_OrExceptionWillBeThrown);
                return(false);
            }

            try
            {
                paddedPair = DensePairAnsi.GetInstanceFromSparse(TripleSequence(genomePopFileName));
                return(true);
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(e.Message);
                return(false);
            }
        }