Skip to content

Instantly share code, notes, and snippets.

View taoliu's full-sized avatar
🌎
Working from the earth

Tao Liu (τν) taoliu

🌎
Working from the earth
View GitHub Profile
@taoliu
taoliu / gist:5861468
Created June 25, 2013 19:15
Convert sequence.txt to fastq
perl -ne 'if (/^(\S+\/1)\:([ATCGN]+)\:(\S+)$/){print "@",$1,"\n",$2,"\n","+\n",$3,"\n";}' a.txt > a.fastq
@taoliu
taoliu / filestxt2matrix.py
Created September 17, 2013 21:47
Convert ENCODE DCC files.txt file on UCSC site to a tab-delimited file, that can be loaded by spreadsheet or other scripts.
#!/usr/bin/env python
# Time-stamp: <2013-09-17 17:17:21 Tao Liu>
import os
import sys
# ------------------------------------
# Main function
# ------------------------------------
def main():
if len(sys.argv) < 2:
@taoliu
taoliu / bin_chromosome.py
Created November 6, 2013 05:39
Script to bin chromosome
#!/usr/bin/env python
# Time-stamp: <2013-09-24 15:23:09 Tao Liu>
import os
import sys
# ------------------------------------
# Main function
# ------------------------------------
def main():
if len( sys.argv ) < 4:
@taoliu
taoliu / gist:9799831
Created March 27, 2014 03:55
DNA Codon Dictionary
codon_dictionary = {
'TCA' : 'S', # Serine
'TCC' : 'S', # Serine
'TCG' : 'S', # Serine
'TCT' : 'S', # Serine
'TTC' : 'F', # Phenylalanine
'TTT' : 'F', # Phenylalanine
'TTA' : 'L', # Leucine
'TTG' : 'L', # Leucine
'TAC' : 'Y', # Tyrosine
@taoliu
taoliu / narrowPeak2bb.sh
Created July 26, 2015 14:39
UCSC narrowPeak to bigBed
#!/bin/bash
# set the path to as file for narrowPeak. Locate it in your UCSC source code directory or google...
asfile=/data/db/UCSC_sqls/encode/narrowPeak.as
which bedToBigBed &>/dev/null || { echo "bedToBigBed not found! Download: <http://hgdownload.cse.ucsc.edu/admin/exe/>"; exit 1; }
if [ $# -lt 2 ];then
echo "Need 2 parameters! <narrowPeak> <chrom info>"
exit
@taoliu
taoliu / samcovToBedGraph.pl
Last active October 25, 2024 14:13
Convert samtools depth output to bedGraph
#!/usr/bin/env perl
# A script to convert samtools (>v1.3) depth (with -aa option) output
# to bedGraph by merging continous positions with the same value.
if ( $#ARGV < 0 ) {
print "Need 1 parameter! $0 <samtools depth output (with -aa)>\n";
exit ();
}
#!/usr/bin/env python
# Time-stamp: <2008-01-18 13:42:57 Tao Liu>
import os
import sys
# ------------------------------------
# Main function
# ------------------------------------
def main():
if len(sys.argv) < x+1:
#!/usr/bin/env python3
# Time-stamp: <2008-04-07 17:51:27 Tao Liu>
"""Module Description
Copyright (c) 2020 Tao Liu <[email protected]>
This code is free software; you can redistribute it and/or modify it
under the terms of the BSD License (see the file COPYING included with
the distribution).
#!/bin/bash
if [ $# -lt 1 ]; then
echo "need 1 para!"
exit
fi
#!/usr/bin/env perl -w
# Time-stamp: <2008-03-03 11:24:07 Tao Liu>
#
# By: Tao Liu <[email protected]>
#
use strict;
die "need x paras: $0 <options> [y=blah]\n" if @ARGV < x;