npm package: @lipme/ts-biofiledetector
Description: A set of function to detect bioinformatics file types (bam, gff3, bed, vcf, tsv, bigwig)
Author: Sebastien Carrere
Latest version: 0.0.18

# TS-BIOFILEDETECTOR

## Overview

A set of function to predict file formats

Formats included:

- Fasta (proteic/nucleic)
- GFF3 (annotation/alignment)
- BED
- VCF
- TSV, with specific typing of :
  - [OrthoFinder](https://davidemms.github.io/orthofinder_tutorials/exploring-orthofinders-results.html)
  - [InterProScan](https://interproscan-docs.readthedocs.io/en/latest/OutputFormats.html)
  - [Nicknames](https://forgemia.inra.fr/lipme/nicknames-pipeline)
  - [PAF](https://github.com/lh3/miniasm/blob/master/PAF.md)
  - [Differential Gene Expression Table](https://bioconductor.org/packages/release/bioc/manuals/edgeR/man/edgeR.pdf)
- BAM
- BigWig

## Installation

```bash
npm i @lipme/ts-biofiledetector
```

## Usage

```javascript
import { getFileFormat } from "@lipme/ts-biofiledetector";
```

## Output

- Fasta

```javascript
{
  format: "fasta",
  valid: true|false,
  metadata: {
    type: "dna|protein",
    category: "sequence",
    seqids: ['list','of','seqids']
    error?: { 'errorType' : ['list', 'of', 'erroneous', 'lines']}
  }
}
```

- GFF3

```javascript
{
    format: "gff3",
    valid: true|false,
    metadata: {
    type: "annotation|alignment",
    category: "annotation|alignment",
    seqids: ['list','of','seqids'],
    features: ['list', 'of', 'features'],
    attributes: {'list' : 'cardinality', 'of' : 'cardinality', 'attributes' : 'cardinality'},
    error?: { 'errorType' : ['list', 'of', 'erroneous', 'lines']}
  }
}
```

- BED

```javascript
{
  format: "bed",
  valid: true|false,
  metadata: {
    type: "bed3|bed4|bed6|bed9|bed12",
    category: "annotation",
    seqids: ['list','of','seqids'],
    columns: "numberOfColumns",
    withBrowser: true|false, //browser line found
    withTrack: true|false, //track line found
    error?: { 'errorType' : ['list', 'of', 'erroneous', 'lines']}
  }
}
```

- VCF

```javascript
{
  format: "vcf",
  valid: true|false,
  metadata: {
    type: "VCFversion",
    category: "polymorphism",
    seqids: ['list','of','seqids'],
    samples: ['list','of','samples'],
    fields: {'INFO', 'and', 'FORMAT', 'metadata'}
    error?: { 'errorType' : ['list', 'of', 'erroneous', 'lines']}
    }
}
```

- TSV

```javascript
{
  format: "tsv",
  valid: true|false,
  metadata: {
    type: "tsvX|orthofinder|interproscan|nicknames",
    category: "table",
    columns: "numberOfColumns",
    lines: "numberOfLines",
    explicitHeader: true|false, //true if first line stars with '#'
    header:: ['list','of','field','names'],
    error?: { 'errorType' : ['list', 'of', 'erroneous', 'lines']}
    }
}
```

- BAM

```javascript
{
  format: "bam",
  valid: true,
  metadata: {
    type: "alignment",
    category: "alignment",
    seqids: ['list', 'of', 'seqids'], // @SQ lines
    programs: ['list', 'of', 'programs']  //@PG lines
  }
}
```

- BigWig

```javascript
{
  format: "bigwig",
  valid: true,
  metadata: {
    type: "quantitative",
    category: "quantitative",
    seqids: ['list', 'of', 'seqids'], // @SQ lines
    version: 'bigwigVersion'
  }
}
```

## License

This project is licensed under the Apache License 2.0. See the [LICENSE](LICENSE) file for details.

## Contact

For questions or feedback, please open an issue or contact us at sebastien.carrere@inrae.fr