public static byte[][] LoadBGZippedCallsAndScores(string filePath, ulong startPosition, int clusterCount, out ulong EndPosition) { byte[][] callsAndScores = null; using (BgzipReader reader = new BgzipReader(filePath)) { if (startPosition > 0) { reader.Seek(startPosition); } else { reader.BlockOffset = 4; } byte[] buffer = reader.ReadBytes(clusterCount, out EndPosition); if (callsAndScores == null) { callsAndScores = new byte[2][]; callsAndScores[0] = new byte[clusterCount]; callsAndScores[1] = new byte[clusterCount]; } for (int clusterIndex = 0; clusterIndex < clusterCount; clusterIndex++) { if (buffer[clusterIndex] != 0) // can't be uncalled, so quality score must be > 0 callsAndScores[0][clusterIndex] = (byte)((buffer[clusterIndex] & 3) + 8); else callsAndScores[0][clusterIndex] = 0; // no-call reserved callsAndScores[1][clusterIndex] = (byte)(buffer[clusterIndex] >> 2); } } return callsAndScores; }
private static byte[][] LoadBgzippedCallsAndScores(string filePath, ulong startPosition, int clusterCount, out ulong endPosition) { byte[][] callsAndScores; using (BgzipReader reader = new BgzipReader(filePath)) { reader.Seek(startPosition+4); byte[] buffer = reader.ReadBytes(clusterCount, out endPosition); callsAndScores = new byte[2][]; callsAndScores[0] = new byte[clusterCount]; callsAndScores[1] = new byte[clusterCount]; for (int clusterIndex = 0; clusterIndex < clusterCount; clusterIndex++) { if (buffer[clusterIndex] != 0) // can't be uncalled, so quality score must be > 0 callsAndScores[0][clusterIndex] = (byte) ((buffer[clusterIndex] & 3) + 8); else callsAndScores[0][clusterIndex] = 0; // no-call reserved callsAndScores[1][clusterIndex] = (byte) (buffer[clusterIndex] >> 2); } } return callsAndScores; }