Skip to content

Instantly share code, notes, and snippets.

@lidaof
Created June 10, 2019 20:14
Show Gist options
  • Save lidaof/0d9a4a95decc74ce972b3883702a8426 to your computer and use it in GitHub Desktop.
Save lidaof/0d9a4a95decc74ce972b3883702a8426 to your computer and use it in GitHub Desktop.
Testing local bam
import React, { Component } from 'react';
import './App.css';
import { BamFile } from '@gmod/bam';
class App extends Component {
handleFileUpload = async (event) => {
const fileList = Array.from(event.target.files);
const baiFilehandle = fileList.filter(f => f.name.endsWith('.bai'))[0];
const bamFilehandle = fileList.filter(f => !f.name.endsWith('.bai'))[0];
const bam = new BamFile({
bamFilehandle,
baiFilehandle,
});
const header = await bam.getHeader();
console.log(header);
}
render() {
return (
<div className="App">
<input type="file" id="trackFile" multiple onChange={this.handleFileUpload} />
</div>
);
}
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment