示例#1
0
        // Methods
        /// <summary>
        /// Returns a SNPMap class filled from the string array.
        /// Optionally retains the raw text in the object for later testing BSON serialization
        /// </summary>
        /// <param name="lines">String array where each element is a line of the text file. Assumes full file is presented.</param>
        /// <param name="RetainText">True retains the raw test lines passed in parameter 'lines'</param>
        /// <returns></returns>
        public clsSNPMap LoadFile(string[] lines, bool RetainText)
        {
            if (RetainText)
            {
                // Save a copy of the raw text for later testing BSON serialization accuracy
                if (RawRows == null)
                {
                    RawRows = new List <string>(lines.Count());
                }
                RawRows.AddRange(lines);
            }

            // Grab the line of column headings
            string[] fields = lines[0].Split("\t".ToCharArray());
            this.ColumnHeading = new List <string>(fields.Count());
            this.ColumnHeading.AddRange(fields);


            this.Rows = new List <clsSNPMapDataRow>(lines.Count());
            for (int i = 1; i < lines.Count(); i++)
            {
                string[] items = lines[i].Split("\t".ToCharArray());
                var      dr    = new clsSNPMapDataRow(items);
                this.Rows.Add(dr);
            }
            return(this);
        }
示例#2
0
        public void LoadFile(string[] lines, bool RetainText)
        {
            if (RetainText)
            {
                // Save a copy of the raw text for later testing BSON serialization accuracy
                if (RawRows == null)
                {
                    RawRows = new List <string>(lines.Count());
                }
                RawRows.AddRange(lines);
            }

            // Split the text line by tabs
            string[] fields = lines[0].Split("\t".ToCharArray());

            // First line is the column headings
            this.ColumnHeading = new List <string>();
            this.ColumnHeading.AddRange(fields);

            // Remaining rows are data
            this.Rows = new List <clsSampleMapDataRow>();
            for (int i = 1; i < lines.Count(); i++)
            {
                string[] items = lines[i].Split("\t".ToCharArray());
                var      dr    = new clsSampleMapDataRow(items);
                this.Rows.Add(dr);
            }
            return;
        }