biopython

Convert function arguments to str

Convert function arguments to str Question: I wrote a function and call it as below: from lib import base_frequency base_frequency("AB610939-AB610950.gb", "genbank") #This calls the function that uses a BioPython code. How could I pass the function arguments as below? base_frequency(AB610939-AB610950.gb, genbank) Note that quotes are missing. Should I do this? Is there a recommended nomenclature …

Total answers: 2

Read Clustal file in Python

Read Clustal file in Python Question: I have a multiple sequence alignment (MSA) file derived from mafft in clustal format which I want to import into Python and save into a PDF file. I need to import the file and then highlight some specific words. I’ve tried to simply import the pdf of the MSA …

Total answers: 2

Trying to create a sliding window that checks for repeats in a DNA sequence

Trying to create a sliding window that checks for repeats in a DNA sequence Question: I’m trying to write a bioinformatics code that will check for certain repeats in a given string of nucleotides. The user inputs a certain patter, and the program outputs how many times something is repeated, or even highlights where they …

Total answers: 3

Finding matching motifs on sequence and their positions

Finding matching motifs on sequence and their positions Question: I am trying to find some matching motifs on a sequence, as well as the position that the motif is located in and then output that into a fasta file. The code below shows that the motif [L**L*L] is present in the sequence, when I run …

Total answers: 1

Save a modied FASTA file with Biopython

Save a modied FASTA file with Biopython Question: I have used Biopython to remove some sequences due to they are too short. However, I don’t know how to save the printed new sequences in a txt file. This is the code that I have: from Bio import SeqIO for seq_record in SeqIO.parse("aminoacid_example.txt", "fasta"): if len(seq_record.seq)>=30: …

Total answers: 1

Python question about overridden/redifined imported function as Class method

Python question about overridden/redifined imported function as Class method Question: In https://github.com/biopython/biopython/blob/518c4be6ae16f1e00bfd55781171da91282b340a/Bio/SeqUtils/ProtParam.py I have this importing statement: from Bio.SeqUtils import molecular_weight and then in a Class: class ProteinAnalysis: ….. ….. def molecular_weight(self): """Calculate MW from Protein sequence.""" return molecular_weight( self.sequence, seq_type="protein", monoisotopic=self.monoisotopic ) …… …… What is this type of coding called? Is it normal …

Total answers: 3

How to get a consensus of multiple sequence alignments using Biopython?

How to get a consensus of multiple sequence alignments using Biopython? Question: I am trying to get a consensus sequence from my multiple alignments files (fasta format). I have a few fasta files each containing multiple sequence alignments. When I try to run this function below I get an AttributeError: ‘generator’ object has no attribute …

Total answers: 1

Remove duplicated sequences in FASTA with Python

Remove duplicated sequences in FASTA with Python Question: I apologize if the question has been asked before, but I have been searching for days and could not find a solution in Python. I have a large fasta file, containing headers and sequences. >cavPor3_rmsk_tRNA-Leu-TTA(m) range=chrM:2643-2717 5’pad=0 3’pad=0 strand=+ repeatMasking=none GTTAAGGTGGCAGAGCCGGTAATTGCATAAAATTTAAGACTTTACTCTCA GAGGTTCAACTCCTCTCCTTAACAC >cavPor3_rmsk_tRNA-Gln-CAA_ range=chrM:3745-3815 5’pad=0 3’pad=0 strand=- …

Total answers: 4

How to get BioBERT embeddings

How to get BioBERT embeddings Question: I have field within a pandas dataframe with a text field for which I want to generate BioBERT embeddings. Is there a simple way with which I can generate the vector embeddings? I want to use them within another model. here is a hypothetical sample of the data frame …

Total answers: 2