Skip to content

Instantly share code, notes, and snippets.

View webmasterar's full-sized avatar

A Retha webmasterar

View GitHub Profile
@webmasterar
webmasterar / getRef.py
Last active November 10, 2017 14:04
Return the sequence from a FASTA file given a start and end position
#License: CC0 Public Domain (2017) Ahmad Retha
##
# Get range of bases from a fasta file. e.g. chr21:9411239-9411240
# @param refFile The fasta filename e.g. Homo_sapiens.GRCh37.75.dna.chromosome.21.fa
# @param begin 1-based index in sequence e.g. 9411239
# @param end 1-based index in sequence up-to-but-not-including e.g. 9411240
# @return string 'G'
def getRef(refFile, begin, end):
if begin > end:
@webmasterar
webmasterar / treeTraversalLevelOrder.py
Created September 16, 2016 17:49
Tree Traversal in Level Order
# License: CC0 2016 Ahmad Retha
#
# Tree Traversal by order of level
# --------------------------------
#
# The goal is to get a list of elements in the order of the level they appear in the tree.
# Our tree looks like this:
#
# a Level 1
# / \