Commit 54277647 authored by Adrien Leger's avatar Adrien Leger
Browse files
parents eba97b8a 3633d56d
{
"metadata": {
"name": "gb_to_fa"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#\u00a0Script to convert gb to fasta"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from glob import iglob\n",
"from Bio import SeqIO\n",
"from gzip import open as gopen\n",
"\n",
"for filename in iglob(\"Baculo/*.gb\"):\n",
" print filename\n",
" gb = SeqIO.read(open(filename, \"rb\"), \"genbank\")\n",
" gb.id = gb.name\n",
" gb.description = \"\"\n",
" with gopen(filename.split(\".\")[0]+\".fa.gz\", \"wb\") as fasta:\n",
" fasta.write(gb.format(\"fasta\"))\n",
" "
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Baculo/Bacmid_WT.gb\n",
"Baculo/pSR_CAPrh10 (R2Crh10).gb"
]
},
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"Baculo/pFB_AAV_GFP_p2.gb\n",
"Baculo/pSR660 (R2C8).gb\n"
]
}
],
"prompt_number": 26
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": []
}
],
"metadata": {}
}
]
}
\ No newline at end of file
# iPython-Notebook
Repo to store my iPython notebooks for NGS data analyses
Repo to store my iPython notebooks for NGS data analyses
* [VCF_analysis](http://nbviewer.ipython.org/github/a-slide/iPython-Notebook/blob/master/Notebooks/VCF_analysis.ipynb)
* [gb_to_fa](http://nbviewer.ipython.org/github/a-slide/iPython-Notebook/blob/master/Notebooks/gb_to_fa.ipynb)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment