Skip to content

Instantly share code, notes, and snippets.

@acomjean
acomjean / script_help.md
Last active July 1, 2024 17:52
Bash Scripting

#Usefull Linux hint

Skip the first line of a file

tail -n +2 file.log

re order columns in file (cut maintains order) tab delimited

awk -F'\t' -v OFS="\t" '{ print $2, $5 }' input.tsv > output.tsv
format metric year number_of_records value_actual
CD Units 1973 1
CD Units 1974 1
CD Units 1975 1
CD Units 1976 1
CD Units 1977 1
CD Units 1978 1
CD Units 1979 1
CD Units 1980 1
CD Units 1981 1
#Author: Aram Comjean Dec/ 2015
#http://stackoverflow.com/questions/6667201/how-to-define-two-dimensional-array-in-python
Lookup = [[0 for x in range(50)] for x in range(50)]
def alignment_paths (x,y):
#if we have a 1x1 matrix or are at the left or top edge, there is one path
if (x == 0 or y == 0):
return 1;
import random
from Bio import Entrez
from Bio import SeqIO
#Author: Aram Comjean
#Date: Nov/ 2015
#Hungtington's Disease CAG count
# returns random nucleotide sequence with at least the number of "cag" repeats specified
import random;
#Author: Michael Thomas/ Aram Comjean
#Date: Nov/ 2015
#Hungtington's Disease CAG count
# generates random sequence with at least the number of "cag" repeats specified
def generate_random_seq (number_cag_repeats):
#Python Problem 1
#reverseComplement.py
#Introduction to Bioinformatics Assignment 2
#Purpose: reverse compliment
#Your Name: Aram Comjean
#Date: 10/11/2105
#s1 is the string you should use to generate a reverse complement sequence
#Note that your result needs to be presented in the 5' to 3' direction
@acomjean
acomjean / file.sql
Last active December 19, 2015 07:49 — forked from emmanuel/file.sql
Closure table examples
-- Retrieve descendants
-- ====================
-- retrieve descendants of #4
SELECT c.*
FROM Comments AS c
JOIN TreePaths AS t ON c.comment_id = t.descendant
WHERE t.ancestor = 4;
-- Retrieve ancestors
<?php defined('SYSPATH') or die('No direct script access.');
/**
* MySQL "Closure Table" for Kohana based on Bill Karwin design.
*
* @link http://www.slideshare.net/billkarwin/models-for-hierarchical-data
* @TODO improve
*
* sql schema:
* CREATE TABLE `closures` (
* `id` int(11) NOT NULL AUTO_INCREMENT,