NEXUS (.nex, .nxs)
- Import can read sequence data and distance matrices from NEXUS files.
- Export converts sequence data to the NEXUS format.
Background & Context
-
- NEXUS phylogenetic file format.
- Commonly used for storage and exchange of phylogenetic data.
- Can store DNA and protein sequences, taxa distances, alignment scores, and phylogenetic trees.
- ASCII format.
- Allows user extensions.
- Developed in the 1990s.
Import & Export
- Import["file.nex"] imports DNA or protein sequences from a NEXUS file.
- Export["file.nex",expr] exports a sequence or list of sequences to the NEXUS file.
- Import["file.nex"] returns a list of strings representing the sequences stored in the file.
- Export["file.nex",str] exports a character string representing a DNA or protein sequence to NEXUS.
- Export["file.nex",{str1,str2,…}] exports multiple sequences.
- Import["file.nex",elem] imports the specified element from a NEXUS file.
- Import["file.nex",{"elem","sub",…}] imports a subelement.
- Import["file.nex",{{elem1,elem2,…}}] imports multiple elements.
- The import format can be specified with Import["file","NEXUS"] or Import["file",{"NEXUS",elem,…}].
- Export["file.nex",expr,elem] creates a NEXUS file by treating expr as specifying element elem.
- Export["file.nex",{expr1,expr2,…},{{elem1,elem2,…}}] treats each expri as specifying the corresponding elemi.
- Export["file.nex",expr,opt1->val1,…] exports expr with the specified option elements taken to have the specified values.
- Export["file.nex",{elem1->expr1,elem2->expr2,…},"Rules"] uses rules to specify the elements to be exported.
- See the following reference pages for full general information:
-
Import, Export import from or export to a file CloudImport, CloudExport import from or export to a cloud object ImportString, ExportString import from or export to a string ImportByteArray, ExportByteArray import from or export to a byte array
Import Elements
- General Import elements:
-
"Elements" list of elements and options available in this file "Summary" summary of the file "Rules" list of rules for all available elements - Data representation elements:
-
"DistanceMatrix" distances between taxa given as a numerical matrix "Sequence" sequences given as a list of strings "Taxa" taxon names - Import uses the "Sequence" element by default.
- Additional data elements:
-
"Data" "Taxa" and "Sequence" elements combined in a list "LabeledData" list of rules for each taxon and sequence stored in the file - The Wolfram Language uses the standard IUB/IUPAC abbreviations for nucleic acids and amino acids. See the reference page for "FASTA" for detailed information.