コード例 #1
0
ファイル: ParserFactory.cs プロジェクト: shengqh/CQS.Core
    public static IBreastCancerSampleInfoParser2 GetParserInDirectory(string directory)
    {
      var dirname = Path.GetFileName(directory);
      //if (!dirname.StartsWith("GSE"))
      //{
      //  return new EBIDatasetParser();
      //}

      CompositeParser2 parser = new CompositeParser2();
      var fixedParser = GetParser(dirname);
      if (fixedParser != null)
      {
        parser.Add(fixedParser);
      }

      var siformat = Directory.GetFiles(directory, "*.siformat");
      if (siformat.Length > 0)
      {
        var siParser = new PropertyMappingParser(siformat[0]);
        parser.Add(siParser);
      }

      if (parser.Count == 0)
      {
        throw new Exception("I don't know how to parse the information of " + dirname);
      }

      if (parser.Count == 1)
      {
        return parser[0];
      }

      return parser;
    }
コード例 #2
0
        public static IBreastCancerSampleInfoParser2 GetParserInDirectory(string directory)
        {
            var dirname = Path.GetFileName(directory);
            //if (!dirname.StartsWith("GSE"))
            //{
            //  return new EBIDatasetParser();
            //}

            CompositeParser2 parser = new CompositeParser2();
            var fixedParser         = GetParser(dirname);

            if (fixedParser != null)
            {
                parser.Add(fixedParser);
            }

            var siformat = Directory.GetFiles(directory, "*.siformat");

            if (siformat.Length > 0)
            {
                var siParser = new PropertyMappingParser(siformat[0]);
                parser.Add(siParser);
            }

            if (parser.Count == 0)
            {
                throw new Exception("I don't know how to parse the information of " + dirname);
            }

            if (parser.Count == 1)
            {
                return(parser[0]);
            }

            return(parser);
        }
コード例 #3
0
    private void btnTest_Click(object sender, EventArgs e)
    {
      if (dlgOpenDirectory.ShowDialog() == System.Windows.Forms.DialogResult.OK)
      {
        FormToDefinition();

        var parser = new PropertyMappingParser(items);
        var map = new Dictionary<string, BreastCancerSampleItem>();
        parser.ParseDataset(dlgOpenDirectory.SelectedPath, map);
        var lst = (from v in map.Values
                   orderby v.Sample
                   select v).ToList();

        var form = new BreastCancerSampleInformationForm();

        var reader = new RawSampleInfoReader();
        form.SetRawInfoReader(reader, Path.GetFileNameWithoutExtension(dlgOpenDirectory.SelectedPath));
        form.SetDataSource(lst);
        form.ShowDialog();
      }
    }