public override bool PrepareOptions()
    {
      if (File.Exists(ParamFile))
      {
        SmallRNADatabaseBuilderOptions op = new SmallRNADatabaseBuilderOptions();
        op.LoadFromFile(ParamFile);

        Console.WriteLine("param:mirna=" + op.MiRBaseFile);
        Console.WriteLine("param:mirbase_key=" + op.MiRBaseKey);
        Console.WriteLine("param:ensembl=" + op.EnsemblGtfFile);
        Console.WriteLine("param:trna=" + op.UcscTrnaFile);
        Console.WriteLine("param:rrna=" + op.RRNAFile);
        Console.WriteLine("param:genome=" + op.FastaFile);
        Console.WriteLine("param:output=" + op.OutputFile);

        if (string.IsNullOrEmpty(this.MiRBaseFile))
        {
          this.MiRBaseFile = op.MiRBaseFile;
        }

        if (string.IsNullOrEmpty(this.MiRBaseKey))
        {
          this.MiRBaseKey = op.MiRBaseKey;
        }

        if (string.IsNullOrEmpty(this.UcscTrnaFile))
        {
          this.UcscTrnaFile = op.UcscTrnaFile;
        }

        if (string.IsNullOrEmpty(this.RRNAFile))
        {
          this.RRNAFile = op.RRNAFile;
        }

        if (string.IsNullOrEmpty(this.EnsemblGtfFile))
        {
          this.EnsemblGtfFile = op.EnsemblGtfFile;
        }

        if (string.IsNullOrEmpty(this.FastaFile))
        {
          this.FastaFile = op.FastaFile;
        }

        if (string.IsNullOrEmpty(this.OutputFile))
        {
          this.OutputFile = op.OutputFile;
        }
      }

      if (!string.IsNullOrEmpty(this.MiRBaseFile) && !File.Exists(this.MiRBaseFile))
      {
        ParsingErrors.Add(string.Format("Input miRBase file not exists {0}.", this.MiRBaseFile));
      }

      if (!string.IsNullOrEmpty(this.UcscTrnaFile) && !File.Exists(this.UcscTrnaFile))
      {
        ParsingErrors.Add(string.Format("Input tRNA file not exists {0}.", this.UcscTrnaFile));
      }

      if (!string.IsNullOrEmpty(this.RRNAFile) && !File.Exists(this.RRNAFile))
      {
        ParsingErrors.Add(string.Format("Input rRNA file not exists {0}.", this.RRNAFile));
      }

      if (!string.IsNullOrEmpty(this.EnsemblGtfFile) && !File.Exists(this.EnsemblGtfFile))
      {
        ParsingErrors.Add(string.Format("Input ensembl GTF file not exists {0}.", this.EnsemblGtfFile));
      }

      if (!File.Exists(this.FastaFile))
      {
        ParsingErrors.Add(string.Format("Input genome sequence file not exists {0}.", this.FastaFile));
      }

      return ParsingErrors.Count == 0;
    }
Example #2
0
 public SmallRNADatabaseBuilder(SmallRNADatabaseBuilderOptions options)
 {
     this.options = options;
 }
 public SmallRNADatabaseBuilder(SmallRNADatabaseBuilderOptions options)
 {
   this.options = options;
 }
        public override bool PrepareOptions()
        {
            if (File.Exists(ParamFile))
            {
                SmallRNADatabaseBuilderOptions op = new SmallRNADatabaseBuilderOptions();
                op.LoadFromFile(ParamFile);

                if (string.IsNullOrEmpty(this.MiRBaseFile))
                {
                    this.MiRBaseFile = op.MiRBaseFile;
                }

                if (string.IsNullOrEmpty(this.MiRBaseKey))
                {
                    this.MiRBaseKey = op.MiRBaseKey;
                }

                if (string.IsNullOrEmpty(this.UcscTrnaFile))
                {
                    this.UcscTrnaFile = op.UcscTrnaFile;
                }

                if (string.IsNullOrEmpty(this.UcscMatureTrnaFastaFile))
                {
                    this.UcscMatureTrnaFastaFile = op.UcscMatureTrnaFastaFile;
                }

                if (string.IsNullOrEmpty(this.RRNAFile))
                {
                    this.RRNAFile = op.RRNAFile;
                }

                if (string.IsNullOrEmpty(this.EnsemblGtfFile))
                {
                    this.EnsemblGtfFile = op.EnsemblGtfFile;
                }

                if (string.IsNullOrEmpty(this.FastaFile))
                {
                    this.FastaFile = op.FastaFile;
                }

                if (string.IsNullOrEmpty(this.OutputFile))
                {
                    this.OutputFile = op.OutputFile;
                }
            }

            if (!string.IsNullOrEmpty(this.MiRBaseFile) && !File.Exists(this.MiRBaseFile))
            {
                ParsingErrors.Add(string.Format("Input miRBase file not exists {0}.", this.MiRBaseFile));
            }

            if (!string.IsNullOrEmpty(this.UcscTrnaFile) && !File.Exists(this.UcscTrnaFile))
            {
                ParsingErrors.Add(string.Format("Input tRNA file not exists {0}.", this.UcscTrnaFile));
            }

            if (!string.IsNullOrEmpty(this.UcscMatureTrnaFastaFile) && !File.Exists(this.UcscMatureTrnaFastaFile))
            {
                ParsingErrors.Add(string.Format("Input mature tRNA FASTA file not exists {0}.", this.UcscMatureTrnaFastaFile));
            }

            if (!string.IsNullOrEmpty(this.RRNAFile) && !File.Exists(this.RRNAFile))
            {
                ParsingErrors.Add(string.Format("Input rRNA file not exists {0}.", this.RRNAFile));
            }

            if (!string.IsNullOrEmpty(this.EnsemblGtfFile) && !File.Exists(this.EnsemblGtfFile))
            {
                ParsingErrors.Add(string.Format("Input ensembl GTF file not exists {0}.", this.EnsemblGtfFile));
            }

            if (!File.Exists(this.FastaFile))
            {
                ParsingErrors.Add(string.Format("Input genome sequence file not exists {0}.", this.FastaFile));
            }

            Console.WriteLine("param:mirna=" + this.MiRBaseFile);
            Console.WriteLine("param:mirbase_key=" + this.MiRBaseKey);
            Console.WriteLine("param:ensembl=" + this.EnsemblGtfFile);
            Console.WriteLine("param:trna=" + this.UcscTrnaFile);
            Console.WriteLine("param:mature_trna=" + this.UcscMatureTrnaFastaFile);
            Console.WriteLine("param:rrna=" + this.RRNAFile);
            Console.WriteLine("param:genome=" + this.FastaFile);
            Console.WriteLine("param:output=" + this.OutputFile);

            return(ParsingErrors.Count == 0);
        }