How to use the d3-fetch.tsv function in d3-fetch

To help you get started, we’ve selected a few d3-fetch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jwilber / roughViz / src / Donut.js View on Github external
return () => {
          tsv(data).then(d => {
            // console.log(d);
            this.data = d;
            this.drawFromFile();
          });
        };
      } else if (data.includes('.json')) {
github broadinstitute / gtex-viz / src / scripts / CramFileQuery.js View on Github external
export function launch(tableId, datasetId='gtex_v7', googleFuncDict=googleFunc(), urls=getGtexUrls()){
    const promises = [
        json(urls.tissue),
        tsv(urls.rnaseqCram), // rnaseq cram file info
        tsv(urls.wgsCram), // wgs cram file info
        tsv(urls.sample), // GTEx sample TSV file: for better performance
    ];

    Promise.all(promises)
        .then(function(args){
            let tissues = parseTissues(args[0]); // get GTEx tissue objects
            const cram = {
                rnaseq: args[1].reduce((a, d)=>{a[d.sample_id.toUpperCase()]=d; return a;}, {}),
                wgs: args[2].reduce((a, d)=>{a[d.sample_id.toUpperCase()]=d; return a;}, {})
            };
            // parse Samples
            let samples = args[3]
                .filter((s)=>s.datasetId==datasetId)
                .map((s)=>{
                    switch (s.dataType){
                        case "WGS": {
                            if (!cram.wgs.hasOwnProperty(s.sampleId)) throw s.sampleId + ' has no cram files';
github broadinstitute / gtex-viz / src / CramFileQuery.js View on Github external
export function launch(tableId, datasetId='gtex_v7', googleFuncDict=googleFunc(), urls=getGtexUrls()){
    const promises = [
        json(urls.tissue),
        tsv(urls.rnaseqCram), // rnaseq cram file info
        tsv(urls.wgsCram), // wgs cram file info
        tsv(urls.sample), // GTEx sample TSV file: for better performance
    ];

    Promise.all(promises)
        .then(function(args){
            let tissues = parseTissues(args[0]); // get GTEx tissue objects
            const cram = {
                rnaseq: args[1].reduce((a, d)=>{a[d.sample_id.toUpperCase()]=d; return a;}, {}),
                wgs: args[2].reduce((a, d)=>{a[d.sample_id.toUpperCase()]=d; return a;}, {})
            };
            // parse Samples
            let samples = args[3]
                .filter((s)=>s.datasetId==datasetId)
                .map((s)=>{
                    // find the right CRAM manifest file
                    switch (s.dataType){
github broadinstitute / gtex-viz / src / CramFileQuery.js View on Github external
export function launch(tableId, datasetId='gtex_v7', googleFuncDict=googleFunc(), urls=getGtexUrls()){
    const promises = [
        json(urls.tissue),
        tsv(urls.rnaseqCram), // rnaseq cram file info
        tsv(urls.wgsCram), // wgs cram file info
        tsv(urls.sample), // GTEx sample TSV file: for better performance
    ];

    Promise.all(promises)
        .then(function(args){
            let tissues = parseTissues(args[0]); // get GTEx tissue objects
            const cram = {
                rnaseq: args[1].reduce((a, d)=>{a[d.sample_id.toUpperCase()]=d; return a;}, {}),
                wgs: args[2].reduce((a, d)=>{a[d.sample_id.toUpperCase()]=d; return a;}, {})
            };
            // parse Samples
            let samples = args[3]
                .filter((s)=>s.datasetId==datasetId)
                .map((s)=>{
                    // find the right CRAM manifest file
                    switch (s.dataType){
                        case "WGS": {
github jwilber / roughViz / src / Pie.js View on Github external
return () => {
          tsv(data).then(d => {
            console.log(d);
            this.data = d;
            this.drawFromFile();
          });
        };
      } else if (data.includes('.json')) {
github jwilber / roughViz / src / Scatter.js View on Github external
return () => {
          tsv(data).then(d => {
            this.data = d;
            this.drawFromFile();
          });
        };
      }
github jwilber / roughViz / src / StackedBar.js View on Github external
return () => {
          tsv(data).then(d => {
            this.getTotal(d);
            this.data = d;
            this.drawFromFile();
          });
        };
      }
github jwilber / roughViz / src / Line.js View on Github external
return () => {
          tsv(data).then(d => {
            this.data = d;
            this.drawFromFile();
          });
        };
      }
github CreatingData / deepscatter / src / deepscatter.js View on Github external
that.load_preset_buttons = function () {
    const presets = that.add_card_section('Some interesting locations', '', 'presets');

    d3Fetch.tsv(`${base_dir}/presets.tsv`).then((dat) => {
      const buttons = presets.selectAll('a').data(dat);
      buttons.enter()
        .append('a')
        .attr('class', 'btn')
        .text(d => d.label)
        .on('click', (d) => {
          that.zoom_to(d.z, d.x, d.y);
        });
    });
    return that;
  };