Welcome to the Genome Toolbox! I am glad you navigated to the blog and hope you find the contents useful and insightful for your genomic needs. If you find any of the entries particularly helpful, be sure to click the +1 button on the bottom of the post and share with your colleagues. Your input is encouraged, so if you have comments or are aware of more efficient tools not included in a post, I would love to hear from you. Enjoy your time browsing through the Toolbox.
Showing posts with label program. Show all posts
Showing posts with label program. Show all posts

Monday, August 4, 2014

Run Unix Commands and Other Programs within Python

The python subprocess module is a part of the standard python library that enables a user to run a variety of subprocess within python and collect their output and error pipes. It is a wonderfully handy tool that really expands the possibilities of what python is capable of doing.  The tool is intended to build upon and essentially replace a lot of the functionality of the os package which I have found cumbersome to use.  The main commands of the subprocess module include:

subprocess.call-runs a command and returns output and the exit code
subprocess.check_call-runs a command; if exit code is 0 returns output, otherwise CalledProcessError

Here are some simple example scripts to help get started using the subprocess inside python code:

Monday, January 27, 2014

Produce SAS Proc Freq Output in R

I have never been a huge fan or advocate of SAS, and actually recommend using other SAS alternatives, but I am somewhat addicted to the SAS Proc Freq procedure and its output tables.  Its a nice way to not only visualize the data but also to get some useful summary statistics.  I have been using the R table command for a while and in most cases combined with margin.table or prop.table it suffices to summarize the data.  Recently, I have been in need of summary statistics for the tables as well.  This can be accomplished easy enough using the R chisq.test or fisher.test commands, but still doesn't quite provide the fluid integration of data visualization and summary statistics that the SAS Proc Freq output provides.  Today I came across the R package CrossTable.  This procedure, part of the gmodels library, provides formatted output very similar to that of Proc Freq.  So much so, it even uses the same ascii characters to delineate cell boundaries.  There is a bit of playing around with options and such to get the exact statistics and percentages and such you would like, but overall a very nice (a not to mention free) alternative to SAS's Proc Freq output.  Below is an example table I created.

Thursday, January 23, 2014

Genetic Simulation Resources

I just came across a useful repository of genetic simulation resources I thought would make a good addition to Genome Toolbox.  The site, aptly called Genetic Simulation Resources (GSR), provides a detailed listing of over 80 useful software applications available for genetic simulations.  The NCI sponsored catalog aids in scanning through available simulation programs, comparing similar applications, and quickly identifying the most appropriate software application for a particular study.  In addition to providing a description and external link, literature citations are also listed for many of the simulation packages.  If you are the developer of a genetic simulation resource that is not listed in the GSR repository, you can submit a request to add it.  Overall, a great resource for simulating data for genetic studies that may help you avoid reinventing the wheel by programming a de novo simulation routine.  A good first place to check.


Wednesday, August 14, 2013

UCSC Tools for BigWig Files

Several UCSC data tracks are downloaded in BigWig format (.bw).  This is a compressed file that cannot be read by common text editors.  Rather, you need to use utilities built to handle these files.  Several are available at the ftp website: http://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/.  Here are a few UNIX programs I have found useful:

bigWigAverageOverBed bigWigSummary