Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "## Jupyter notebook\n",
- "\n",
- "..."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 17,
- "metadata": {},
- "outputs": [],
- "source": [
- "from Bio import SeqIO"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 18,
- "metadata": {},
- "outputs": [],
- "source": [
- "with open(\"test.gb\") as h:\n",
- " seq = SeqIO.read(h, format=\"gb\")"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 19,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "SeqRecord(seq=Seq('GATC', IUPACAmbiguousDNA()), id='test', name='test', description='', dbxrefs=[])"
- ]
- },
- "execution_count": 19,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "seq"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 27,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "LOCUS test 4 bp ds-DNA linear UNK 10-JUL-2019\n",
- "DEFINITION .\n",
- "ACCESSION test\n",
- "VERSION test\n",
- "KEYWORDS .\n",
- "SOURCE \n",
- " ORGANISM .\n",
- " .\n",
- "COMMENT \n",
- " \n",
- " ApEinfo:methylated:1\n",
- "FEATURES Location/Qualifiers\n",
- " misc_feature 2..3\n",
- " /locus_tag=\"MyFeature\"\n",
- " /label=\"MyFeature\"\n",
- " /ApEinfo_label=\"MyFeature\"\n",
- " /ApEinfo_fwdcolor=\"cyan\"\n",
- " /ApEinfo_revcolor=\"green\"\n",
- " /ApEinfo_graphicformat=\"arrow_data {{0 1 2 0 0 -1} {} 0}\n",
- " width 5 offset 0\"\n",
- "ORIGIN\n",
- " 1 gatc\n",
- "//\n",
- "\n"
- ]
- }
- ],
- "source": [
- "print(seq.format(\"gb\"))"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 20,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "Bio.SeqRecord.SeqRecord"
- ]
- },
- "execution_count": 20,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "type(seq)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 21,
- "metadata": {},
- "outputs": [],
- "source": [
- "from pydna.seqrecord import SeqRecord"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 22,
- "metadata": {},
- "outputs": [],
- "source": [
- "seq2 = SeqRecord(str(seq.seq))"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 23,
- "metadata": {},
- "outputs": [],
- "source": [
- "seq2.__dict__.update(seq.__dict__)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 24,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "pydna.seqrecord.SeqRecord"
- ]
- },
- "execution_count": 24,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "type(seq2)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 25,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "+-----+---------------+-----+-----+-----+-----+--------------+------+\n",
- "| Ft# | Label or Note | Dir | Sta | End | Len | type | orf? |\n",
- "+-----+---------------+-----+-----+-----+-----+--------------+------+\n",
- "| 0 | L:MyFeature | --> | 1 | 3 | 2 | misc_feature | no |\n",
- "+-----+---------------+-----+-----+-----+-----+--------------+------+"
- ]
- },
- "execution_count": 25,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "seq2.list_features()"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
- }
- ],
- "metadata": {
- "anaconda-cloud": {},
- "kernelspec": {
- "display_name": "Python [conda env:bjorn37]",
- "language": "python",
- "name": "conda-env-bjorn37-py"
- },
- "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.7.3"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 2
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement