Beispiel #1
0
        private List <cSequence> ExtractFileData(List <cLine> pLsLines)
        {
            List <cSequence>     lsSequences     = new List <cSequence>();
            List <cSequenceRead> lsSequenceReads = new List <cSequenceRead>();

            foreach (cLine line in pLsLines)
            {
                if (lsSequences.FindAll(item => item.RNAME == line.RNAME).Count == 0)
                {
                    cSequence newSequence = new cSequence();
                    newSequence.RNAME = line.RNAME;
                    lsSequences.Add(newSequence);
                }

                cSequenceRead newRead = new cSequenceRead();
                newRead.QNAME = line.QNAME.Trim();
                newRead.FLAG  = int.Parse(line.FLAG);
                newRead.POS   = int.Parse(line.POS);
                newRead.MAPQ  = int.Parse(line.MAPQ);
                newRead.CIGAR = line.CIGAR.Trim();
                newRead.MPOS  = int.Parse(line.MPOS);
                newRead.ISIZE = int.Parse(line.ISIZE);
                newRead.SEQ   = line.SEQ.Trim();
                newRead.QUAL  = line.QUAL.Trim();

                newRead.OPTIONS = new List <cOption>();
                foreach (string opt in line.OPTIONS)
                {
                    newRead.OPTIONS.Add(new cOption(opt));
                }

                if (line.MRNM == "=")
                {
                    //newRead.MRNM = lsSequences.First(item => item.RNAME == line.RNAME).idSequence;
                }
                else
                {
                    newRead.MRNM = lsSequences.First(item => item.RNAME == line.MRNM).idSequence;
                }
                if (lsSequences.First(item => item.RNAME == line.RNAME).Reads == null)
                {
                    lsSequences.First(item => item.RNAME == line.RNAME).Reads = new List <cSequenceRead>();
                }

                newRead.GestionINDEL();
                //newRead.GestionAmorces();

                lsSequences.First(item => item.RNAME == line.RNAME).Reads.Add(newRead);
            }

            // lsSequences.ForEach(i => i.Reads.GroupBy(j => j.QNAME));

            return(lsSequences);
        }
Beispiel #2
0
        private List <cSequence> LoadSequences(long idIndividu)
        {
            MySqlCommand     cmd = this.CreateCommand();
            MySqlDataReader  dr;
            List <cSequence> lsSequences = new List <cSequence>();

            cmd.CommandText = "SELECT ID_SEQUENCE, RNAME FROM SEQUENCE WHERE ID_INDIVIDU = @ID_INDIVIDU;";
            cmd.Parameters.AddWithValue("@ID_INDIVIDU", idIndividu);

            try
            {
                this.OpenConnection();

                dr = cmd.ExecuteReader();

                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        cSequence seq = new cSequence(dr.GetInt64("ID_SEQUENCE"));
                        seq.idIndividu = idIndividu;
                        seq.RNAME      = dr.GetString("RNAME");
                        lsSequences.Add(seq);
                    }
                }

                this.CloseConnection();
            }
            catch (Exception ex)
            {
                this.CloseConnection();
                throw;
            }


            return(lsSequences);
        }