Giter VIP home page Giter VIP logo

coursenotes's Issues

Homework for 10/3 - Sed Exercise

Tasks

  1. Eliminate commas and quotes from second column of csv file:
    sed -E 's/"([0-9]+),([0-9]+),*([0-9]*)"/\1\2\3/' tableofSNPs.csv > out.csv

  2. Check there are only three commas in each line:
    sed -E 's/[^,]//g' out.csv | sort | uniq
    The output should only contain one line consisting of 3 commas indicating a successful step 1.

Optional Tasks

  1. Replace all A and T with T and A respectively:
    sed -E 'y/AT/TA/' tableofSNPs.csv > rev.csv

  2. Check that the replacement was correct:
    sed -E s/'[^AT]'//g rev.csv | sort | uniq -c | tail -n 2 > countRev
    sed -E s/'[^AT]'//g out.csv | sort | uniq -c | tail -n 2 > countOut
    diff countRev countOut
    This is a three line solution. I don't know how to do a one-liner for this; please help.

Note: All commands were executed in macOS 10.14 (BSD)

@cecileane and @coraallencoleman

Homework for 10/1 - write something about Github

One really important thing I learned was how to undo changes in a repository. For example, if I have added something using git add <file>, then I can un-stage it using git reset HEAD <file>. I think this is a super useful feature to "undo" things.

@cecileane and @coraallencoleman

Completed_binomial.py_Shaurya-Chanana

This script was written for python3 and tested on macOS 10.14

  • The first line of the script is #! /usr/bin/env python3 which means it tries to use python3 by default. python3 no longer supports type long. This means that
$ ./binomial.py -n 150 -k 40
4408904561911885789946649584764715008

however, when it is run with python2 it will show

$ python ./binomial.py -n 150 -k 40
4.40890456191e+36

  • The doctest module has problems with returning integers vs floating point values if run with python2
$ python ./binomial.py --test
testing the module...
**********************************************************************
File "./binomial.py", line 85, in __main__.choose
Failed example:
    choose(5, 3)
Expected:
    10
Got:
    10.0
**********************************************************************

Even though the code says

logChoose = logfactorial(n, k) - logfactorial(n - k)
    if log:
        return logChoose
    else:
        return round(math.exp(logChoose)) # returns whole number

@cecileane and @coraallencoleman

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.