Exemplo n.º 1
0
        /**
         * TODO: Avec frequency > 2 pour les autres Alternatives ? Inutile pour l'instant
         */
        public async Task <FrequencyReport> SnpFrequency(string referenceId, Snp snp, int windowSize = 20,
                                                         int validateSize = 5)
        {
            var genome = await Reader.ReadSequenceAsync(referenceId);

            if (genome[snp.Position0].ToString() != snp.Reference)
            {
                throw new Exception("Reference mismatch");
            }

            var beforeWindow = new Range(snp.Position0 - windowSize, snp.Position0);
            var afterWindow  = new Range(snp.Position0 + 1, snp.Position0 + 1 + windowSize);

            var seq1 = genome[beforeWindow] + genome[snp.Position0] + genome[afterWindow];
            var seq2 = genome[beforeWindow] + snp.Insertion + genome[afterWindow];

            var options = await BlastnOptions.FromInlineQuery($">id\n{seq2}");

            options.Evalue           = "1e-5";
            options.Task             = "blastn";
            options.MaxTargetSeqs    = 150;
            options.FormatSpecifiers = new List <string> {
                "sseq"
            };
            var results = await Client.ExecuteBuffered(options);

            var validateBefore = new Range(windowSize - validateSize + 1, windowSize + 1);
            var validateAfter  = new Range(windowSize, windowSize + validateSize);

            var frequencies = new FrequencyReport(2);

            foreach (var result in results)
            {
                if (String.IsNullOrEmpty(result.AlignedPartOfSubjectSequence))
                {
                    continue;
                }
                if (result.AlignedPartOfSubjectSequence.Contains(seq1[validateBefore]))
                {
                    frequencies.Increment(0);
                }
                if (result.AlignedPartOfSubjectSequence.Contains(seq1[validateAfter]))
                {
                    frequencies.Increment(0);
                }
                if (result.AlignedPartOfSubjectSequence.Contains(seq2[validateBefore]))
                {
                    frequencies.Increment(1);
                }
                if (result.AlignedPartOfSubjectSequence.Contains(seq2[validateAfter]))
                {
                    frequencies.Increment(1);
                }
            }

            return(frequencies);
        }
Exemplo n.º 2
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (Login != null ? Login.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Snp != null ? Snp.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Post != null ? Post.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Phone != null ? Phone.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Department != null ? Department.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Unit != null ? Unit.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Office != null ? Office.GetHashCode() : 0);
         return(hashCode);
     }
 }
Exemplo n.º 3
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = IdRequestUser;
         hashCode = (hashCode * 397) ^ (Login != null ? Login.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Snp != null ? Snp.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Post != null ? Post.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Phone != null ? Phone.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Department != null ? Department.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Unit != null ? Unit.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Office != null ? Office.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (RequestUserAssoc != null ? RequestUserAssoc.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ IsActive.GetHashCode();
         hashCode = (hashCode * 397) ^ Deleted.GetHashCode();
         return(hashCode);
     }
 }