/// <summary>
        ///     AminoAcidColorGroupsHeatMapTsv
        /// </summary>
        /// <returns></returns>
        public List <SpreadsheetCell[]> SpreadsheetAminoAcidColorGroupsHeatMap(AminoAcidGroups.AminoAcidGroups.EnumAminoAcidGroups enumAminoAcidGroups)
        {
            lock (_lockAminoAcidToAminoAcid)
            {
                var matrix = AminoAcidToAminoAcid[(int)enumAminoAcidGroups];

                var rows = new List <List <SpreadsheetCell> >();

                var headerRowStrings = new List <SpreadsheetCell> {
                    new SpreadsheetCell()
                };


                for (var columnIndex = 0; columnIndex < matrix.GetLength(1); columnIndex++)
                {
                    if (enumAminoAcidGroups == AminoAcidGroups.AminoAcidGroups.EnumAminoAcidGroups.AminoAcids)
                    {
                        headerRowStrings.Add(new SpreadsheetCell(AminoAcidConversions.AminoAcidNumberToCode1L(columnIndex + 1)));
                    }
                    else
                    {
                        headerRowStrings.Add(new SpreadsheetCell(columnIndex + 1));
                    }
                }

                rows.Add(headerRowStrings);

                for (var rowIndex = 0; rowIndex < matrix.GetLength(0); rowIndex++)
                {
                    var row = new List <SpreadsheetCell>();

                    if (enumAminoAcidGroups == AminoAcidGroups.AminoAcidGroups.EnumAminoAcidGroups.AminoAcids)
                    {
                        row.Add(new SpreadsheetCell(AminoAcidConversions.AminoAcidNumberToCode1L(rowIndex + 1)));
                    }
                    else
                    {
                        row.Add(new SpreadsheetCell(rowIndex + 1));
                    }


                    for (var columnIndex = 0; columnIndex < matrix.GetLength(1); columnIndex++)
                    {
                        row.Add(new SpreadsheetCell(matrix[rowIndex, columnIndex]));
                    }

                    rows.Add(row);
                }

                return(rows.Select(a => a.ToArray()).ToList());
            }
        }
예제 #2
0
        public static SpreadsheetCell[] SpreadsheetTitleRow()
        {
            var titleRow = new List <SpreadsheetCell>();

            titleRow.Add(new SpreadsheetCell("Protein ID"));
            titleRow.Add(new SpreadsheetCell("Chain ID"));

            int totalAminoAcids = AminoAcidTotals.TotalAminoAcids();

            for (int index = 0; index < totalAminoAcids; index++)
            {
                titleRow.Add(new SpreadsheetCell(AminoAcidConversions.AminoAcidNumberToCode1L(index + 1)));
            }

            titleRow.Add(new SpreadsheetCell("Total"));

            return(titleRow.ToArray());
        }
예제 #3
0
        /// <summary>
        ///     This method returns a spreadsheet heat map of the entire UniProt sequence database.
        /// </summary>
        /// <returns></returns>
        public static List <SpreadsheetCell[]> UniProtHeatMapSpreadsheet()
        {
            var spreadsheet = new List <SpreadsheetCell[]>();

            //spreadsheet.Add("HM Entire UniProt Database"); // filename / worksheet name

            spreadsheet.Add(new[] { new SpreadsheetCell("Amino Acid Heat Map - Entire UniProt Database Composition (Converted To Matrix)") }); // spreadsheet title

            //spreadsheet.Add(new[] {new SpreadsheetCell(string.Empty), });
            //spreadsheet.Add(new[] {new SpreadsheetCell("Amino Acid Heat Map - Entire UniProt Database - A to Z") }); // section title
            //spreadsheet.AddRange(AminoAcidCompositionAsMatrix().SpreadsheetAminoAcidColorGroupsHeatMap());

            foreach (AminoAcidGroups.AminoAcidGroups.EnumAminoAcidGroups enumAminoAcidGroups in Enum.GetValues(typeof(AminoAcidGroups.AminoAcidGroups.EnumAminoAcidGroups)))
            {
                spreadsheet.Add(new[] { new SpreadsheetCell(string.Empty), });
                spreadsheet.Add(new[] { new SpreadsheetCell("Amino Acid Heat Map - Entire UniProt Database - Acid Groups " + enumAminoAcidGroups) }); // section title
                spreadsheet.AddRange(AminoAcidCompositionAsMatrix().SpreadsheetAminoAcidColorGroupsHeatMap(enumAminoAcidGroups));
            }

            spreadsheet.Add(new[] { new SpreadsheetCell(string.Empty), });
            spreadsheet.Add(new[] { new SpreadsheetCell("Amino Acid Heat Map - Entire UniProt Database - Original Data - A to Z") }); // section title

            AminoAcidChainComposition c = AminoAcidCompositionAsChain();

            var chain = new List <SpreadsheetCell>();

            chain.Add(new SpreadsheetCell(string.Empty));
            for (int i = 0; i < AminoAcidTotals.TotalAminoAcids(); i++)
            {
                chain.Add(new SpreadsheetCell(AminoAcidConversions.AminoAcidNumberToCode1L(i + 1)));
            }
            spreadsheet.Add(chain.ToArray());

            chain = new List <SpreadsheetCell>();
            chain.Add(new SpreadsheetCell(string.Empty));
            for (int i = 0; i < AminoAcidTotals.TotalAminoAcids(); i++)
            {
                chain.Add(new SpreadsheetCell(c.AminoAcidGroupsCount[(int)AminoAcidGroups.AminoAcidGroups.EnumAminoAcidGroups.AminoAcids][i]));
            }
            spreadsheet.Add(chain.ToArray());

            foreach (AminoAcidGroups.AminoAcidGroups.EnumAminoAcidGroups enumAminoAcidGroups in Enum.GetValues(typeof(AminoAcidGroups.AminoAcidGroups.EnumAminoAcidGroups)))
            {
                spreadsheet.Add(new[] { new SpreadsheetCell(string.Empty), });
                spreadsheet.Add(new[] { new SpreadsheetCell("Amino Acid Heat Map - Entire UniProt Database - Original Data - Acid Groups " + enumAminoAcidGroups) }); // section title

                var chainGroups = new List <SpreadsheetCell>();
                chainGroups.Add(new SpreadsheetCell(string.Empty));
                for (int i = 0; i < AminoAcidGroups.AminoAcidGroups.GetTotalSubgroups(enumAminoAcidGroups); i++)
                {
                    chainGroups.Add(new SpreadsheetCell((i + 1)));
                }
                spreadsheet.Add(chainGroups.ToArray());

                chainGroups = new List <SpreadsheetCell>();
                chainGroups.Add(new SpreadsheetCell(string.Empty));
                for (int i = 0; i < AminoAcidGroups.AminoAcidGroups.GetTotalSubgroups(enumAminoAcidGroups); i++)
                {
                    chainGroups.Add(new SpreadsheetCell(c.AminoAcidGroupsCount[(int)enumAminoAcidGroups][i]));
                }
                spreadsheet.Add(chainGroups.ToArray());
            }

            return(spreadsheet);
        }