---
name: "ExperimentFile"
section: "3"
platform: "linux"
package: "libstaden-read-dev"
version: "1.15.0-1.1+b2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/ExperimentFile"
---

# ExperimentFile(3)

Manipulations of the Experiment File format

## NAME

**exp\_read\_info**, **exp\_fread\_info**, **exp\_create\_info**, **exp\_destroy\_info**, **exp\_create\_range**, **exp\_extract\_range**, **exp\_get\_feature\_index**, **exp\_get\_int**, **exp\_get\_rng**, **exp\_get\_str**, **exp\_put\_int**, **exp\_put\_rng**, **exp\_put\_str**, **exp\_print\_line**, **exp\_print\_seq**, **exp\_print\_file**, **opos2str**, **str2opos**, **conf2str**, **str2conf** - Manipulations of the Experiment File format

## SYNOPSIS

```
#include <expFileIO.h>
Exp_info *exp_read_info(
	char *file);
```

```
Exp_info *exp_fread_info(
	FILE *fp);
```

```
Exp_info *exp_create_info();
```

```
void exp_destroy_info(
	Exp_info *e);
```

```
char *exp_create_range(
	char *str,
	int start,
	int end);
```

```
int exp_extract_range(
	char *str,
	int *start,
	int *end);
```

```
int exp_get_feature_index(
	char *e);
```

```
int exp_get_int(
	Exp_info *e,
	int id,
	int *val);
```

```
int exp_get_rng(
	Exp_info *e,
	int id,
	int *from,
	int *to);
```

```
int exp_get_str(
	Exp_info *e,
	int id,
	char *s,
	f_implicit s_l);
```

```
int exp_put_int(
	Exp_info *e,
	int id,
	int *val);
```

```
int exp_put_rng(
	Exp_info *e,
	int id,
	int *from,
	int *to);
```

```
int exp_put_str(
	Exp_info *e,
	int id,
	char *s,
	f_implicit s_l);
```

```
int exp_print_line(
	FILE *fp,
	Exp_info *e,
	int eflt,
	int i);
```

```
int exp_print_seq(
	FILE *fp,
	Exp_info *e,
	int eflt,
	int i);
```

```
void exp_print_file(
	FILE *fp,
	Exp_info *e);
```

```
char *opos2str(
	int2 *opos,
	int len,
	char *buf);
```

```
int str2opos(
	int2 *opos,
	char *buf);
```

```
char *conf2str(
	int1 *conf,
	int len,
	char *buf);
```

```
int str2conf(
	int1 *conf,
	char *buf);
```

## DESCRIPTION

**These functions manipulate Experiment Files. They include functions for** **reading, writing, and editing the files. The principle structure used by the** **routines is the Exp\_info** structure. This is as follows.

```
#define MAXIMUM_EFLT_LENGTH     4
#define MAXIMUM_EFLTS          48
#define EXP_FILE_LINE_LENGTH  128
typedef Array Exp_entries;
typedef struct {
    Array entries[MAXIMUM_EFLTS]; /* array of array of entries */
    int Nentries[MAXIMUM_EFLTS];  /* array of number of entries */
    FILE *fp;
} Exp_info;
#define NULL_Exp_info ( (Exp_info *) NULL )
```

For the purposes of simple and efficient coding, each line on an experiment file must be smaller than the defined EXP\_FILE\_LINE\_LENGTH, which is 128 characters.

Many functions take an experiment file line type identifier as an argument. These functions are listed in the prototypes as taking **int id**. Here **id** should be specified using one of the macros defining in the header file. They take the form of **EFLT\_**XX where XX is the line type. For instance, the **ID** line type identifier should be written as **EFLT\_ID**.

The C functions available follow. Some FORTRAN interfaces are also available, but these are not documented. See the include file for their prototypes.

**exp\_read\_info** and **exp\_fread\_info** read an experiment file into an allocated **Exp\_info** structure. If successful, the structure pointer is return. Otherwise the null pointer is returned.

**exp\_create\_info** allocates and initialises a new, blank, **Exp\_info** structure. If successful, the structure pointer is return. Otherwise the null pointer is returned.

**exp\_destroy\_info** deallocates an **Exp\_info** structure.

**exp\_create\_range** creates a string using the experiment file range format of "start..stop". This format is used by the AQ, ON, TG and TC line types. The buffer specified should be large enough to hold the string. The function returns the **str** pointer supplied as an argument.

**exp\_extract\_range** extracts the start and end values from the string representation of a range; "start..stop". The values are stored in the integer pointers sent as arguments. If successful, the function returns 0. Otherwise -1 is returned.

**exp\_get\_feature\_index** converts from a string representation of an experiment file line type to the integer value. For example, **exp\_get\_feature\_index("SQ")** returns the integer 22, which is the same as the **EFLT\_SQ** definition.

**exp\_get\_int** obtains the integer value held in a specific line type. The value is stored in the integer pointer **val**. If successful, the function returns 0. Otherwise 1 is returned.

**exp\_get\_rng** obtains the range values held in a specific line type. The values are stored in the integer pointers **from** and **to**. If successful, the function returns 0. Otherwise 1 is returned.

**exp\_get\_str** obtains the string value held in a specific line type. The value is stored in the string **s**. At most **s\_l** characters are copied. If successful, the function returns 0. Otherwise 1 is returned.

**exp\_put\_int** writes the integer pointed to by **val** to the specified line type. If successful, the function returns 0. Otherwise 1 is returned.

**exp\_put\_rng** writes the range pointed to by **from** and **to** to the specified line type. If successful, the function returns 0. Otherwise 1 is returned.

**exp\_put\_str** writes the string **s** of length **s\_l** to the specified line type. If successful, the function returns 0. Otherwise 1 is returned.

**exp\_print\_line** outputs all entries of the specified type to the specified file pointer.

**exp\_print\_seq**

**exp\_print\_file** outputs all entries of all line types to the specified file pointer.

**opos2str** converts an array of original positions held in **opos** with **len** elements to a string suitable for use in the ON line type. The **buf** should be large enough to hold the string, which in the worst case will be 4 \* sequence length. Returns **buf**.

**str2opos** converts the experiment file original position string held in **buf** to an array of original positions to be stored in **opos**. **opos** must be large enough to hold the data, hence it should be of the same length as the sequence. Returns the number of elements written to the **opos** array.

**conf2str** converts an array of confidence values helf in **confR with len** elements to a string suitable for use in the AV line type. The **buf** should be large enough to hold the string, which in the worst case will be 4 \* sequence length. Returns **buf**.

**str2conf** convers the experiment file confidence values string held in **buf** to an array of confidence values to be stored in **conf**. **conf** must be large enough to hold the data, hence it should be of the same length as the sequence. Returns the number of elements written to the **conf** array.

## SEE ALSO

**ExperimentFile**(4)
