File: writearrays.cpp

package info (click to toggle)
pilercr 1.06%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 844 kB
  • sloc: cpp: 14,339; makefile: 67; sh: 36
file content (36 lines) | stat: -rwxr-xr-x 1,057 bytes parent folder | download | duplicates (2)
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
#include "pilercr.h"

static void WriteArray(FILE *f, const ArrayData &AD)
	{
	const int PileIndexCount = (int) AD.PileIndexes.size();
	for (int i = 0; i < PileIndexCount; ++i)
		{
		int PileIndex = AD.PileIndexes[i];
		assert(PileIndex >= 0 && PileIndex < g_PileCount);
		const PileData &Pile = g_Piles[PileIndex];

		char *Label;
		int Lo = GlobalToLocal(Pile.Lo, &Label);
		int Hi = Lo + Pile.Hi - Pile.Lo + 1;

	// GFF Fields are:
	// <seqname> <source> <feature> <start> <end> <score> <strand> <frame> [attributes] [comments]
	//     0         1         2        3      4      5        6       7         8           9
		fprintf(f, "%s\tcrisper\tpile\t%d\t%d\t0\t+\t.\tPile %d ; Array %d\n",
		  Label,
		  Lo + 1,
		  Hi + 1,
		  PileIndex,
		  AD.Id);
		}
	}

void WriteArrays(FILE *f, const std::vector<ArrayData *> &ADVec)
	{
	const size_t ArrayCount = ADVec.size();
	for (size_t ArrayIndex = 0; ArrayIndex < ArrayCount; ++ArrayIndex)
		{
		const ArrayData &AD = *(ADVec[ArrayIndex]);
		WriteArray(f, AD);
		}
	}