{{ message }}

Instantly share code, notes, and snippets.

🌲
Genealogies

# Ivan Krukovivan-krukov

🌲
Genealogies
Created May 15, 2013
Solution to Rosalind CORR problem
View corr.pl
 #!/usr/bin/env perl use v5.14; use warnings; sub hamming { my @a = split "", shift; my @b = split "", shift; my \$distance = 0; for (my \$n = 0; \$n < scalar(@a); \$n++) { unless ((\$a[\$n]) eq (\$b[\$n])) {
Last active Dec 17, 2015
fancy consensus builder
View cons.py
 #!/usr/bin/env python #http://rosalind.info/problems/cons/ import fastaparse letters = ["A","C","G","T"] sequences = [i.seq for i in fastaparse.sequences("temp2")] #create empty profile matrix
Created May 28, 2013
time resync and hwclock update (arch)
View time-update.sh
 sudo ntpd -gq sudo hwclock --systohc --utc
Created May 29, 2013
Different ways of parsing fasta files. Last one is my favorite - generators and named tuples.
View fastaparse.py
 #load everythin in memory #split def split_fasta(input_file): with open(input_file) as fasta_file: text = fasta_file.read().split(">")[1:] data = [] for entry in text: header,sequence = entry.split("\n",1) sequence = sequence.replace("\n","")
Created May 31, 2013
A little perl-like qw function for interactive work
View qw.py
 def qw(s,t=str): return list(map(t,s.split()))
Created Jun 5, 2013
lcsm problem on Rosalind
View lcsm.py
 #!/usr/bin/env python import fastaparse import sys sequences = [i.seq for i in fastaparse.parse_fasta(sys.argv[1])] def substrings(string): n = len(string) for length in range(n,0,-1):
Created Jun 6, 2013
Complete download file over FTP example. Complete with write-report closure in python3 style, writing stdout to same line and nice verbosity handling