コード例 #1
0
 /// <summary>
 /// ProgramArgs constructor.
 /// </summary>
 /// <param name="dnvopt">Type of de novo result.</param>
 /// <param name="dnvPath">The path to the directory where the de novo files are placed.</param>
 /// <param name="dbOpt">The file format of the sequence database.</param>
 /// <param name="dbpPath">The path to the database directory </param>
 /// <param name="matrixPath">The substitution matrix. Default is pam30ms.</param>
 /// <param name="Thits">The desirable alignment top hits that will be analysed.</param>
 /// <param name="minAA">The minimmun size of the peptides to be used in the analysis.</param>
 /// <param name="decoy">The tag name inserted in the decoy sequences header.</param>
 /// <param name="oCost">The alignment penalty for open gaps.</param>
 /// <param name="eCost">The alignment penalty for extending gaps.</param>
 public ProgramArgs(DeNovoOption dnvopt,
                    string dnvPath,
                    string mPexPath,
                    DataBaseOption dbOpt,
                    string dbpPath,
                    MatrixOption matrix,
                    int Thits,
                    int minAA,
                    string decoy,
                    double minDenovoScore,
                    double minIdent
                    )
 {
     DeNovoOption          = dnvopt;
     DeNovoResultDirectory = dnvPath;
     MPexResultPath        = mPexPath;
     DataBaseFormat        = dbOpt;
     DataBaseFile          = dbpPath;
     SubstitutionMatrix    = matrix;
     TopHits         = Thits;
     PeptideMinNumAA = minAA;
     DecoyLabel      = decoy;
     MinDeNovoScore  = minDenovoScore;
     MinIdentity     = minIdent;
 }
コード例 #2
0
        /// <summary>
        /// 创建指定db连接字符串的数据库
        /// </summary>
        /// <param name="dataBaseOption"></param>
        /// <returns></returns>
        public IDbConnection CreateConnection(DataBaseOption dataBaseOption = DataBaseOption.db0)
        {
            IDbConnection conn;

            if (CreateConnectionAction != null)
            {
                conn = CreateConnectionAction(dataBaseOption);
            }
            else
            {
                conn = new SqlConnection(ConnectionString);
            }
            conn.Open();
            return(conn);
        }
コード例 #3
0
        public SqlSugarClient CreateConnection(DataBaseOption dataBaseOption = DataBaseOption.db0)
        {
            var db = new SqlSugarClient(new ConnectionConfig()
            {
                ConnectionString      = ConnectionString,
                DbType                = SqlSugar.DbType.MySql,
                IsAutoCloseConnection = false
            });

            //Print sql
            db.Aop.OnLogExecuting = (sql, pars) =>
            {
                //Console.WriteLine(sql + "\r\n" + db.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value)));
                //Console.WriteLine();
            };
            return(db);
        }
コード例 #4
0
 /// <summary>
 /// The main element for database parsing.
 /// </summary>
 /// <param name="dbOpt"> DataBaseOption object</param>
 public DataBaseParser(DataBaseOption dbOpt)
 {
     if (dbOpt == DataBaseOption.Generic)
     {
         RegIdentifier  = new Regex(@"^>([^\s]*)", RegexOptions.Compiled);
         RegDescription = new Regex(@"\s(.*)", RegexOptions.Compiled);
     }
     else if (dbOpt == DataBaseOption.NCBI)
     {
         RegIdentifier  = new Regex(@">gi\|([0-9]*)", RegexOptions.Compiled);
         RegDescription = new Regex(@"\s+(.*)", RegexOptions.Compiled);
     }
     else if (dbOpt == DataBaseOption.SwissProt)
     {
         RegIdentifier  = new Regex(@"^>.+\|(.+)\|", RegexOptions.Compiled);
         RegDescription = new Regex(@"\|(.+)$", RegexOptions.Compiled);
     }
 }
コード例 #5
0
        private ProgramArgs GetParamsFromScreen()
        {
            //Verify if arguments are valid.
            if (!File.Exists(textBoxDataBaseFile.Text))
            {
                throw new Exception("Database file " + textBoxDataBaseFile.Text + " not found");
            }

            if (!Directory.Exists(textBoxDeNovoOutput.Text) && richTextBoxPeptideList.Text.Length == 0 && textBoxmpexFile.Text.Length == 0)
            {
                throw new Exception("Please enter a valid directory containing de novo output files or enter a list of peptides to be considered.");
            }
            else if (richTextBoxPeptideList.Text.Length == 0 && buttonBrowseMPEXSearch.Text.Length == 0)
            {
                if (Directory.GetFiles(textBoxDeNovoOutput.Text).Count() == 0)
                {
                    throw new Exception("No files were found in the De novo output directory");
                }
            }

            if (comboBoxDeNovoSoftware.SelectedText.Equals("Select de novo software"))
            {
                throw new Exception("Please select the de novo sequencing tool / format");
            }

            string       dbPath         = textBoxDataBaseFile.Text;
            string       dnvPath        = textBoxDeNovoOutput.Text;
            string       decoy          = textBoxDecoyTag.Text;
            int          hits           = 1;
            int          pepSize        = Convert.ToInt16(numericUpDownPeptideSize.Value);
            MatrixOption matrix         = MatrixOption.PAM30ms;
            double       minDeNovoScore = (double)numericUpDownMinDenovoScore.Value;

            matrix = MatrixOption.PAM30ms;

            DataBaseOption dbOpt = DataBaseOption.Generic;

            if (radioButtonGeneric.Checked == true)
            {
                dbOpt = DataBaseOption.Generic;
            }
            else if (radioButtonNcbi.Checked == true)
            {
                dbOpt = DataBaseOption.NCBI;
            }
            else if (radioButtonNextProt.Checked == true)
            {
                dbOpt = DataBaseOption.NextProt;
            }
            else if (radioButtonSwissProt.Checked == true)
            {
                dbOpt = DataBaseOption.SwissProt;
            }

            DeNovoOption dnvOpt = DeNovoOption.Peaks75;

            if (comboBoxDeNovoSoftware.SelectedItem != null)
            {
                if (comboBoxDeNovoSoftware.SelectedItem.Equals("PEAKS 7.0"))
                {
                    dnvOpt = DeNovoOption.Peaks70;
                }
                else if (comboBoxDeNovoSoftware.SelectedItem.Equals("PEAKS 7.5"))
                {
                    dnvOpt = DeNovoOption.Peaks75;
                }
                else if (comboBoxDeNovoSoftware.SelectedItem.Equals("PEAKS 8.0"))
                {
                    dnvOpt = DeNovoOption.Peaks80;
                }
                else if (comboBoxDeNovoSoftware.SelectedItem.Equals("PepNovo+ (output_dnv)"))
                {
                    dnvOpt = DeNovoOption.PepNovo;
                }
                else if (comboBoxDeNovoSoftware.SelectedItem.Equals("PNovo+"))
                {
                    dnvOpt = DeNovoOption.PNovo;
                }
                else if (comboBoxDeNovoSoftware.SelectedItem.Equals("PepNovo+ (output_full)"))
                {
                    dnvOpt = DeNovoOption.PepNovoFull;
                }
                else if (comboBoxDeNovoSoftware.SelectedItem.Equals("MSGFDB"))
                {
                    dnvOpt = DeNovoOption.MSGFDB;
                }
                else if (comboBoxDeNovoSoftware.SelectedItem.Equals("NOVOR v1.05.0573"))
                {
                    dnvOpt = DeNovoOption.NOVOR;
                }
            }
            else
            {
                dnvOpt = DeNovoOption.ListOfPeptides;
            }

            double minIdentity = (double)numericUpDownMinIdentity.Value;

            ProgramArgs myArgs = new ProgramArgs(
                dnvOpt,
                dnvPath,
                textBoxmpexFile.Text,
                dbOpt,
                dbPath,
                matrix,
                hits,
                pepSize,
                decoy,
                minDeNovoScore,
                minIdentity
                );

            return(myArgs);
        }
コード例 #6
0
        public IMongoDatabase CreateConnection(DataBaseOption dataBaseOption = DataBaseOption.db0)
        {
            var client = new MongoClient(ConnectionUrl);

            return(client.GetDatabase(DbName));
        }