biopython

The new RefSeq release from NCBI is compatible with Bio.Entrez.Parser?

…衆ロ難τιáo~ 提交于 2019-12-06 14:28:37
I'm new with python and especially with Biopython. I'm trying to take some information from an XML file with Entrez.efetch and then read it. Last week this script worked well: handle = Entrez.efetch(db="Protein", id="YP_008872780.1", retmode="xml") records = Entrez.read(handle) But now I'm getting an Error: > Bio.Entrez.Parser.ValidationError: Failed to find tag 'GBSeq_xrefs' in the DTD. To skip all tags that are not represented in the DTD, please call Bio.Entrez.read or Bio.Entrez.parse with validate=False. So I run this: records = Entrez.read(handle, validate=False) But I'm still getting an

How to extract chains from a PDB file?

限于喜欢 提交于 2019-12-06 06:43:21
问题 I would like to extract chains from pdb files. I have a file named pdb.txt which contains pdb IDs as shown below. The first four characters represent PDB IDs and last character is the chain IDs. 1B68A 1BZ4B 4FUTA I would like to 1) read the file line by line 2) download the atomic coordinates of each chain from the corresponding PDB files. 3) save the output to a folder. I used the following script to extract chains. But this code prints only A chains from pdb files. for i in 1B68 1BZ4 4FUT

Biopython: How to avoid particular amino acid sequences from a protein so as to plot Ramachandran plot?

99封情书 提交于 2019-12-06 02:16:43
I have written a python script to plot the 'Ramachandran Plot' of Ubiquitin protein. I am using biopython. I am working with pdb files. My script is as below : import Bio.PDB import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt phi_psi = ([0,0]) phi_psi = np.array(phi_psi) pdb1 ='/home/devanandt/Documents/VMD/1UBQ.pdb' for model in Bio.PDB.PDBParser().get_structure('1UBQ',pdb1) : for chain in model : polypeptides = Bio.PDB.PPBuilder().build_peptides(chain) for poly_index, poly in enumerate(polypeptides) : print "Model %s Chain %s" % (str(model.id), str(chain.id)), print

how to download complete genome sequence in biopython entrez.esearch

左心房为你撑大大i 提交于 2019-12-05 20:23:03
I have to download only complete genome sequences from NCBI (GenBank(full) format). I am intrested in 'complete geneome' not 'whole genome'. my script: from Bio import Entrez Entrez.email = "asiakXX@wp.pl" gatunek='Escherichia[ORGN]' handle = Entrez.esearch(db='nucleotide', term=gatunek, property='complete genome' )#title='complete genome[title]') result = Entrez.read(handle) As a results I get only small fragments of genomes, whith size about 484 bp: LOCUS NZ_KE350773 484 bp DNA linear CON 23-AUG-2013 DEFINITION Escherichia coli E1777 genomic scaffold scaffold9_G, whole genome shotgun

SeqIO.parse on a fasta.gz

…衆ロ難τιáo~ 提交于 2019-12-05 01:28:09
New to coding. New to Pytho/biopython; this is my first question online, ever. How do I open a compressed fasta.gz file to extract info and perform calcuations in my function. Here is a simplified example of what I'm trying to do (I've tried different ways), and what the error is. The gzip command I'm using doesn't seem to work.? with gzip.open("practicezip.fasta.gz", "r") as handle: for record in SeqIO.parse(handle, "fasta"): print(record.id) Traceback (most recent call last): File "<ipython-input-192-a94ad3309a16>", line 2, in <module> for record in SeqIO.parse(handle, "fasta"): File "C:

Python find longest ORF in DNA sequence

僤鯓⒐⒋嵵緔 提交于 2019-12-04 21:22:36
Can someone show me a straightforward solution for how to calculate the longest open reading frame (ORF) in a DNA sequence? ATG is the start codon (i.e., the beginning of an ORF) and TAG , TGA , and TAA are stop codons (i.e., the end of an ORF). Here's some code that produces errors (and uses an external module called BioPython): import sys from Bio import SeqIO currentCid = '' buffer = [] for record in SeqIO.parse(open(sys.argv[1]),"fasta"): cid = str(record.description).split('.')[0][1:] if currentCid == '': currentCid = cid else: if cid != currentCid: buffer.sort(key = lambda x : len(x[1]))

trace patterns such that each node is visited only once(eulerian path) using opencv

荒凉一梦 提交于 2019-12-04 14:38:36
问题 Here is my problem which I am trying to solve since one complete year. With no success till end of the year. I have to seek help and a concrete solutions from the stackoverflow experts. My problem statement: I have been working with some design patterns which I want to trace if eulerian path exist(as shown in below gifs), programmatically. Below are the patterns and the way I wanna draw them(gifs). What I wanna achieve: Give the design pattern images as input. I want trace the design pattern

Traceback in Smith-Wateman algorithm with affine gap penalty

百般思念 提交于 2019-12-03 12:37:07
问题 I'm trying to implement the Smith-Waterman algorithm for local sequence alignment using the affine gap penalty function. I think I understand how to initiate and compute the matrices required for calculating alignment scores, but am clueless as to how to then traceback to find the alignment. To generate the 3 matrices required I have the following code for j in range(1, len2): for i in range(1, len1): fxOpen = F[i][j-1] + gap xExtend = Ix[i][j-1] + extend Ix[i][j] = max(fxOpen, xExtend)

How to call module written with argparse in iPython notebook

China☆狼群 提交于 2019-12-03 10:49:50
问题 I am trying to pass BioPython sequences to Ilya Stepanov's implementation of Ukkonen's suffix tree algorithm in iPython's notebook environment. I am stumbling on the argparse component. I have never had to deal directly with argparse before. How can I use this without rewriting main()? By the by, this writeup of Ukkonen's algorithm is fantastic. 回答1: I've had a similar problem before, but using optparse instead of argparse . You don't need to change anything in the original script, just

trace patterns such that each node is visited only once(eulerian path) using opencv

ぃ、小莉子 提交于 2019-12-03 09:10:20
Here is my problem which I am trying to solve since one complete year. With no success till end of the year. I have to seek help and a concrete solutions from the stackoverflow experts. My problem statement: I have been working with some design patterns which I want to trace if eulerian path exist(as shown in below gifs), programmatically. Below are the patterns and the way I wanna draw them(gifs). What I wanna achieve: Give the design pattern images as input. I want trace the design pattern image in a single stroke as shown in the gifs(gifs animations are just examples of how the patterns is