예제 #1
0
        /*public void Load( string filename ) {
         *      UnixCfg rd = new UnixCfg( filename );
         *      string line = rd.ReadUnixLine();
         *      char[] sep = new char[]{ ':' };
         *      string[] fields;
         *
         *      while( line != null ) {
         *              PSSMposition pos;
         *              pos.order = uint.Parse( line.Replace("{","") );
         *              pos.entries = new List<PSSMentry>();
         *              line = rd.ReadUnixLine();
         *              while( line != null && !line.Contains("}") ) {
         *                      PSSMentry entry;
         *                      fields = line.Split( sep );
         *                      entry.condition = fields[0].Trim();
         *                      entry.score = double.Parse( fields[1] );
         *                      pos.entries.Add( entry );
         *                      line = rd.ReadUnixLine();
         *              }
         *              if( line != null )
         *                      line = rd.ReadUnixLine();
         *              m_pssm.Add( pos );
         *      }
         *      rd.Close();
         * }*/

        public void Load(string filename)
        {
            UnixCfg rd = new UnixCfg(filename);

            char[]    sep = new char[] { ' ', '\t' };
            string[]  fields;
            PSSMentry entry;

            string line = rd.ReadUnixLine();

            if (line == null)
            {
                rd.Close();
                return;
            }
            fields = line.Split(sep);
            PSSMposition[] pos = new PSSMposition[fields.Length - 1];
            for (uint i = 0; i < pos.Length; i++)
            {
                pos[i].order   = i;
                pos[i].entries = new List <PSSMentry>();
            }
            do
            {
                fields          = line.Split(sep);
                entry.condition = fields[0].Trim();
                for (uint i = 0; i < pos.Length; i++)
                {
                    entry.score = double.Parse(fields[i + 1]);
                    pos[i].entries.Add(entry);
                }
                line = rd.ReadUnixLine();
            } while(line != null);
            rd.Close();

            m_pssm.AddRange(pos);
        }
예제 #2
0
파일: PSSM.cs 프로젝트: akrogp/EhuBio
 private double GetScore( PSSMposition pos, AminoAcid aa )
 {
     foreach( PSSMentry entry in pos.entries ) {
     if( entry.condition.Length == 1 ) {
         if( entry.condition.CompareTo(aa.Letter.ToString())==0 )
             return entry.score;
         else
             continue;
     }
     switch( entry.condition.ToLower() ) {
         case "acidic":
             if( aa.Acidic ) return entry.score;
             break;
         case "basic":
             if( aa.Basic ) return entry.score;
             break;
         case "hydrophobic":
             if( aa.Hydrophobic ) return entry.score;
             break;
         case "polar":
             if( aa.Polar ) return entry.score;
             break;
         case "charge":
             if( aa.Charge != 0 ) return entry.score;
             break;
         case "positive":
             if( aa.Positive ) return entry.score;
             break;
         case "negative":
             if( aa.Negative ) return entry.score;
             break;
         case "aromatic":
             if( aa.Aromatic ) return entry.score;
             break;
         case "aliphatic":
             if( aa.Aliphatic ) return entry.score;
             break;
         default:
             throw new ApplicationException( "Undefined PSSM condition: " + entry.condition );
     }
     }
     return 0.0;
 }
예제 #3
0
        private double GetScore(PSSMposition pos, AminoAcid aa)
        {
            foreach (PSSMentry entry in pos.entries)
            {
                if (entry.condition.Length == 1)
                {
                    if (entry.condition.CompareTo(aa.Letter.ToString()) == 0)
                    {
                        return(entry.score);
                    }
                    else
                    {
                        continue;
                    }
                }
                switch (entry.condition.ToLower())
                {
                case "acidic":
                    if (aa.Acidic)
                    {
                        return(entry.score);
                    }
                    break;

                case "basic":
                    if (aa.Basic)
                    {
                        return(entry.score);
                    }
                    break;

                case "hydrophobic":
                    if (aa.Hydrophobic)
                    {
                        return(entry.score);
                    }
                    break;

                case "polar":
                    if (aa.Polar)
                    {
                        return(entry.score);
                    }
                    break;

                case "charge":
                    if (aa.Charge != 0)
                    {
                        return(entry.score);
                    }
                    break;

                case "positive":
                    if (aa.Positive)
                    {
                        return(entry.score);
                    }
                    break;

                case "negative":
                    if (aa.Negative)
                    {
                        return(entry.score);
                    }
                    break;

                case "aromatic":
                    if (aa.Aromatic)
                    {
                        return(entry.score);
                    }
                    break;

                case "aliphatic":
                    if (aa.Aliphatic)
                    {
                        return(entry.score);
                    }
                    break;

                default:
                    throw new ApplicationException("Undefined PSSM condition: " + entry.condition);
                }
            }
            return(0.0);
        }
예제 #4
0
파일: PSSM.cs 프로젝트: akrogp/EhuBio
        /*public void Load( string filename ) {
        UnixCfg rd = new UnixCfg( filename );
        string line = rd.ReadUnixLine();
        char[] sep = new char[]{ ':' };
        string[] fields;

        while( line != null ) {
            PSSMposition pos;
            pos.order = uint.Parse( line.Replace("{","") );
            pos.entries = new List<PSSMentry>();
            line = rd.ReadUnixLine();
            while( line != null && !line.Contains("}") ) {
                PSSMentry entry;
                fields = line.Split( sep );
                entry.condition = fields[0].Trim();
                entry.score = double.Parse( fields[1] );
                pos.entries.Add( entry );
                line = rd.ReadUnixLine();
            }
            if( line != null )
                line = rd.ReadUnixLine();
            m_pssm.Add( pos );
        }
        rd.Close();
        }*/
        public void Load( string filename )
        {
            UnixCfg rd = new UnixCfg( filename );
            char[] sep = new char[]{ ' ', '\t' };
            string[] fields;
            PSSMentry entry;

            string line = rd.ReadUnixLine();
            if( line == null ) {
            rd.Close();
            return;
            }
            fields = line.Split( sep );
            PSSMposition[] pos = new PSSMposition[fields.Length-1];
            for( uint i = 0; i < pos.Length; i++ ) {
            pos[i].order = i;
            pos[i].entries = new List<PSSMentry>();
            }
            do {
            fields = line.Split( sep );
            entry.condition = fields[0].Trim();
            for( uint i = 0; i < pos.Length; i++ ) {
                entry.score = double.Parse( fields[i+1] );
                pos[i].entries.Add( entry );
            }
            line = rd.ReadUnixLine();
            } while( line != null );
            rd.Close();

            m_pssm.AddRange( pos );
        }