Giter Club home page Giter Club logo

haplotyping's People

Contributors

darkstarre avatar

Watchers

 avatar

Forkers

seangallen

haplotyping's Issues

Code Review #1

File: https://github.com/darkstarre/Haplotyping/blob/master/haplotypes.rb

Overall, coolbeans! Some feedback to improve it a little more:

  1. /nitpick https://github.com/darkstarre/Haplotyping/blob/master/haplotypes.rb#L9 and https://github.com/darkstarre/Haplotyping/blob/master/haplotypes.rb#L32: Should be @db (lowercase). Uppercase is usually for constants.
  2. For https://github.com/darkstarre/Haplotyping/blob/master/haplotypes.rb#L12-L18, you can simply return:
def compare(type1,type2)
  type1 == type2 # this will return true if equal, false if not equal
end
  1. Be cautious about variable assignment in conditionals. Prefer if variable assignment occurs before conditional check:
def search_for_type(type2)
  type = $classical_italy.find_all { |type| type['type'] == type2 }

  if type
    p type[0]['people']
  else
    p "No match"
  end

  # OR use a ternary operator
  type ? p type[o]['people'] : p "No match"
end
  1. Nice job on def search_database(query) method! /nitpick remove the blank newline on L33
  2. For https://github.com/darkstarre/Haplotyping/blob/master/haplotypes.rb#L42 and https://github.com/darkstarre/Haplotyping/blob/master/haplotypes.rb#L44, you can use this syntax to clean the conditionals up:
    elsif ("I", "J").include?(first)
      return $groupIJ
    elsif ("Q", "N", "K", "T", "P", "R").include?(first)
      return $groupK
    end

File: https://github.com/darkstarre/Haplotyping/blob/master/data.rb

  1. Formatting with nested hashes to make hierarchy a little clearer
  2. Are you using $ prefix to make these variables globally accessible?
# spaces before and after curly braces
$classical_italy = [{ "type" => "J2",       "people" => "Etruscans" },
                    { "type" => "E1b1b",    "people" => "Etruscans" },
                    { "type" => "G2a",      "people" => "Etruscans" },
                    { "type" => "R1b-M269", "people" => "Etruscans" }]

$group_e1b = {
  "E1b" => {
    "E1b1b" => [
      { "E-M78" => "E-V13" },
      "E-M81"
    ]
  }
}

$group_g = {
  "G" => {
    "G2a" => "G2a3"
  }
}

$group_ij = {
  "IJ" => [
    { 
      "J" => [
        { "J2" => "J2b" },
        "J1"
      ]
    },
    { 
      "i" => [
        { "pre-I1" => { "I1" => "I1a" } },
        { "I2" => [
            { "I2b" => { "I2b1" => "I2b1a" } },
            { "I2a" => ["I2a1", "I2a2"] }
          ]
        }
      ]
    }
  ]
}

#etc...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.