18 votes
Accepted

How can I do an overlapping sequence count in Biopython?

For Biopython 1.70, there is a new Seq.count_overlap() method, which includes optional start and ...
user avatar
  • 3,462
18 votes
Accepted

How do you write a .gz fastq file with Biopython?

I'm not sure I'm doing it the best way, but here is an example where I read a compressed gzip fastq file and write the records in block gzip fastq: ...
user avatar
  • 2,930
10 votes
Accepted

Changing the record id in a FASTA file using BioPython

If I use SeqIO.parse(filehandle, 'fasta') to parse a FASTA file, then it will return a SeqRecord object where the ...
user avatar
  • 451
10 votes
Accepted

Importing GFF file with Biopython

No, there is currently no GFF support in biopython. However, you can read in GFF files into python using this package, gffutils. There are also a few other packages to read/write GFF files, like <...
user avatar
  • 3,061
9 votes

How can I do an overlapping sequence count in Biopython?

I've encountered this problem before, and used python re module to solve this problem. ...
user avatar
  • 325
8 votes
Accepted

Read and write FASTA files with more information than id and sequence

The description field in the SeqRecord object has the information you are looking for: ...
user avatar
8 votes
Accepted

How do I find identical sequences in a FASTA file?

The trick would be to swap the key in the dictionary to be the sequence itself. Also I would recommend using a different separator that "_" since that is what the current ids have so that you can ...
user avatar
  • 2,566
8 votes
Accepted

Biopython Phylogenetic Tree replace branch tip labels by sequence logos

To expand on my comment from yesterday. You could do this with the ETE Toolkit (I just copied one logo file rather than converting all 26 to png): ...
user avatar
  • 1,806
7 votes
Accepted

Subset FASTA file by species name

Splitting into multiple files and changing the IDs can be easily done: ...
user avatar
  • 7,957
7 votes

How to create Phylogenetic Trees from fasta files in Python or R?

I would not look for a package for this, but instead build a small pipeline calling external tools with something like the following workflow: Cluster the ~100 sequences with CD-HIT-EST/PSI-CD-HIT or ...
user avatar
  • 3,462
6 votes
Accepted

Is there any way of using biopython to write Swissprot files?

Using SeqIO.index rather than SeqIO.parse lets you read all the records into a dict, from ...
user avatar
  • 861
6 votes

Why do BLASTn and prokka not seem to be searching the whole fasta file?

With a k-mer size of 28 it shouldn't be finding that many matches. And the prokka results are suspicious as well. Maybe you have multiple contigs (none larger than 100kb) in that file? What is the ...
user avatar
6 votes
Accepted

How can I reproduce a manual NCBI search with Biopython Entrez module?

This can be done by using the "Search details" as a search term in Entrez.esearch: ...
user avatar
  • 2,930
6 votes
Accepted

How to extract the protein fasta file from a genbank file?

One can get it to work by using SeqIO.InsdcIO.GenBankCdsFeatureIterator: ...
user avatar
  • 743
6 votes
Accepted

Possibility to save output blastn table in memory using biopython

You can specify send to stdout using out='-' in the Biopython wrapper. ...
user avatar
  • 724
6 votes

How to make 3d model of a protein that not exist in PDB?

No PDB Getting a crystal structure is hard work for crystallographers, even with a high throughput systems, so they make constructs with only known domains or regions of particular interest. What ...
user avatar
  • 3,434
6 votes
Accepted

BioPython internal_coords module returns different dihedral angles for the (seemingly) same protein structure

The problem got solved after posting on the official BioPython repo. Because of the processing (where some residues were removed in order to align the proteins), some consecutive residues were too far ...
user avatar
  • 385
5 votes

For what bioinformatics tasks is Biopython more adapted than Bioperl?

Regading the perl vs python discussion, there is no final answer which language is better, but I have some advice for you: Learn the language your colleagues or your advisor use. This way you are ...
user avatar
  • 290
5 votes

For what bioinformatics tasks is Biopython more adapted than Bioperl?

Currently you could use either but a major question is which platform will others be using in the future. AFAIK Perl is only superior to Python for regex. Based on the trend I see for new programmers ...
user avatar
  • 1,468
5 votes
Accepted

After artificially creating events in a FASTA file, how do I keep track of the old coordinates?

I've written a handful of programs from scratch to simulate mutations and variations in real or simulated sequences. The trick has always been to sort the variants by genomic coordinate, apply the ...
user avatar
5 votes

How do you generate read-length vs read-quality plot for long-read sequencing data (e.g., MinION)?

I also wrote a package to create various plots from Oxford Nanopore sequencing data and alignments: NanoPlot. It can be installed through pip (see also the README on Github). In addition to multiple ...
user avatar
5 votes
Accepted

How can I edit a specific FASTQ read in place, given the read ID?

You'll first need to determine the appropriate line number, which you can do with grep -m1 -nw "@31027" foo.fastq. After that, note that you can provide a line ...
user avatar
  • 19.3k
5 votes
Accepted

Why doesn't Biopython AlignIO.read() recognise the 'mauve' format?

You're using version 1.68 or older. Mauve support was added in 1.70.
user avatar
  • 19.3k
5 votes
Accepted

Counting the characters in a row using python

Here's one way with pure Python: ...
user avatar
  • 7,957
5 votes

How to translate amino acid sequences to Nucleotide sequences

Although there is not a unique nucleotide sequence that translates to a given protein, one can list all the possible DNA sequences that do translate to that protein. An online tool that does just ...
user avatar
  • 216
5 votes
Accepted

Remove Redundant Sequences from FASTA file in Python

Your code (as currently formatted) should generate the correct output, but it is not efficient. Make seen a set to improve these O(n) ...
user avatar
  • 3,462
4 votes

Getting protein FASTA sequence based on keyword with python

Found what I was looking for. In: searchResultHandle = Entrez.esearch(db="protein", term="terminase large", retmax=1000) I've added: ...
user avatar
  • 303
4 votes

How can I do an overlapping sequence count in Biopython?

You can use finditer from python's re module. The advantage of this approach is it allows for getting the indices of those ...
user avatar
4 votes

How do you generate read-length vs read-quality plot for long-read sequencing data (e.g., MinION)?

It's important to always consider read length and quality jointly with high-error read data, and current long-read technologies (e.g., MinION and PacBio) have high error rates. Considering read length ...
user avatar
  • 1,224
4 votes

After artificially creating events in a FASTA file, how do I keep track of the old coordinates?

If you look for a program which would randomly introduce SNPs + short indels and then would save everything into a VCF file, DWGsim or Mason Variator could be a good choice. Then you can create a ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible