# fam-parser

> FAM file parser

Latest version **0.0.18** (published 2017-11-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install fam-parser
pnpm add fam-parser
yarn add fam-parser
bun add fam-parser
```

Provides the command `fam-parser`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.18 |
| Published | 2017-11-15 |
| First published | 2015-08-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jeroen F.J. Laros |
| Maintainers | jfjlaros |
| Keywords | fam, pedigree, parser |

## Links

- npm: https://www.npmjs.com/package/fam-parser
- Repository: https://git.lumc.nl/pedigree/fam-parser
- npm.io page: https://npm.io/package/fam-parser

## Dependencies (2)

- [js-yaml](https://npm.io/package/js-yaml.md) ^3.3.1
- [bin-parser](https://npm.io/package/bin-parser.md) ^0.0.13

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 0.0.18 (latest) — 2017-11-15
- 0.0.17 — 2015-10-26
- 0.0.16 — 2015-10-18
- 0.0.14 — 2015-10-18
- 0.0.13 — 2015-10-18
- 0.0.12 — 2015-10-04
- 0.0.11 — 2015-10-04
- 0.0.10 — 2015-08-29
- 0.0.9 — 2015-08-29

## README

# FAM file parser

A library for parsing FAM files from Python or Javascript.


## Python library

Installation:

    pip install fam-parser

Use as a library:

    import sys
    from fam_parser import FamParser

    parser = FamParser()
    parser.read(open(example.fam'))
    parser.write(sys.stdout)

Command line invocation:

    fam_parser example.fam -

You can also invoke it directly from the repository root directory without
installation:

    python -m python.fam_parser example.fam -


## Javascript library

Installation:

    npm install fam-parser

Installation from source:

    npm install
    npm run dist

Use as a library:

    var FamParser = require('fam-parser');

    var parser = new FamParser(fs.readFileSync(
      'example.fam').toString('binary')
    );

    parser.getMembers().forEach(function(member) {
      console.log(member.SURNAME);
    });

Command line invocation:

    ./node_modules/.bin/fam-parser example.fam

(Or, if you installed globally using `npm install -g`, the `fam-parser` binary
should be in your `$PATH`.)

You can also invoke it directly from the repository root directory without
installation:

    node javascript/cli.js example.fam


## Development of the FAM parser

We use the Python implementation for most of the development as it includes
more debugging functionality. Any changes are later lifted to the Javascript
implementation.

### Preparations
First, make sure that `wine` is installed and that your CPU allows execution of
16-bit instructions:

    echo 1 > /proc/sys/abi/ldt16

### Reverse engineering
Run Cyrillic:

    wine cyrillic.exe

And start editing a pedigree. Use `xxd` and `watch` to find differences:

    while true; do watch --differences=permanent xxd pedigree.fam; done

Press `Ctrl+c` to clear the highlights.

### Debugging
If something is wrong, then probably a skipped field is now assumed to be of
fixed size, while it should be of variable size. To find the offending field,
add the following line to the function `_set_field`:

    print name

The offending field is probably one of the unnamed fields above the one you
found, hopefully the nearest one.

Now you can give the unnamed field a name so you can inspect its content.

    while true; do
      watch --differences=permanent \
        "fam_parser -d pedigree.fam - | tail -100 | head -50"
    done

Vary the values for `head` and `tail` to focus on the part of the output you
want to inspect.

---
_Source: https://npm.io/package/fam-parser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
