Skip to content

importing tab-separated data #217

@ekg

Description

@ekg

@arq5x and I were trying to import a BED file into dat:

dat init
...
curl http://quinlanlab.cs.virginia.edu/cshl2013/cpg.bed > cpg.bed
cat cpg.bed | dat import --csv --separator '\t'

This yields:

buffer.js:188                                                                                       
    throw new TypeError('First argument needs to be a number, ' +                               
          ^                                                                                     
TypeError: First argument needs to be a number, array or string.                                    
at new Buffer (buffer.js:188:15)                                                                
at new Parser (/usr/local/lib/node_modules/dat/node_modules/csv-parser/index.js:17:52)          
at module.exports (/usr/local/lib/node_modules/dat/node_modules/csv-parser/index.js:163:10)     
at parseCSV (/usr/local/lib/node_modules/dat/lib/write-stream.js:121:7)                         
at parseStream (/usr/local/lib/node_modules/dat/lib/write-stream.js:98:44)                      
at writeStream (/usr/local/lib/node_modules/dat/lib/write-stream.js:17:16)                      
at Object.dat.createWriteStream (/usr/local/lib/node_modules/dat/lib/commands.js:737:10)        
at module.exports (/usr/local/lib/node_modules/dat/bin/import.js:27:20)                         
at execCommand (/usr/local/lib/node_modules/dat/cli.js:66:22)                                   
at Server.<anonymous> (/usr/local/lib/node_modules/dat/lib/commands.js:230:11)                  

As a workaround, we convinced dat that the tab-separated data is csv:

cat ../cpg.bed | tr '\t' ',' | dat import --csv

Which made it happy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions