reformat.js

javascript bioinformatics format converter and validator

Usage no npm install needed!

<script type="module">
  import reformatJs from 'https://cdn.skypack.dev/reformat.js';
</script>

README

Reformat.js

Reformat.js is a small javascript library for format conversions.

Formats

The converter covers the following formats: fasta, clustal, phylip, stockholm, pir, embl, genbank, a3m, nexus

Usage

You will need to include jQuery in order to use this library.

Methods

e.g. fasta: Returns the sequence as fasta.

var fasta = $('#myClustal').reformat('fasta');

getGIs: Returns GI numbers.

var giArray = $('#mySequences').reformat('getgis');

consensus: Returns the consensus sequence of an alignment as a string.

var consensus = $('#myAlignment').reformat('consensus');

alignment: Validates if input is alignment

$('#mySequences').reformat('alignment');

type: validates type of input sequence, either DNA, RNA, Protein or undefined

$('#mySequences').reformat('type');

detect: Returns the format of an input as a string.

var format = $('#mySequences').reformat('detect');

validate: Validates an input format.

$('#mySequences').validate('fasta'); // returns either true or false

alphabet: Returns the alphabet of an input.

$('#mySequences').reformat('alphabet'); // returns the characters which occur in a sequence or an alignment in alphabetical order

freq: Returns the relative frequencies of amino acids compared to literature values.

$('#mySequences').reformat('freq'); // returns the relative frequencies of amino acids compared to literature values

Attribution

Reformat.js was partially inspired by Sebastian Wilzbach's clustal parser