Пример #1
0
        public int CompareTo(object obj)
        {
            AASequence other = (AASequence)obj;
            int        min   = Math.Min(sequence.Length, other.sequence.Length);

            for (int i = 0; i < min; i++)
            {
                if (sequence[i] != other.sequence[i])
                {
                    if (sequence[i] < other.sequence[i])
                    {
                        return(-1);
                    }
                    return(1);
                }
            }
            if (sequence.Length != other.sequence.Length)
            {
                if (sequence.Length < other.sequence.Length)
                {
                    return(-1);
                }
                return(1);
            }
            if (len != other.len)
            {
                if (len < other.len)
                {
                    return(-1);
                }
                return(1);
            }
            return(0);
        }
Пример #2
0
 public Protein(BinaryReader reader)
 {
     sequence        = AASequence.Read(reader).ToString();
     sequenceData    = new Sequence(sequence);
     accession       = FileUtil.ReadString(reader);
     description     = FileUtil.ReadString(reader);
     molecularWeight = reader.ReadDouble();
 }
Пример #3
0
 public static AASequence Read(BinaryReader reader)
 {
     try {
         AASequence result = new AASequence();
         result.len      = reader.ReadInt32();
         result.sequence = new ulong[reader.ReadInt32()];
         for (int i = 0; i < result.sequence.Length; i++)
         {
             result.sequence[i] = reader.ReadUInt64();
         }
         return(result);
     }catch (EndOfStreamException) {
         return(null);
     }
 }
Пример #4
0
        public static Peptide Read(BinaryReader reader)
        {
            Peptide result = new Peptide();

            result.sequence = AASequence.Read(reader);
            if (result.sequence == null)
            {
                return(null);
            }
            result.monoIsotopicMass = reader.ReadDouble();
            int nproteins = reader.ReadInt32();

            for (int i = 0; i < nproteins; i++)
            {
                result.proteinIndices.Add(reader.ReadInt32());
                result.proteinOffsets.Add(reader.ReadInt32());
                result.residueBefore.Add(reader.ReadByte());
                result.residueAfter.Add(reader.ReadByte());
            }
            result.fixedModifications = PeptideModificationState.Read(reader);
            return(result);
        }
Пример #5
0
 public override bool Equals(object obj)
 {
     if (this == obj)
     {
         return(true);
     }
     if (obj is AASequence)
     {
         AASequence other = (AASequence)obj;
         if (other.len != len)
         {
             return(false);
         }
         for (int i = 0; i < sequence.Length; i++)
         {
             if (sequence[i] != other.sequence[i])
             {
                 return(false);
             }
         }
         return(true);
     }
     return(false);
 }
Пример #6
0
 public Peptide(string sequence)
 {
     this.sequence      = new AASequence(sequence);
     monoIsotopicMass   = MonoIsotopicMass;
     fixedModifications = new PeptideModificationState(sequence.Length);
 }