This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Randomly insert genetic barcodes (and weighted randomly chosen quality values) as the first N bp of each read in a FASTQ file. | |
Greg Pinero 2012 | |
""" | |
import sys | |
import argparse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_free_memory(): | |
""" | |
Try to figure out how much memory is free on a Unix system. | |
Returns free memory in mB. | |
""" | |
data = open("/proc/meminfo", 'rt').readlines() | |
free = 0 | |
for line in data: | |
if line.startswith("MemFree") or line.startswith("Buffers") or line.startswith("Cached"): | |
items = line.split() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
infile = 'dsim-all-chromosome-r1.3.reassembly1.updated_wsu1.fasta' | |
ref_count = 0 | |
for line in open(infile,'r'): | |
if line.startswith('>'): | |
ref_count += 1 | |
print '>' + re.sub(r'[^0-9a-zA-Z_]', '', line)[:50] | |
else: | |
print line, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Quick functions for reading and writing FASTQ""" | |
def read_fastq(filehandle): | |
''' Return dictionary with 'seq_id', 'seq', 'qual_id', and 'qual' ''' | |
record_line = 0 | |
read_number = 0 | |
fastq_record = dict() | |
for line in filehandle: | |
record_line += 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Perl syntax basics: | |
Perl === | |
Start interactive interpreter: | |
perl -de 1 | |
==== Syntax Basics ==== | |
<pre><nowiki> | |
data types: $scalars, @lists, and %hashes | |
""my"" makes a variable be in the scope of its block and lower. Use ""our"" for globals. | |
Put ""use strict"" at beginning of file to be required to declare variables. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Log Insert | |
CREATE TRIGGER LogInsert ON [dbo].[CustomerProduct] | |
FOR INSERT | |
AS | |
INSERT changelog SELECT TOP 1 getdate(), 'Insert', 'CustomerProduct', CustomerID, ProductID, 'PaymenttypeID', '', Paymenttypeid FROM inserted | |
INSERT changelog SELECT TOP 1 getdate(), 'Insert', 'CustomerProduct', CustomerID, ProductID, 'ExpirationDate', '', convert(varchar(12), ExpirationDate, 110) FROM inserted | |
INSERT changelog SELECT TOP 1 getdate(), 'Insert', 'CustomerProduct', CustomerID, ProductID, 'Rate', '', Rate FROM inserted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""""" | |
Sample script using Lyons ABA web service methods | |
"""""" | |
import httplib | |
import urllib | |
import xml.dom.minidom | |
#-------SETTINGS------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import datetime | |
import math | |
def format_timeinterval(start, end=None): | |
if not end: | |
end = datetime.now() | |
return format_timedelta(end - start) | |
def format_secondsdelta(seconds): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
name: | |
mv: | |
app: | |
note: | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import datetime | |
from time import time | |
import sys | |
import math | |
import zipfile | |
import pickle | |
from cStringIO import StringIO | |
from dateutil.relativedelta import relativedelta |
OlderNewer