public CompressedSuffixArray(uint[] compressedSuffixArray, DnaBwt bwt, OccurrenceArray[] occ, uint[] c)
 {
     _baseArray = compressedSuffixArray;
     _bwt = bwt;
     _occ = occ;
     _c = c;
     Length = bwt.Length;
 }
        public static CompressedSuffixArray CreateFromFile(string fileName, DnaBwt bwt, OccurrenceArray[] occ, uint[] c)
        {
            var buffer = File.ReadAllBytes(fileName);
            uint[] compressedSufArray = new uint[buffer.Length/4];
            for (int i = 0; i < compressedSufArray.Length; i++)
            {
                compressedSufArray[i] = BitConverter.ToUInt32(buffer, i*4);
            }

            CompressedSuffixArray csa = new CompressedSuffixArray(compressedSufArray, bwt, occ, c);
            return csa;
        }
Ejemplo n.º 3
0
 public Sequencer(uint[] c, OccurrenceArray[] occurrences, OccurrenceArray[] occurrencesRev,
                   CompressedSuffixArray suffixArray, CompressedSuffixArray suffixArrayRev,
                   int threadCount)
 {
     _c = c;
     _occurrences = occurrences;
     _occurrencesRev = occurrencesRev;
     _suffixArray = suffixArray;
     _suffixArrayRev = suffixArrayRev;
     _database = new AlignmentDatabase("temp.db");
     _threadCount = threadCount;
 }
Ejemplo n.º 4
0
 public static void WriteToFile(string fileName, OccurrenceArray[] occ)
 {
     using (var file = File.Open(fileName, FileMode.Create))
     {
         BinaryWriter writer = new BinaryWriter(file);
         for (int i = 0; i < occ[0]._compressedOcc.Length; i++)
         {
             for (int dnaBase = 0; dnaBase < 4; dnaBase++)
             {
                 var value = occ[dnaBase]._compressedOcc[i];
                 writer.Write(value);
             }
         }
     }
 }
Ejemplo n.º 5
0
        public static OccurrenceArray[] CreateOccurrenceArrays(DnaBwt bwt)
        {
            OccurrenceArray[] occArrays = new OccurrenceArray[4]
                {
                    new OccurrenceArray(bwt, 0, new int[bwt.Length/CompressFactor+1]),
                    new OccurrenceArray(bwt, 1, new int[bwt.Length/CompressFactor+1]),
                    new OccurrenceArray(bwt, 2, new int[bwt.Length/CompressFactor+1]),
                    new OccurrenceArray(bwt, 3, new int[bwt.Length/CompressFactor+1])
                };
            int[] sums = new int[4];
            for (long i = 0; i < bwt.Length; i++)
            {
                if (bwt[i] >= 0)
                    sums[bwt[i]]++;

                if (i%CompressFactor == 0)
                {
                    occArrays[0][i] = sums[0];
                    occArrays[1][i] = sums[1];
                    occArrays[2][i] = sums[2];
                    occArrays[3][i] = sums[3];
                }
            }

            return occArrays;
        }
Ejemplo n.º 6
0
 public Sequencer(uint[] c, OccurrenceArray[] occurrences, OccurrenceArray[] occurrencesRev,
                   CompressedSuffixArray suffixArray, CompressedSuffixArray suffixArrayRev)
     : this(c, occurrences, occurrencesRev,
            suffixArray, suffixArrayRev, Environment.ProcessorCount + 2)
 {
 }