{ "cells": [ { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/cellar/users/btsui/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py:2785: DtypeWarning: Columns (0) have mixed types. Specify dtype option on import or set low_memory=False.\n", " interactivity=interactivity, compiler=compiler, result=result)\n" ] } ], "source": [ "specie='Homo_sapiens'\n", "snpBed='/cellar/users/btsui/Data/dbsnp/snp_beds/'+specie+'.bed'\n", "import pandas as pd\n", "tmpDf=pd.read_csv(snpBed,sep='\\t',header=None)\n", "\n" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "tmpDf[0]='chr'+tmpDf[0].astype(str)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'/cellar/users/btsui/Data/dbsnp/snp_beds/Homo_sapiens.bed'" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [], "source": [ "tmpDf.to_csv(snpBed+'.with_chr',sep='\\t',header=None,index=None)" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "chr1\t14727\t14727\r\n", "chr1\t630825\t630825\r\n", "chr1\t630833\t630833\r\n", "chr1\t817186\t817186\r\n", "chr1\t833068\t833068\r\n", "chr1\t842133\t842133\r\n", "chr1\t843942\t843942\r\n", "chr1\t850609\t850609\r\n", "chr1\t948136\t948136\r\n", "chr1\t955964\t955964\r\n" ] } ], "source": [ "!head /cellar/users/btsui/Data/dbsnp/snp_beds/Homo_sapiens.bed.with_chr" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "## the dbsnp contains all the reference bases " ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.5" } }, "nbformat": 4, "nbformat_minor": 2 }