-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update state.py * Update class name to State * moving example to another file * default constructor
- Loading branch information
1 parent
48d5aac
commit 5619393
Showing
2 changed files
with
74 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,51 @@ | ||
from pydantic import BaseModel | ||
# -*- coding: utf-8 -*- | ||
"""get_seq_annotation.ipynb | ||
Automatically generated by Colaboratory. | ||
Original file is located at | ||
https://colab.research.google.com/drive/1dJEOj6Jw3qOHsxcsP-W3Uj7mbKhvWnHi | ||
""" | ||
|
||
from Bio import Entrez | ||
from Bio import SeqIO | ||
|
||
|
||
class State: | ||
def __init__(self): | ||
self.vector = None | ||
self.linear_insert = None | ||
self.clone_seq = None | ||
|
||
def store_vector(self, vector): | ||
if not isinstance(vector, SeqIO.SeqRecord): | ||
raise ValueError("Input 'vector' must be a SeqRecord object from Biopython's SeqIO.") | ||
self.vector = vector | ||
|
||
def store_linear_insert(self, linear_insert): | ||
# Ensure the linear_insert is a SeqRecord object from Biopython | ||
if not isinstance(linear_insert, SeqIO.SeqRecord): | ||
raise ValueError("Input 'linear_insert' must be a SeqRecord object from Biopython's SeqIO.") | ||
self.linear_insert = linear_insert | ||
|
||
def store_clone_seq(self, clone_seq): | ||
# Ensure the linear_insert is a SeqRecord object from Biopython | ||
self.clone_seq = clone_seq | ||
|
||
def retrieve_vector(self): | ||
return self.vector | ||
|
||
def retrieve_linear_insert(self): | ||
return self.linear_insert | ||
|
||
def retrieve_clone_seq(self): | ||
return self.clone_seq | ||
# seq to annotation | ||
|
||
|
||
def download_genbank_file(accession, filename): | ||
Entrez.email = "[email protected]" # Always provide your email address when using NCBI's services | ||
with Entrez.efetch(db="nucleotide", id=accession, rettype="gb", retmode="text") as handle: | ||
with open(filename, 'w') as outfile: | ||
outfile.write(handle.read()) | ||
|
||
class State(BaseModel): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters