Skip to content

Instantly share code, notes, and snippets.

@madscientist01
madscientist01 / gist:4405284
Created December 29, 2012 07:51
DB generation
#!/bin/bash
mysql -u root allbacteria < gff.sql
mysql -u root allbacteria < accession.sql
awk '{ if ($3=="CDS") print $1"\t"$4"\t"$5"\t"$7"\t"$9}' $1.gff | sed -e 's/ID=.*Name=//' -e 's/;Parent.*$//' > $1.txt
cat $1.txt | mysql -u root allbacteria --local-infile=1 -e "LOAD DATA LOCAL INFILE '/dev/stdin' INTO TABLE gff;"
awk '/^>/ {split($0,a,"|");print a[4],"\t",$1}' $1.fasta | sed 's/>//' > $1.txt2
cat $1.txt2 | mysql -u root allbacteria --local-infile=1 -e "LOAD DATA LOCAL INFILE '/dev/stdin' INTO TABLE accession;"
@madscientist01
madscientist01 / gist:4408032
Created December 29, 2012 17:00
Convert your 'lover letter' in DNA sequence!
#!/usr/bin/python
import sys,os,re
def translate(datafile):
#
# Regex strips all of space and non alphabetic from the sentence
#
regex = re.compile('[\s|\W|0-9_]')
#
# Dictionary for the Amido acid - Codon relationship
@madscientist01
madscientist01 / pymol scripts
Last active December 10, 2015 11:58
Pymol scripts for TALE-DNA structure movie
set matrix_mode, 1
load ~/Dropbox/talen/3ugm.pdb
create DNA, /3UGM//B/ or /3UGM//C
create TALECARTOON, /3UGM//A/
create TALE, /3UGM//A/
create HD1, /3UGM//A/334-335/
create HD2, /3UGM//A/368-369/
set cartoon_ring_mode,1
library(devtools)
library(sleuth)
library(dplyr)
library("biomaRt")
#load annotation from ensembl
ensembl = useMart("ENSEMBL_MART_ENSEMBL",dataset="mmusculus_gene_ensembl", host="www.ensembl.org")
t2g <- biomaRt::getBM(attributes = c("ensembl_transcript_id", "ensembl_gene_id", "external_gene_name"), mart = ensembl)
t2g <- dplyr::rename(t2g, target_id = ensembl_transcript_id, ens_gene = ensembl_gene_id, ext_gene = external_gene_name)
#change this directory as your directory
@madscientist01
madscientist01 / gist:186415e2626065e1324da7a97b6e1b32
Created August 24, 2018 16:52
교보문고 현재 재고량
import requests
import pandas as pd
import datetime
from bs4 import BeautifulSoup
import os, glob
from functools import reduce
def get_html(url):
_html = ""
resp = requests.get(url)
import requests
import pandas as pd
import datetime
from bs4 import BeautifulSoup
import os, glob
from functools import reduce
def get_html(url):
_html = ""
import requests
import pandas as pd
import datetime
from bs4 import BeautifulSoup
import os, glob
from functools import reduce
def get_html(url):
_html = ""
import requests
import pandas as pd
import datetime
from bs4 import BeautifulSoup
import os, glob
from functools import reduce
def get_html(url):
_html = ""
import requests
import pandas as pd
import datetime
from bs4 import BeautifulSoup
import os, glob
from functools import reduce
def get_html(url):
_html = ""