Exemplo n.º 1
0
        public static ExpressionMatrix ReadMatrix(this TCGATechnologyType ttt, TCGADataType tdt, List <BarInfo> bis, List <string> genes)
        {
            double?[,] data = new double?[genes.Count, bis.Count];
            for (int i = 0; i < bis.Count; i++)
            {
                var reader = ttt.GetTechnology().GetReader();
                var fn     = tdt == TCGADataType.Count ? ttt.GetTechnology().GetCountFilename(bis[i].FileName) : bis[i].FileName;
                var dd     = reader.ReadFromFile(fn).Values.ToDictionary(m => m.Name, m => m.Value);
                for (int j = 0; j < genes.Count; j++)
                {
                    if (dd.ContainsKey(genes[j]))
                    {
                        data[j, i] = dd[genes[j]];
                    }
                    else
                    {
                        data[j, i] = null;
                    }
                }
            }

            ExpressionMatrix result = new ExpressionMatrix();

            result.Values   = data;
            result.Rownames = genes.ToArray();
            result.Colnames = bis.ConvertAll(m => m.BarCode).ToArray();
            return(result);
        }
Exemplo n.º 2
0
        public static ITCGATechnology GetTechnology(this TCGATechnologyType ttype)
        {
            switch (ttype)
            {
            case TCGATechnologyType.Affy:
            case TCGATechnologyType.Agilent:
                return(TCGATechnology.Microarray);

            case TCGATechnologyType.RPKM:
                return(TCGATechnology.RNAseq_RPKM);

            case TCGATechnologyType.RSEM:
                return(TCGATechnology.RNAseq_RSEM);

            default:
                throw new Exception("Unknown type " + ttype);
            }
        }
Exemplo n.º 3
0
 public static bool HasSample(this Dictionary <TCGATechnologyType, Dictionary <TCGASampleType, List <BarInfo> > > tumormap, TCGATechnologyType tType)
 {
     return(tumormap[tType].GetSampleCount() > 0);
 }
Exemplo n.º 4
0
        private static void AddDataset(Dictionary <TCGATechnologyType, Dictionary <TCGASampleType, List <BarInfo> > > tumormap, TCGATechnologyType technolyType, DatasetInfo datasetInfo)
        {
            var map = new Dictionary <TCGASampleType, List <BarInfo> >();

            tumormap[technolyType] = map;
            foreach (var type in EnumUtils.EnumToArray <TCGASampleType>())
            {
                map[type] = new List <BarInfo>();
            }

            if (datasetInfo == null)
            {
                return;
            }

            foreach (var key in datasetInfo.BarInfoListMap)
            {
                var type = TCGAUtils.GetSampleType(key.Key);
                map[type].Add(key.Value.First());
            }
        }