src/main/sources/BigBedDataSource.js
function parseBedFeature(f): Gene {
  var position = new ContigInterval(f.contig, f.start, f.stop),
      x = f.rest.split('\t');

  // if no id, generate randomly for unique storage
  var id = x[0] ? x[0] : position.toString(); // e.g. ENST00000359597
  var score = x[1] ? parseInt(x[1]) : 1000; // number from 0-1000
  var strand =  strToStrand(x[2]); // either +, - or .
  var codingRegion = (x[3] && x[4]) ? new Interval(Number(x[3]), Number(x[4])) :new Interval(f.start, f.stop);
  var geneId =  x[9] ? x[9] : id;
  var name =  x[10] ? x[10] : "";

  // parse exons
  var exons = [];
  if (x[7] && x[8]) {
    // exons arrays sometimes have trailing commas
    var exonLengths = x[7].replace(/,*$/, '').split(',').map(Number),
      exonStarts = x[8].replace(/,*$/, '').split(',').map(Number);

    exons = _.zip(exonStarts, exonLengths)
             .map(function([start, length]) {
               return new Interval(f.start + start, f.start + start + length);
             });
  }

  return new Gene({
    position,
    id: id,
    score: score,
    strand: strand,
    codingRegion: codingRegion,
    geneId: geneId,
    name: name,
    exons
  });
}
function parseBedFeature(f): Gene {
  var position = new ContigInterval(f.contig, f.start, f.stop),
      x = f.rest.split('\t');

  // if no id, generate randomly for unique storage
  var id = x[0] ? x[0] : position.toString(); // e.g. ENST00000359597
  var score = x[1] ? parseInt(x[1]) : 1000; // number from 0-1000
  var strand =  strToStrand(x[2]); // either +, - or .
  var codingRegion = (x[3] && x[4]) ? new Interval(Number(x[3]), Number(x[4])) :new Interval(f.start, f.stop);
  var geneId =  x[9] ? x[9] : id;
  var name =  x[10] ? x[10] : "";

  // parse exons
  var exons = [];
  if (x[7] && x[8]) {
    // exons arrays sometimes have trailing commas
    var exonLengths = x[7].replace(/,*$/, '').split(',').map(Number),
      exonStarts = x[8].replace(/,*$/, '').split(',').map(Number);

    exons = _.zip(exonStarts, exonLengths)
             .map(function([start, length]) {
               return new Interval(f.start + start, f.start + start + length);
             });
  }

  return new Gene({
    position,
    id: id,
    score: score,
    strand: strand,
    codingRegion: codingRegion,
    geneId: geneId,
    name: name,
    exons
  });
}
function parseBedFeature ( f ) : Gene { var position = new ContigInterval ( f . contig , f . start , f . stop ) , x = f . rest . split ( '\t' ) ; // if no id, generate randomly for unique storage var id = x [ 0 ] ? x [ 0 ] : position . toString ( ) ; // e.g. ENST00000359597 var score = x [ 1 ] ? parseInt ( x [ 1 ] ) : 1000 ; // number from 0-1000 var strand = strToStrand ( x [ 2 ] ) ; // either +, - or . var codingRegion = ( x [ 3 ] && x [ 4 ] ) ? new Interval ( Number ( x [ 3 ] ) , Number ( x [ 4 ] ) ) : new Interval ( f . start , f . stop ) ; var geneId = x [ 9 ] ? x [ 9 ] : id ; var name = x [ 10 ] ? x [ 10 ] : "" ; // parse exons var exons = [ ] ; if ( x [ 7 ] && x [ 8 ] ) { // exons arrays sometimes have trailing commas var exonLengths = x [ 7 ] . replace ( / ,*$ / , '' ) . split ( ',' ) . map ( Number ) , exonStarts = x [ 8 ] . replace ( / ,*$ / , '' ) . split ( ',' ) . map ( Number ) ; exons = _ . zip ( exonStarts , exonLengths ) . map ( function ( [ start , length ] ) { return new Interval ( f . start + start , f . start + start + length ) ; } ) ; } return new Gene ( { position , id : id , score : score , strand : strand , codingRegion : codingRegion , geneId : geneId , name : name , exons } ) ; }
The fields are described at http://genome.ucsc.edu/FAQ/FAQformat#format1 Fields 4-12 are optional
The fields are described at http : // genome . ucsc . edu / FAQ / FAQformat#format1 Fields 4 - 12 are optional