VCF parser for eventual genomic data visualization
Your code is good, but it could be improved:



Nesting

Try and avoid massive nesting like this, but reversing the conditions and continueing:


class Genome {
  constructor(name) {
      this.name = name
      // Find genotype by rs-ID without having to know chromosome
      this.findByRsId = (rs_id) =&gt; {
        for(var chr in this) {
          if (chr.substring(0, 1) === 'c') {
            for(var id in this[chr]) {
              if (id == rs_id) {
                return this[chr][rs_id]
              }
            }
          }
        }
      }



Into something a little less nested:

class Genome {
  constructor(name) {
      this.name = name
      // Find genotype by rs-ID without having to know chromosome
      this.findByRsId = (rs_id) =&gt; {
        for(var chr in this) {
          if (chr.substring(0, 1) !== 'c') continue;
          for(var id in this[chr]) {
            if (id != rs_id) continue;
            return this[chr][rs_id]
          }
        }
      }




Consistency

This is the only semi-colon you use in your entire script:


const fs = require('fs');



You should keep your consistency in check, and either do or don't use semicolons (I would suggest the former), but keep consistent.



Naming

You're shouldn't be sacrificing readability in your code just to save space.


getSampGenotype: Literally two characters missing to massively improve readability
handleGFGChunk: This could be improved, however I would assume those working your code would know what it means, I, on the other hand, don't.


What is rs??!??

You use the abbreviation/term rs everywhere in your code, but to anyone without a doctorate, this might not be clear.



switch it to better code:

Excuse the horrible pun there, but...

Your switch statement can be simplified:


      case '0':
        return rs.genotype
        break
      case '1':
        return rs.genotype
        break
      default:
        return rs.genotype
        break



Here, you're defining multiple cases that have the same result.

There's two ways to approach this problem, while the first is better for readability, it's redundant in this case not to use the second

switch statements use fall throughs, which means, if you don't explictly declare break, it will keep falling down and down.

Take this snippet for example:



document.getElementById("testbutton").addEventListener('click', function(){
    var sample = "ACTA",
        result = "";
    switch(sample){
        case "ACTA":
            result += "A";
        case "AATC":
            result += "B";
        case "UUCA":
            result += "C";
        case "FAIL":
            result += "D";
        default:
            result += "E";
    }
    document.getElementById("content").innerText = result;
});
&lt;button width="200" height="200 id="testbutton"&gt;Test&lt;/button&gt;
&lt;div id="content"&gt;&lt;/div&gt;




What do you think would print?


   You would expect that to print A, because it's the only case that matches, but because it falls through, it catches all of them and alerts ABCDE.


Change sample to UUCA and watch what happens:


   CDE is alerted.


Number 1: So, seeing as content inside a case is optional, as shown above, you can "merge" cases, like the following:

      case '0': case '1': default:
        return rs.genotype
        break


However, Number 2: default is a catch-all of sorts, anything that isn't declared as a case above is caught by default, so not declaring case '0' and case '1' is  the same as declaring them in this case.

Depending on how you feel about readability, you could make it look like:

      case '0': case '1': default:
        return rs.genotype
        break


Which, while redundant, it readably shows that cases 0, 1 have been considered and their result determined.



Indentation:

Your block at the moment, looks like this:

(function iife() {

'use strict'
class Genome {
  constructor(name) {
  }
}
})()


I see two things wrong with this:


After your IIFE declaration, there isn't an added indentation
You're using two-space indentation, when you should be using four-space indentation.




Duplication:

You have a bit of duplication in this code block:


if(!myGenotypes["chr_"+row[0]]) {
  myGenotypes["chr_"+row[0]] = {}
} else {
  // If no rs_[num] exists, make one and set it to genotype
  if (!myGenotypes["chr_"+row[0]][row[2]]) {
    myGenotypes["chr_"+row[0]][row[2]] = {
      'genotype': row[3]+row[4],
      'quality': row[6],
      'fit': row[9]
    }
  }
}



See how many times you needed to call "chr_" +row[0]? That's how you know you deserve a variable.

var propertyName = "chr_" + row[0]
if(!myGenotypes[propertyName]) {
  myGenotypes[propertyName] = {}
} else {
  // If no rs_[num] exists, make one and set it to genotype
  var subPropertyName = row[2]
  if (!myGenotypes[propertyName][subPropertyName]) {
    myGenotypes[propertyName][subPropertyName] = {
      'genotype': row[3] + row[4],
      'quality': row[6],
      'fit': row[9]
    }
  }
}




Magic numbers:

Building on the last point, you call array indexes at 0, 2, 3, 4, 6, 9:

What are these points? What is at row[0] that may or may not be in myGenotypes?

You ought to move these array indexes to their own variables to declare the importance that each of these indexes holds.



Object and array properties

An object's properties can be accessed in two different ways: Object.property or Object[property].

In JavaScript, an array is basically an object where the index position is the key, however you cannot use the first syntax option with arrays.

Normally, you would use the Object.property version to visually show that this variable is an Object and not an array,
whereas you would use Object[property] when you have to load the property in from a variable, and not specifically by name:

var property = "cats";
Object.cats == Object[property];




IIFE:

In your IIFE, you give it the name iife, however in an IIFE that function name has no meaning, the function itself is discarded in favour of its result, meaning the name is redundant.



Miscellanous:


  this.getRefGenotype = (rs_id) =&gt; {
    var rs = this.findByRsId(rs_id)
    return rs.genotype
  }



This can be simplified down to:

  this.getRefGenotype = (rs_id) =&gt; {
    return this.findByRsId(rs_id).genotype
  }