Beispiel #1
0
        void ChooseIddc(FastqReader reader, BinaryWriter writer)
        {
            if (!encodeIds)
            {
                iddc = new PlaceholderIdGenerator();
                return;
            }
            //@SRX000571_SRR002321.54856271 080226_CMLIVERKIDNEY_0007:8:330:23:135 length=36
            Regex sra    = new Regex(@"^(@[^.]+\.)\d+\s([\S]+)(?:\d+:){3}\d+.*$", RegexOptions.Singleline);
            Regex length = new Regex(@"^.+length=\d+$", RegexOptions.Singleline);
            //@HWUSI-EAS627_1:3:1:0:370/1 (or /2)
            //@BILLIEHOLIDAY_3_FC30G08AAXX:1:1:0:1966
            Regex encode = new Regex(@"^(@[\S]+)(?:\d+:){3}\d+(\/[12])*$", RegexOptions.Singleline);

            String id          = reader.GetID(0);
            Match  sraMatch    = sra.Match(id);
            Match  encodeMatch = encode.Match(id);

            if (sraMatch.Success)   //type 0
            {
                Match lengthMatch = length.Match(id);
                writer.Write(0);
                iddc = new SraIdDeCompresser(reader, writer, sraMatch, lengthMatch.Success);
            }
            else if (encodeMatch.Success)     //type 2
            {
                writer.Write(2);
                iddc = new EncodeIdDeCompresser(reader, writer, encodeMatch);
            }
            else     //type 1
            {
                writer.Write(1);
                iddc = new PlainIdDeCompresser(reader, writer);
            }
        }
Beispiel #2
0
        void ChooseIddc(EncodedFastqReader reader)
        {
            if (!encodeIds)
            {
                iddc = new PlaceholderIdGenerator();
                return;
            }
            int iddcType = reader.Reader.ReadInt32();

            if (iddcType == 0)
            {
                iddc = new SraIdDeCompresser(reader, length);
            }
            else if (iddcType == 1)
            {
                iddc = new PlainIdDeCompresser(reader);
            }
            else if (iddcType == 2)
            {
                iddc = new EncodeIdDeCompresser(reader);
            }
            else
            {
                throw new Exception("Missing header info in compressed file! " + iddcType);
            }
        }