<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Python on zachcp</title>
		<link>http://zachcp.org/categories/python/</link>
		<description>Recent content in Python on zachcp</description>
		<generator>Hugo</generator>
		<language>en-us</language>
		
		
		
			<copyright>© 2007- {year}</copyright>
		
		
			<lastBuildDate>Sun, 27 Mar 2016 08:03:00 +0000</lastBuildDate>
		
			<atom:link href="http://zachcp.org/categories/python/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>AntiSmash on OSX</title>
				<link>http://zachcp.org/blog/antismash_on_docker/</link>
				<pubDate>Sun, 27 Mar 2016 08:03:00 +0000</pubDate>
				<guid>http://zachcp.org/blog/antismash_on_docker/</guid>
				<description>&lt;p&gt;The excellent &lt;a href=&#34;http://antismash.secondarymetabolites.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;AntiSmash&lt;/a&gt; team has made a &lt;a href=&#34;https://www.docker.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Docker&lt;/a&gt; image of AntiSmash available&#xA;(&lt;a href=&#34;https://bitbucket.org/antismash/docker/src/73449eb032ee?at=master&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;repo&lt;/a&gt;,&lt;a href=&#34;http://phdops.kblin.org/2015-running-antismash-standalone-from-docker.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;post&lt;/a&gt;).&#xA;I&amp;rsquo;ve just kicked the tires a bit and, all in all, can report a very positive experience as AntiSmash has a lot of dependencies and setting it in the&#xA;past has involved a bit of wrangling.  However, there were a few hiccups requiring some small&#xA;modifications of the base install script to get it working. Here is a quick recap to save others a bit of hassle:&lt;/p&gt;</description>
			</item>
			<item>
				<title>Process Substitution and BioPython</title>
				<link>http://zachcp.org/blog/process_substitution/</link>
				<pubDate>Wed, 20 May 2015 08:03:00 +0000</pubDate>
				<guid>http://zachcp.org/blog/process_substitution/</guid>
				<description>&lt;p&gt;I recently picked up a copy of Vince Buffalo&amp;rsquo;s &lt;a href=&#34;http://www.amazon.com/Bioinformatics-Data-Skills-Reproducible-Research/dp/1449367372?tag=duckduckgo-d-20&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Bioinformatics Data Skills&lt;/a&gt; and have learned a few gems. There is one section where he discusses the uses of named pipes and process substitution, (blogpost about it &lt;a href=&#34;http://vincebuffalo.com/2013/08/08/the-mighty-named-pipe.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;here&lt;/a&gt;) and I wanted to try it. I also have been using the Click library for making command line scripts in python. Can I combine these together fruitfully and get the ease writing code with some of the memory-saving and computational speedups of using process substition? Indeed. Here I build up a simple script that aims to concatenate each record of a forward/reverse fastq pair and gzip the output.&lt;/p&gt;</description>
			</item>
			<item>
				<title>topic histograms of PUBMED using eutils CLI</title>
				<link>http://zachcp.org/blog/ncbi_eutils/</link>
				<pubDate>Tue, 21 Apr 2015 08:03:00 +0000</pubDate>
				<guid>http://zachcp.org/blog/ncbi_eutils/</guid>
				<description>&lt;p&gt;I&amp;rsquo;ve needed to download and bulk analyze some abstract data from Pubmed and have taken this as an opportunity to familiarize myself with their &lt;a href=&#34;http://www.ncbi.nlm.nih.gov/books/NBK179288/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;eutils command line interface&lt;/a&gt;. The command line interface to eutils gives you full access to NCBI&amp;rsquo;s many databases but allows you to perform queries in a sophisticated way. The few, core set of commands can perform fairly sophisticated analyses by chaining the calls together with pipes, unix-style. &lt;strong&gt;esearch&lt;/strong&gt;, &lt;strong&gt;efilter&lt;/strong&gt;, and &lt;strong&gt;efetch&lt;/strong&gt; are the primary means of looking for, filtering and obtaining data, while the &lt;strong&gt;xtract&lt;/strong&gt; command parses the XML data from NCB into useable formats. The examples in the documentation in the link above are enough to get you started and to see how the tools let you explore the data (i would use a filter on the big searches to reduce search time) and iterate the discovery/retrieval process&lt;/p&gt;</description>
			</item>
			<item>
				<title>PyPy, Biopython and Fasta/q Parsing</title>
				<link>http://zachcp.org/blog/pypy_biopython_bench/</link>
				<pubDate>Fri, 20 Mar 2015 08:03:00 +0000</pubDate>
				<guid>http://zachcp.org/blog/pypy_biopython_bench/</guid>
				<description>&lt;img src=&#34;http://biopython.org/DIST/docs/tutorial/images/biopython.jpg&#34; width=200&gt;&#xA; &lt;img src=&#34;https://upload.wikimedia.org/wikipedia/commons/b/b0/Pypy_logo.png&#34; width=200&gt;&#xA;&lt;p&gt;&lt;em&gt;tl;dr pypy and a good algorithm can give you speed&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Can Pypy speed up your Sequence analysis? &lt;a href=&#34;http://pypy.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Pypy&lt;/a&gt; is a compiler for python that boasts a &lt;a href=&#34;http://speed.pypy.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;speedup&lt;/a&gt; of your programs relative to python. Anyone parsing through large fasta/fastq files knows that speedups are always welcome. How does pypy work for something simple and ubiquitous like iterating through a bunch of records and writing them back out? I use &lt;a href=&#34;https://github.com/lh3/seqtk&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;seqtk&lt;/a&gt; as a baseline for how fast it is possible to go and compare a few different iteration methods using python2, pypy2, python3 and pypy3. Full code is available in this &lt;a href=&#34;https://gist.github.com/zachcp/cfbbdeecb89bdd27a000&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Gist&lt;/a&gt;.&lt;/p&gt;</description>
			</item>
			<item>
				<title>PCR Animation with Pymol</title>
				<link>http://zachcp.org/blog/pcr_animation/</link>
				<pubDate>Fri, 06 Feb 2015 08:03:00 +0000</pubDate>
				<guid>http://zachcp.org/blog/pcr_animation/</guid>
				<description>&lt;img src=&#34;http://zachcp.org/pics/blog/2015/animation.gif&#34;&gt;&#xA;&lt;p&gt;I was cleaning up some old files and uncovered the code I used to create a PCR-like animation for the &lt;a href=&#34;https://www.youtube.com/watch?v=oCRJ4r0RDC4&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;PCR Rap&lt;/a&gt; and I&amp;rsquo;ve posted it to &lt;a href=&#34;https://github.com/zachcp/pcrviz&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;github&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The animation (seen above) is made in Pymol and uses a series of rotations and translations of a polymerase around a double stranded DNA. At the time I remember struggling with setting the view, coordinating the state of each polymerase and DNA strand and so instead of banging&#xA;my head against PyMol I simple wrote a script that would write out the commands that I wold normally use in pymol and then run that script in pymol. it worked fine in the end but something like &lt;a href=&#34;https://github.com/quil/quil&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Quil&lt;/a&gt;/Processing is how I would do it if i was writing again. Quill interface to &lt;a href=&#34;http://jmol.sourceforge.net/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;JMOL&lt;/a&gt;, anyone?&lt;/p&gt;</description>
			</item>
			<item>
				<title>Python to Clojure: Getting Used to Immutability</title>
				<link>http://zachcp.org/blog/python-to-clojure/</link>
				<pubDate>Tue, 06 Jan 2015 08:03:00 +0000</pubDate>
				<guid>http://zachcp.org/blog/python-to-clojure/</guid>
				<description>&lt;p&gt;&lt;em&gt;tl;dr clojure is an interesting language emphasizing immutable data and higher order functions. While these offer some tangible benefits, effective use requires a style of thinking about programming that is quite different from the imperative style many of us know&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;I have been following the &lt;a href=&#34;http://clojure.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Clojure&lt;/a&gt; community for a little while and have been interested in their way of doing things. Not only are there a lot of smart people who have been involved in designing the language, but the support for both the JVM and for Javascript means that Clojure is a language that may yield a single language to &amp;ldquo;rule them all&amp;rdquo;, or at least to allow portability to just about any platform. JVM plus JS is a pretty nice combo. That Clojure is a lisp is also appealing since hearing of how lisp was Paul Graham&amp;rsquo;s &amp;ldquo;secret weapon&amp;rdquo; in &lt;a href=&#34;http://www.paulgraham.com/avg.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Beating the Averages&lt;/a&gt;. But in addition to being a lisp, Clojure prides itself on immutable data and functional programming. These two are interesting concepts that are catching on in many areas of programming and are in the same spirit of reproducible research where the processing and analysis of data should be as transparent as possible and should focus on what we are ultimately interested in: the values themselves.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Going Parallel with multiprocessing</title>
				<link>http://zachcp.org/blog/parallel_with_multiprocessing/</link>
				<pubDate>Fri, 12 Dec 2014 08:03:00 +0000</pubDate>
				<guid>http://zachcp.org/blog/parallel_with_multiprocessing/</guid>
				<description>&lt;p&gt;For a current project I need to debarcode MiSeq-sequenced amplicons that were generated by two rounds of PCR, each of which used a barcoded primer. I will use Qiime&amp;rsquo;s &lt;a href=&#34;http://qiime.org/scripts/split_libraries.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;split_libraries.py&lt;/a&gt; for the second set of primers but I wanted a script that can iterate through the sequences, detect some conserved bits and chop out the left part of my sequences. I came across &lt;a href=&#34;https://bcbio.wordpress.com/2009/08/09/trimming-adaptors-from-short-read-sequences/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Brad Chapman&amp;rsquo;s post&lt;/a&gt; about such a script and wanted to try it out. It was great but slow. Can I make it faster?&lt;/p&gt;</description>
			</item>
	</channel>
</rss>
