diff --git a/src/APIInterface.mjs b/src/APIInterface.mjs
new file mode 100644
index 00000000..4e7b86ef
--- /dev/null
+++ b/src/APIInterface.mjs
@@ -0,0 +1,42 @@
+
+// Interface for handling function called from the tubemap frontend
+// Abstract class expecting different implmentations of the following functions
+// Substituting different subclasses should allow the functions to give the same result
+export class APIInterface {
+ // Takes in and process a tube map view(viewTarget) from the tubemap container
+ // Expects a object to be returned with the necessary information to draw a tubemap from vg
+ // object should contain keys: graph, gam, region, coloredNodes
+ async getChunkedData(viewTarget) {
+ throw new Error("getChunkedData function not implemented");
+ }
+
+ // Returns files used to determine what options are available in the track picker
+ // Returns object with keys: files, bedFiles
+ async getFilenames() {
+ throw new Error("getFilenames function not implemented");
+ }
+
+ // Takes in a bedfile path or a url pointing to a raw bed file
+ // Returns object with key: bedRegions
+ // bedRegions contains information extrapolated from each line of the bedfile
+ async getBedRegions(bedFile) {
+ throw new Error("getBedRegions function not implemented");
+ }
+
+ // Takes in a graphFile path
+ // Returns object with key: pathNames
+ // Returns pathnames available in a graphfile
+ async getPathNames(graphFile) {
+ throw new Error("getPathNames function not implemented");
+ }
+
+ // Expects a bed file(or url) and a chunk name
+ // Attempts to download tracks associated with the chunk name from the bed file if it is a URL
+ // Returns object with key: tracks
+ // Returns tracks found from local directories as a tracks object
+ async getChunkTracks(bedFile, chunk) {
+ throw new Error("getChunkTracks function not implemented");
+ }
+}
+
+export default APIInterface;
\ No newline at end of file
diff --git a/src/App.js b/src/App.js
index 8e24a5d0..d46f0dc5 100644
--- a/src/App.js
+++ b/src/App.js
@@ -14,6 +14,7 @@ import Footer from "./components/Footer";
import { dataOriginTypes } from "./enums";
import "./config-client.js";
import { config } from "./config-global.mjs";
+import ServerAPI from "./ServerAPI.mjs";
const EXAMPLE_TRACKS = [
// Fake tracks for the generated examples.
@@ -46,6 +47,8 @@ class App extends Component {
constructor(props) {
super(props);
+ this.APIInterface = new ServerAPI(props.apiUrl);
+
console.log('App component starting up with API URL: ' + props.apiUrl)
// Set defaultViewTarget to either URL params (if present) or the first example
@@ -186,12 +189,14 @@ class App extends Component {
apiUrl={this.props.apiUrl}
defaultViewTarget={this.defaultViewTarget}
getCurrentViewTarget={this.getCurrentViewTarget}
+ APIInterface={this.APIInterface}
/>