libBigWig
Functions
bwCommon.h File Reference

Go to the source code of this file.

Functions

int bwSetPos (bigWigFile_t *fp, size_t pos)
 Like fsetpos, but for local or remote bigWig files. This will set the file position indicator to the specified point. For local files this literally is fsetpos, while for remote files it fills a memory buffer with data starting at the desired position. More...
 
size_t bwRead (void *data, size_t sz, size_t nmemb, bigWigFile_t *fp)
 A local/remote version of fread. Reads data from either local or remote bigWig files. More...
 
long bwTell (bigWigFile_t *fp)
 Determine what the file position indicator say. This is equivalent to ftell for local or remote files. More...
 
bwRTree_tbwReadIndex (bigWigFile_t *fp, uint64_t offset)
 Reads a data index (either full data or a zoom level) from a bigWig file. There is little reason for end users to use this function. This must be freed with bwDestroyIndex More...
 
void bwDestroyIndexNode (bwRTreeNode_t *node)
 Destroy an bwRTreeNode_t and all of its children. More...
 
void bwDestroyIndex (bwRTree_t *idx)
 Frees space allocated by bwReadIndex There is generally little reason to use this, since end users should typically not need to run bwReadIndex themselves. More...
 
int bwFinalize (bigWigFile_t *fp)
 Finishes what's needed to write a bigWigFile Flushes the buffer, converts the index linked list to a tree, writes that to disk, handles zoom level stuff, writes magic at the end. More...
 

Detailed Description

You have no reason to use these functions. They may change without warning because there's no reason for them to be used outside of libBigWig's internals.

These are structures and functions from a variety of files that are used across files internally but don't need to be see by libBigWig users.

Function Documentation

◆ bwDestroyIndex()

void bwDestroyIndex ( bwRTree_t idx)

Frees space allocated by bwReadIndex There is generally little reason to use this, since end users should typically not need to run bwReadIndex themselves.

Parameters
idxA bwRTree_t pointer allocated by bwReadIndex.

◆ bwDestroyIndexNode()

void bwDestroyIndexNode ( bwRTreeNode_t node)

Destroy an bwRTreeNode_t and all of its children.

Parameters
nodeThe node to destroy.

◆ bwFinalize()

int bwFinalize ( bigWigFile_t fp)

Finishes what's needed to write a bigWigFile Flushes the buffer, converts the index linked list to a tree, writes that to disk, handles zoom level stuff, writes magic at the end.

Parameters
fpA valid bigWigFile_t pointer
Returns
0 on success

◆ bwRead()

size_t bwRead ( void *  data,
size_t  sz,
size_t  nmemb,
bigWigFile_t fp 
)

A local/remote version of fread. Reads data from either local or remote bigWig files.

Parameters
dataAn allocated memory block big enough to hold the data.
szThe size of each member that should be copied.
nmembThe number of members to copy.
fpThe bigWigFile_t * from which to copy the data.
See also
bwSetPos
Returns
For nmemb==1, the size of the copied data. For nmemb>1, the number of members fully copied (this is equivalent to fread).

◆ bwReadIndex()

bwRTree_t* bwReadIndex ( bigWigFile_t fp,
uint64_t  offset 
)

Reads a data index (either full data or a zoom level) from a bigWig file. There is little reason for end users to use this function. This must be freed with bwDestroyIndex

Parameters
fpA valid bigWigFile_t pointer
offsetThe file offset where the index begins
Returns
A bwRTree_t pointer or NULL on error.

◆ bwSetPos()

int bwSetPos ( bigWigFile_t fp,
size_t  pos 
)

Like fsetpos, but for local or remote bigWig files. This will set the file position indicator to the specified point. For local files this literally is fsetpos, while for remote files it fills a memory buffer with data starting at the desired position.

Parameters
fpA valid opened bigWigFile_t.
posThe position within the file to seek to.
Returns
0 on success and -1 on error.

◆ bwTell()

long bwTell ( bigWigFile_t fp)

Determine what the file position indicator say. This is equivalent to ftell for local or remote files.

Parameters
fpThe file.
Returns
The position in the file.