Python list comprehension enables for easy manipulation of a list variable. For example, list comprehension can be used to convert from a string to an integer or float as well as do some common operation on a list. Below is an example script that shows the syntax for list comprehension and how to utilize the code in Python. Hope its helpful.
A repository of programs, scripts, and tips essential to
genetic epidemiology, statistical genetics, and bioinformatics
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 list. Show all posts
Showing posts with label list. Show all posts
Monday, August 25, 2014
Friday, August 22, 2014
Search for File Type in UNIX Directory and All Subdirectories
Here's a simple way to find and list all files in a UNIX directory and the containing subdirectories. This example script shows how to search for all files with the extension ".R":
Friday, May 16, 2014
Is there a GWAS on that?
Another noteworthy resource is the HuGE Navigator GWAS Interagator. This is a search tool similar to the NHGRI GWAS catalog, but more focused on a search terms. Handy links are provided to other resources. Of particular interest are links to visualize the variants in the UCSC Browser.
I am sure other GWAS resources exist as well, but these were the two main ones that first came to mind for me. If you know other great GWAS resources capable of linking a genomic marker with a disease, please share in the comments below.
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.
Thursday, May 30, 2013
Transpose List of Lists in Python
Today in Python I wanted to be able to transpose a list of lists that I created. So, for example, I wanted to be able to transpose the list
l=[[1,2,3],[4,5,6],[7,8,9]]
to this
t=[[1,4,7],[2,5,8],[3,6,9]]
I found an easy command to do this, where l is the list above and t is the transposed list.
l=[[1,2,3],[4,5,6],[7,8,9]]
to this
t=[[1,4,7],[2,5,8],[3,6,9]]
I found an easy command to do this, where l is the list above and t is the transposed list.
Subscribe to:
Posts (Atom)

