New File Formats
Import and Export
The new JSON package allows import and export of files and strings in the JSON format, a popular format used by many modern applications for exchanging structured data.
Example: Import JSON data encoding the mailing address of Maplesoft headquarters.
T ≔ JSON:-ParseFileaddress.json
tableaddress=tablestreetAddress=615 Kumpf Drive,city=Waterloo,postalCode=N2V 1K8,country=Canada,province=ON,founded=1988,phoneNumbers=tabletype=local,number=+1 (519) 747-2373,tabletype=tollfree,number=+1 (800) 267-6583,tabletype=fax,number=+1 (519) 747-5284,companyName=Maplesoft
The KML file format and the related KMZ compressed format are popular XML-based map data formats which are used by many mapping applications.
KML permits geographic areas and contours to be defined using line and polygon primitives.
The new Import command, described in more detail below, can import a KML map file and represent it as a 2-D plot.
In addition to KML and KMZ, Import also supports the GPX and SHP cartographical formats.
Example: Import a four-colour KMZ map of the 48 contiguous states of the United States of America.
Importhttp://www.maplesoft.com/data/examples/kmz/CONUS.kmz, title = The Contiguous United States, titlefont = Times, Bold, 20, size = 800, 400
Biological Sequence Formats
The Import and Export commands also support three popular text-based formats for representing DNA and protein sequences: FASTA, FASTQ, and GenBank.
You can import genetic or proteinomic data into your session and use text processing tools to analyze the imported sequence.
Example: Import a DNA sequence from a FASTA file.
Study the metadata for the first sequence in the file:
Human mitochondrial genome,HVR2,CR,HVR1
Examine the nucleotide codes at positions 16200 through 16250:
Count the frequency of each of nucleotide base (A, C, G, or T) in the sequence:
frequencies ≔ StringTools:-CharacterFrequenciesmtDNASequence1,2
Graph Theory Formats
The GraphTheory package now supports six new formats for import and export: DGML
, and TGF.
For more information on supported graph-theoretic formats, see Formats.
The new Import and Export commands provide a generic command-based mechanism to move data between Maple and the operating environment.
The Import command provides a ubiquitous mechanism for importing data with a single command.
Import is agnostic of the type of data: it can handle numeric and tabular data, images, cartographic data, specialized text file formats like XML and JSON, and special-purpose formats for graph theory and linear optimization. Several examples appear below.
Import 3D Models
Import Tabular Data
Import Structured Data
M ≔ Importtimedata.csv
28 x 6 MatrixData Type: anythingStorage: rectangularOrder: Fortran_order
Mar 06 01:16 3/7/2005Mar 06 20:12 3/7/2005Mar 06 20:43 3/7/2005Mar 07 00:25 3/7/2005Mar 07 00:44 3/7/2005
615 Kumpf Drive
Graph 1: an undirected unweighted graph with 28 vertices and 42 edge(s)
The Export command provides an equally generic and powerful mechanism for exporting data from Maple with a single command.
Export to MathML
OutputFile ≔ FileTools:-JoinPathgraphic.png, base=homedir
MyGraphic ≔ dataplotE,bar,format=stacked,color=Maroon..RoyalBlue,gridlines
OutputFile ≔ FileTools:-JoinPathintegral.mml, base=homedir
Compute an integral in Maple and export it to a MathML file.
MyIntegral ≔ ∫sinx2+x ⅆx
Demonstrate that the export was successful by re-importing the data and retrieving the original expression.
Download Help Document
What kind of issue would you like to report? (Optional)