Git Product home page Git Product logo

codingfun's Introduction

#Coding Fun

This has directions and some sample code for the Soltis Lab coding group.

##For Oct. 5:

  1. Last week we wrote some code to calculate GC content. My Version of this is in the DNAcalc.py file.
  2. This doesn't quite do what we want...Modify it to print out the %GC (ie. DNAseq.count(Base) when Base=G plus when Base=C divided by sequence length)
  3. Currently this script uses a sequence hard coded on line 3 of the script. Let's modify this to read from a file and calculate %GC for each sequence in the file. For now, we will assume that the file has one sequence per line.

Here's an example:

try:
  IN=open('MySequenceFile.txt', 'r')
except IOError:
  print ("Can't open file.")
  1. Let's use argparse to take the filename from the command line. Here's an example:
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-i", help="input file")
parser.add_argument("-o", help="output file")

args = parser.parse_args()

InFile = args.i
OutFile = args.o
  1. Let's use BioPython to read a fasta file and calculate %GC.

    Here's an example:

IN=open(InFile, 'r')
for record in SeqIO.parse(IN, "fasta") :
	for Base in ('A','G','T','C', 'N'):
  		NumBase=record.seq.count(Base)

For Oct 12:

  1. Let's look at the code as well as play with Git and github.com to manage our code.

  2. You can make a clone of the github repo with: git clone https://[email protected]/soltislab/CodingFun.git

  3. I'm going to add some comments to the code, but don't want to messs up the original, so I am going to make a brach of the code: git checkout -b comments

  4. That makes the branch on my computer, but I need to push it to github (the origin): git push origin comments

codingfun's People

Contributors

magitz avatar

Watchers

 avatar James Cloos avatar

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.