dna-sequence

Finding Longest Common Substring

Finding Longest Common Substring Question: I’m trying to find the longest common substring in all DNA strands but in testing I’m using strings of numbers. Here is the funciton I wrote: def lcsm(string_list): strands = sorted(string_list, key = len, reverse = False) longest_motif = ” seq1 = strands[0] seq2 = strands[1] motif = ” for …

Total answers: 1

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

Create a new variable instance each time I split a string in Python

Create a new variable instance each time I split a string in Python Question: I have a string into a variable x that includes ">" symbols. I would like to create a new variable each time the string is splitted at the ">" symbol. The string I have in the variable x is as such …

Total answers: 3

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

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

Codon generation in Python

Codon generation in Python Question: I have this code for converting a DNA string into a list of codons and after that to convert this list into a string with their respective aminoacids. However, when I ran the code and the DNA string ends in a pair of nucleotides(like CT for instance) and not in …

Total answers: 1

Reverse complement of DNA strand using Python

Reverse complement of DNA strand using Python Question: I have a DNA sequence and would like to get reverse complement of it using Python. It is in one of the columns of a CSV file and I’d like to write the reverse complement to another column in the same file. The tricky part is, there …

Total answers: 10

Search for string allowing for one mismatch in any location of the string

Search for string allowing for one mismatch in any location of the string Question: I am working with DNA sequences of length 25 (see examples below). I have a list of 230,000 and need to look for each sequence in the entire genome (toxoplasma gondii parasite). I am not sure how large the genome is, …

Total answers: 14