This file is indexed.

/usr/include/pbihdf/HDFPlsWriter.hpp is in libpbihdf-dev 0~20151014+gitbe5d1bf-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
#ifndef _BLASR_HDF_PLS_WRITER_HPP_
#define _BLASR_HDF_PLS_WRITER_HPP_

#include "data/hdf/HDFArray.h"
#include "data/hdf/BufferedHDFArray.h"
#include "data/hdf/HDF2DArray.h"
#include "data/hdf/BufferedHDF2DArray.h"
#include "data/hdf/HDFAtom.h"
#include "data/hdf/HDFFile.h"
#include "data/hdf/PlatformId.h"
#include "utils/SMRTReadUtils.h"
#include "FASTQSequence.h"
#include <sstream>

using namespace H5;
using namespace std;

class HDFPlsWriter {
	HDFFile outFile;
	string hdfFileName;
	string movieName, runCode;
	PlatformId platformId;
	static const int bufferSize = 16;
	
	BufferedHDFArray<int> nElemArray;
	BufferedHDFArray<int> zmwXCoordArray;
	BufferedHDFArray<int> zmwYCoordArray;
	BufferedHDFArray<char> baseArray;
	BufferedHDFArray<unsigned char> qualArray;

	/*
	HDFArray<int> nElemArray;
	HDFArray<int> zmwXCoordArray;
	HDFArray<int> zmwYCoordArray;
	HDFArray<char> baseArray;
	HDFArray<unsigned char> qualArray;
	*/
	HDFAtom<string> movieNameAtom, runCodeAtom;

	//
	// Astro specific arrays.
	//
	BufferedHDF2DArray<uint16_t> holeXY2D;

	//
	// Springfield specific arrays.
	//
	BufferedHDFArray<unsigned int> holeNumberArray;
	
	//
	// Define arrays for rich quality values.
	// 

	BufferedHDFArray<unsigned char> deletionQVArray;
	BufferedHDFArray<unsigned char> deletionTagArray;
	BufferedHDFArray<unsigned char> insertionQVArray;
	BufferedHDFArray<unsigned char> substitutionTagArray;
	BufferedHDFArray<unsigned char> substitutionQVArray;


	BufferedHDF2DArray<unsigned char> preBaseDeletionQVArray;
	HDFGroup rootGroup;
	Group runInfoGroup;
	Group baseCallGroup;
	Group zmwGroup;
 public:
	~HDFPlsWriter() { 
		nElemArray.Flush();
		zmwXCoordArray.Flush();
		zmwYCoordArray.Flush();
		baseArray.Flush();
		qualArray.Flush();
		deletionQVArray.Flush();
		deletionTagArray.Flush();
		insertionQVArray.Flush();
		substitutionTagArray.Flush();
		substitutionQVArray.Flush();
		holeNumberArray.Flush();
	}
	
	HDFPlsWriter() {
		/*
		 * Default to astro for now.  This may need to change to a NO_ID
		 * platform, in which case it must be set with Initialize().
		 */
		platformId = Astro;
	}
	void AddMovieName(string movieName) {
		movieNameAtom.Create(runInfoGroup, "MovieName",movieName);
	}
	/*
	 * Initialization without a runCode is implicitly a springfield
	 * platform.  You can change it if you really want.
	 */
	void Initialize(string _hdfFileName, string movieName, PlatformId _platformId = SpringfieldPlatform) {
		Initialize(_hdfFileName, _platformId);
		AddMovieName(movieName);
	}
	void Initialize(string _hdfFileName, string movieName, string runCode, PlatformId _platformId = Astro) {
		Initialize(_hdfFileName, _platformId);
		if (movieName != "" and runCode != "")
			AddRunInfo(movieName, runCode);
	}

	void AddRunInfo(string movieName, string runCode) {
		AddMovieName(movieName);
		runCodeAtom.Create(runInfoGroup, "RunCode", runCode);
	}

	void Initialize(string _hdfFileName, PlatformId _platformId) {
		hdfFileName = _hdfFileName;
		platformId  = _platformId;
		outFile.Create(hdfFileName);
		rootGroup.Initialize(*outFile.hdfFile, "/");
		rootGroup.AddGruop("PulseData");
		rootGroup.AddGroup("PulseData/BaesCalls");
		rootGroup.AddGroup("PulseData/BaseCalls/ZMW"); 
		rootGroup.AddGroup("ScanData/RunInfo"); 
		outFile.OpenGroup("ScanData/RunInfo", runInfoGroup);
		outFile.OpenGroup("PulseData/BaseCalls", baseCallGroup);
		outFile.OpenGroup("PulseData/BaseCalls/ZMW", zmwGroup);

		nElemArray.Initialize(&zmwGroup, "NumEvent", bufferSize);
		baseArray.Initialize(&baseCallGroup, "Basecall", bufferSize);
		qualArray.Initialize(&baseCallGroup, "QualityValue", bufferSize);

		deletionQVArray.Initialize(&baseCallGroup, "DeletionQV", bufferSize);
		deletionTagArray.Initialize(&baseCallGroup, "DeletionTag", bufferSize);
		insertionQVArray.Initialize(&baseCallGroup, "InsertionQV", bufferSize);
		preBaseDeletionQVArray.Initialize(&baseCallGroup, "PreBaseDeletionQV", 4, bufferSize);
		substitutionTagArray.Initialize(&baseCallGroup, "SubstitutionTag", bufferSize);
		substitutionQVArray.Initialize(&baseCallGroup, "SubstitutionQV", bufferSize);

		if (platformId == Astro) {
			holeXY2D.Initialize(&zmwGroup, "HoleXY", 2, bufferSize);
		}
		else if (platformId == SpringfieldPlatform) {
			holeNumberArray.Initialize(&zmwGroup, "HoleNumber", bufferSize);
		}
	}

	int Write(FASTQSequence &seq) {
		int lenArray[1] = {seq.length};
		nElemArray.Write(lenArray, 1);
		qualArray.Write(seq.qual, seq.length);
		baseArray.Write((const char*) seq.seq, seq.length);

		if (seq.deletionQV != NULL) {
			deletionQVArray.Write(seq.deletionQV, seq.length);
		}
		if (seq.preBaseDeletionQV != NULL) {
			DNALength readPos;
			for (readPos = 0; readPos < seq.length; readPos++) {
				preBaseDeletionQVArray.WriteRow(&seq.preBaseDeletionQV[readPos*4], 4);
			}
		}
		if (seq.deletionTag != NULL) {
			deletionTagArray.Write(seq.deletionTag, seq.length);
		}
		if (seq.insertionQV != NULL) {
			insertionQVArray.Write(seq.insertionQV, seq.length);
		}
		if (seq.substitutionQV != NULL) {
			substitutionQVArray.Write(seq.substitutionQV, seq.length);
		}
		if (seq.substitutionTag != NULL) {
			substitutionTagArray.Write(seq.substitutionTag, seq.length);
		}

		if (platformId == Astro) {
			// now extract the x an y coordinates.
			int x, y;
			GetSMRTReadCoordinates(seq, x, y);
			uint16_t xy[2] = {(uint16_t) x, (uint16_t) y};
			holeXY2D.WriteRow(xy, 2);
			int holeNumber = 0;
			seq.GetHoleNumber(holeNumber);
			holeNumberArray.Write(&holeNumber, 1);			
		}
		else if( platformId == SpringfieldPlatform){ 
			unsigned int holeNumber;
			GetSpringfieldHoleNumberFromTitle(seq, holeNumber);
			holeNumberArray.Write(&holeNumber, 1);
		}
		// For now say this always works. HDF will choke if a problem
		// happens.
		return 1;
	}
};





#endif