biotech-js
TypeScript icon, indicating that this package has built-in type declarations

1.0.10 • Public • Published

biotech-js

Documentation

Package initially developed at and for A&A Biotechnology for reading all kinds of biotechnology related files.

Currently it supports fastq, fasta and genbank files.

Usage

Reading Fasta file

import { FastaSequenceFile, ProcessingStatus } from "biotech-js";

const file = new FastaSequenceFile("path/to/file.fa");
await file.process();

expect(file.processingStatus).toBe(ProcessingStatus.SuccessFinished);
expect(file.sequences.length).toBe(12345);
expect(file.tookMs).toBeLessThan(1000);

await file.save();
// Default output path is "path/to/file_processed.fa"
// But you can customize it by passing a path to the save method
await file.save("path/to/file2.fa");

Reading Fastq file

import { FastqSequenceFile, ProcessingStatus } from "biotech-js";

const file = new FastqSequenceFile("path/to/file1.fastq");
await file.process();

expect(file.processingStatus).toBe(ProcessingStatus.SuccessFinished);
expect(file.sequences.length).toBe(12345);
expect(file.tookMs).toBeLessThan(1000);

await file.save("path/to/file2.fastq");

Reading Genbank file

import { GenbankSequencesFile, ProcessingStatus } from "biotech-js";

const file = new GenbankSequencesFile("path/to/file1.gb");
await file.process();

expect(file.processingStatus).toBe(ProcessingStatus.SuccessFinished);
expect(file.sequences.length).toBe(12345);
expect(file.tookMs).toBeLessThan(1000);

await file.save("path/to/file2.gb");

Detecting file extension

import { FileExtensionHandler } from "biotech-js";

const path = "path/to/file.fa";
const pathExtension = path.split(".").pop();

const extension = FileExtensionHandler.fileExtensionToEnum(pathExtension);
console.log(extension);
// Output: Fasta

Deployment

When deploying the library to npm run:

yarn b

Package Sidebar

Install

npm i biotech-js

Weekly Downloads

8

Version

1.0.10

License

MIT

Unpacked Size

98.5 kB

Total Files

56

Last publish

Collaborators

  • tomek7667