Converts a string into the bioUtils JSON format
(string)
input data using '\n' for line breaks; can be fasta, fna, nexus or newick
(object)
any metadata to be appended to the bioUtils JSON object
object
:
the bioUtils JSON object {'sequences':
[{'name': string, 'sequence': string}]
,'tree': string,'metaData': {'fileType': string, (metaData param)}}
inputData('>seq1\nact\n>seq2\natc\n(seq1,seq2);', {'fileType': 'fna', 'otherMetaData': 'this is an example'})
// returns {'sequences': [ {name:'seq1', sequence:'act'}, {name:'seq2', sequence:'atc'} ],
// 'tree': '(seq1,seq2);',
// 'metaData': {'fileType': 'fna', 'otherMetaData': 'this is an example'})
// }
Converts file into the bioUtils JSON format. Just wraps the inputData
function for easier use.
-- NODE ONLY --
(string)
a relative or absolute file path
(object)
any metadata to be appended to the bioUtils JSON object
object
:
the bioUtils JSON object {'sequences':
[{'name': string, 'sequence': string}]
,'tree': string,'metaData': {'fileType': string}}
Converts a bioUtils JSON object to a string in one of the supported file formats
(object)
the bioUtils JSON object {'sequences':
[{'name': string, 'sequence': string}]
,'tree': string,'metaData': {'fileType': string}}
(string)
the desired filetype for the output string, if none is given the function will default to the filetype in the dataObject metaData
string
:
the data string in a particular file type format using '\n' for line breaks; can be fasta, fna, nexus or newick
Writes a bioUtils json object to a file in a standard format (fasta, fna, nexus or newick). Just wraps the outputData
function for easier use.
-- NODE ONLY --
(any)
(string)
a relative or absolute file path
(string)
the type of file to write: fasta, fna, nexus or newick; if none is give than the fileType from the dataObject metaData will be used
(object)
bioUtils JSON object {'sequences':
[{'name': string, 'sequence': string}]
,'tree': string,'metaData': {'fileType': string}}
null
:
This function writes a file but does not return anything.
Converts a fasta string into a bioUtils object
(string)
input fasta string using '\n' for line breaks
(object)
any metadata to be appended to the bioUtils JSON object
object
:
the bioUtils JSON object {'sequences':
[{'name': string, 'sequence': string}]
,'tree': undefined,'metaData': {'fileType': string, (metaData param)}}
Converts a fna string into a bioUtils object
(string)
input fna string using '\n' for line breaks
(object)
any metadata to be appended to the bioUtils JSON object
object
:
the bioUtils JSON object {'sequences':
[{'name': string, 'sequence': string}]
,'tree': string,'metaData': {'fileType': string, (metaData param)}}
inputData('>seq1\nact\n>seq2\natc\n(seq1,seq2);')
// returns {'sequences': [ {'seq1': 'act'}, {'seq2': 'atc'} ],
// 'tree': '(seq1,seq2);',
// 'metaData': {'fileType': 'fna'})
// }
Converts a newick string into a bioUtils object
(string)
input newick string using '\n' for line breaks
(object)
any metadata to be appended to the bioUtils JSON object
object
:
the bioUtils JSON object {'sequences': []],'tree': string,'metaData': {'fileType': string, (metaData param)}}
Converts a newick string into a bioUtils object TODO: This is currently only handling a small subset of nexus formats and data. TODO: This was written with simplicity and readability in mind; it can and should be speed up a bit though.
(string)
input newick string using '\n' for line breaks
(object)
any metadata to be appended to the bioUtils JSON object
object
:
the bioUtils JSON object {'sequences': [],'tree': string,'metaData': {'fileType': string, (metaData param)}}
Determins if any of the sequences contain stop codons
(object)
the bioUtils JSON object
(string)
the genetic code to use for looking for stop codons
boolean
:
whether or not the data contains stop codons
(object)
the bioUtils JSON object
int
:
The number of sites of sites of the fist sequence counting gaps
(object)
the bioUtils JSON object
int
:
The number of sequences
Attempt to quantify the diversity of an alignment using Shannon entropy
(object)
a bioUtils JSON object
list
:
a list of the diversity for each site
Translate a codon bioUtils json object into an amino acid bioUtils json object.
(object)
the bioUtils JSON object
(string)
the genetic code to use for translating codons to amino acids
object
:
the translated dataObject the bioUtils JSON object
return a list of strings where each string is a site (0 -> numbrer of sites) and each character in the string is the character at that site and corresponding sequence (sequences listed in the same, decending order of the MSA)
(object)
the bioUtils JSON object
list
:
the list of strings
const simpleBioUtilsObject = bioUtils.inputData('>seq1\nACT\n>seq2\nATC')
getSitesAsListOfStrings(simpleBioUtilsObject)
// returns ['AA', 'CT', 'TC']