Skip to content

Instantly share code, notes, and snippets.

import re
class tRNAsynthetase(object):
def __init__(self, filepath="/Users/coela/projects/ATS_interaction/data/uniprot/aatrnasy.txt"):
fileHandle = open(filepath,'r')
match_tRNA = re.compile("(\S+)-tRNA synthetases \((EC \S+)\)")
count = 0
switch = False
self.info = dict()
self.aadict = {"Alanyl" : "Ala",
import sys
fileHandle = open(sys.argv[1],'r')
for line in fileHandle:
line = line.rstrip()
#print line
lines = line.split(" ,")
#print lines
for i,ent in enumerate(lines):
if i == 3:
break
import sys
from Bio import SeqIO
fh = open(sys.argv[1],"r")
for gb_record in SeqIO.parse(fh, "genbank") :
for (index, feature) in enumerate(gb_record.features) :
if feature.type == 'source':
print "\t".join([gb_record.name,feature.qualifiers['db_xref'][0].split(":")[1]])
break
from Bio import SeqIO
for seq_record in SeqIO.parse("NC_000913.gbk", "genbank"):
for feature in seq_record.features:
if feature.qualifiers.has_key('locus_tag'):
start = feature.location.nofuzzy_start
end = feature.location.nofuzzy_end
print ">" + feature.qualifiers['locus_tag'][0]
print seq_record.seq[start:end]
from Bio import SeqIO
for seq_record in SeqIO.parse("NC_000913.gbk", "genbank"):
print ">" + seq_record.id
print seq_record.seq
@coela
coela / guraburu.py
Last active December 9, 2016 05:07
import glob
files = glob.glob('./*.gbff')
for file in files:
fileHandle = open( file , 'r' )
for line in fileHandle:
line = line.rstrip()
print line
from Bio import Entrez
import re
import sys
argvs = sys.argv
Entrez.email = "[email protected]"
handle = Entrez.efetch(db="nucleotide", id=argvs[1],rettype="gb", retmode="text")
for line in handle.read().split("\n"):
if re.match(" ORGANISM",line):
@coela
coela / nprot_2009_rnaseq.markdown
Last active June 5, 2016 21:16
nprot_2009_rnaseq

###1

  • process_name:preculture
  • temperature: 32 celsius
  • time : overnight
  • comment : inoculating 30 ml of YES media
  • input: yeast cell
  • container: yeast agar plate
  • input: yeast media
  • output: precultured yeast
#!/usr/bin/env python
import os
import re
import sys
argvs = sys.argv
if len(argvs) == 1:
argvs.append("")
os.system('curl -k -X POST --data-urlencode \'payload={"channel": "#job", "username": "webhookbot", "text": "Your job is done: %s ", "icon_emoji": ":ghost:"}\' https://hooks.slack.com/services/hoge/hogehoge'%argvs[1])
#-*- coding:utf-8 -*-
import sys
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from sklearn.cross_validation import StratifiedKFold
from sklearn.grid_search import GridSearchCV
from sklearn.cross_validation import cross_val_score
from sklearn.datasets import make_blobs
from sklearn.ensemble import RandomForestClassifier
from sklearn.ensemble import ExtraTreesClassifier