How to use bio-parsers - 8 common examples

To help you get started, we’ve selected a few bio-parsers examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TeselaGen / openVectorEditor / src / withEditorProps / index.js View on Github external
reader.onload = function(evt) {
    const content = evt.target.result;
    anyToJson(
      content,
      async result => {
        // TODO maybe handle import errors/warnings better
        const failed = !result[0].success;
        const messages = result[0].messages;
        if (messages && messages.length) {
          messages.forEach(msg => {
            const type = msg
              .substr(0, 20)
              .toLowerCase()
              .includes("error")
              ? failed
                ? "error"
                : "warning"
              : "info";
            window.toastr[type](msg);
github TeselaGen / openVectorEditor / demo / src / exampleData / getJsonFromGenbankFile.js View on Github external
const bioParsers = require('bio-parsers')
const fs = require('fs')

const string = fs.readFileSync('./exampleData/JBx_078420.gb',"utf8")
console.info('string:',string)
bioParsers.genbankToJson(string, (res) => {
  console.info('res[0].parsedSequence:',JSON.stringify(res[0].parsedSequence,null,4))
})
github TeselaGen / openVectorEditor / src / Editor / DropHandler.js View on Github external
reader.onload = function(evt: Object) {
      const content: string = evt.target.result;
      anyToJson(
        content,
        result => {
          updateSequenceData(result[0].parsedSequence);
        },
        { fileName: file.name, acceptParts: true }
      );
    };
    reader.onerror = function() {
github TeselaGen / openVectorEditor / src / ToolBar / alignmentTool.js View on Github external
flatMap(files, async file => {
      const results = await anyToJson(file.originalFileObj, {
        fileName: file.name,
        acceptParts: true
      });
      return results.forEach(result => {
        if (result.success) {
          array.push("addedSequences", result.parsedSequence);
        } else {
          return window.toastr.warning("Error parsing file: ", file.name);
        }
      });
    });
    onChange([]);
github TeselaGen / openVectorEditor / src / helperComponents / PropertiesDialog / GenbankView.js View on Github external
render() {
    const { sequenceData = {} } = this.props;
    let filestring;
    switch (this.state.fileTypeToView) {
      case "fasta":
        filestring = jsonToFasta(sequenceData);
        break;
      case "teselagen":
        filestring = JSON.stringify(
          cleanUpTeselagenJsonForExport(sequenceData),
          null,
          4
        );
        break;
      default:
        filestring = jsonToGenbank(sequenceData);
    }

    return (
      <div>
         {
            this.setState({ fileTypeToView: e.target.value });
          }}
        /&gt;
        </div>
github TeselaGen / openVectorEditor / src / withEditorInteractions / index.js View on Github external
function getGenbankFromSelection(selectedSeqData, sequenceData) {
  const spansEntireSeq =
    sequenceData.sequence.length === selectedSeqData.sequence.length;
  const feats = map(selectedSeqData.features);
  const just1Feat = feats.length === 1;

  return {
    sequence: jsonToGenbank({
      ...selectedSeqData,
      name: spansEntireSeq
        ? selectedSeqData.name
        : just1Feat
        ? feats[0].name
        : selectedSeqData.name + "_partial",
      circular: spansEntireSeq ? selectedSeqData.circular : false
    })
  };
}
github TeselaGen / openVectorEditor / src / helperComponents / PropertiesDialog / GenbankView.js View on Github external
render() {
    const { sequenceData = {} } = this.props;
    let filestring;
    switch (this.state.fileTypeToView) {
      case "fasta":
        filestring = jsonToFasta(sequenceData);
        break;
      case "teselagen":
        filestring = JSON.stringify(
          cleanUpTeselagenJsonForExport(sequenceData),
          null,
          4
        );
        break;
      default:
        filestring = jsonToGenbank(sequenceData);
    }

    return (
      <div>
        </div>
github TeselaGen / openVectorEditor / src / helperComponents / PropertiesDialog / GenbankView.js View on Github external
render() {
    const { sequenceData = {} } = this.props;
    let filestring;
    switch (this.state.fileTypeToView) {
      case "fasta":
        filestring = jsonToFasta(sequenceData);
        break;
      case "teselagen":
        filestring = JSON.stringify(
          cleanUpTeselagenJsonForExport(sequenceData),
          null,
          4
        );
        break;
      default:
        filestring = jsonToGenbank(sequenceData);
    }

    return (
      <div>
        </div>

bio-parsers

A library of parsers for interconverting between genbank, fasta, and (eventually) sbol through Teselagen's intermediary json format

MIT
Latest version published 2 years ago

Package Health Score

45 / 100
Full package analysis