Questions tagged [bioinformatics]

Bioinformatics is the use of software tools to analyse biological data.

Filter by
Sorted by
Tagged with
1 vote
0 answers
55 views

First order hidden Markov model with Viterbi algorithm in Java

Introduction A first order HMM (hidden Markov model) is a tuple \$(H, \Sigma, T, E, \mathbb{P})\$, where \$H = \{1, \ldots, \vert H \vert\}\$ is the set of hidden states, \$\Sigma\$ is the set of ...
coderodde's user avatar
  • 27.6k
2 votes
1 answer
76 views

Semi-dynamic range minimum query (RMQ) tree in Java

Introduction I have this semi-dynamic range minimum query (RMQ) tree in Java. It is called semi-dynamic due to the fact that it cannot be modified after it is constructed. However, the values ...
coderodde's user avatar
  • 27.6k
6 votes
1 answer
82 views

Optimizing __getitem__ for a bioinformatics script in Python

I'm writing a script for a bioinformatics application in Python that iterates through several sequences looking for amino acids in specific positions to calculate their frequency in relation to a ...
Eduardo Menotti's user avatar
4 votes
1 answer
68 views

Random FASTA file generator

This is my code to generate a FASTA file containing multiple records with randomized DNA sequences with distinct length. I am looking for feedback on how to write this script better. ...
Supertech's user avatar
  • 141
2 votes
2 answers
84 views

Slow Bioinformatics algorithm - Clump finding algorithm in Haskell

I'm working on the famous clump finding problem to learn Haskell. Part of the problem involve breaking nucleotide sequences, called kmers, into subsequences as follows: ...
plaffont's user avatar
5 votes
1 answer
237 views

Converting an RNA sequence into the amino acid code and introducing a mutation

I have recently started coding in Python and this is my first proper project. The user enters an RNA sequence and the program converts the code into the corresponding amino acid sequence. The user can ...
user260750's user avatar
1 vote
1 answer
85 views

Show different concentrations on scatter plots with different colors [closed]

I have an app which parses data files on the clients browsers and displays a scatter chart. This is an example of a scatter chart with 10,000 data points: This is an example of a scatter chart with 1....
Mark's user avatar
  • 221
1 vote
1 answer
50 views

Sensibly using fastq crate to modify fastq files

I'm learning Rust, and I have a simple program that I hope to use as a learning exercise. My goal here is to get a better idea of the proper way of doing things. I'm trying to use the fastq crate to ...
Tsaari's user avatar
  • 11
5 votes
1 answer
372 views

Rust program to one hot encode genetic sequences from .fa files

I wanted to write some code which reads in a FASTA file and one hot encodes the sequence which is consequentially saved to a file. A FASTA file is a text based file format commonly used in ...
dry-leaf's user avatar
1 vote
1 answer
413 views

Python Fasta Parser using dictionaries without using BioPython or other external libraries

I am writing my own parser for fasta format. I can't use Biopython or anything else, because it's a part of an assigment and our teacher wants us to try to do it manually. For now, I have done this: <...
CitronWorld's user avatar
4 votes
1 answer
629 views

Function to calculate the GC content variation in a sequence

I came across this BMC Genomics paper: Analysis of intra-genomic GC content homogeneity within prokaryotes And I implemented some Python functions to make this available as part of a personal project. ...
Paulo Sergio Schlogl's user avatar
8 votes
3 answers
1k views

Filter out ambiguous bases from a DNA sequence

I have this function: ...
Paulo Sergio Schlogl's user avatar
3 votes
2 answers
5k views

Filtering FASTQ file based on read names from other file (how to increase performance) Python

I have some code here that basically takes in a list of IDs (sequencing read names) using STDIN, and then filters fin (a gzipped FASTQ file) to just those reads ...
Set's user avatar
  • 372
3 votes
2 answers
221 views

Counting the number of k-mers like monomers, dimers to hexamers from the fasta file

Anyone here who uses Python for solving bioinformatics problems. This is the code I have written for counting the number of k-mers like monomers, dimers to hexamers from the fasta file. You just have ...
Roshan Shrestha's user avatar
11 votes
3 answers
671 views

FASTA-to-tsv conversion script

I worked on a script that takes as input a multi-sequence .fasta file and outputs the number of each aminoacid/sequence in a .tsv...
sachikox's user avatar
  • 113
2 votes
0 answers
51 views

Faster algorithm/language for substring sliding window replacement

I had a sample file with a long string >50M like this. ...
hey0god's user avatar
  • 21
2 votes
0 answers
55 views

Genetic sequence analyzer that reads FASTA and GenBank file formats and outputs all possible gene products

I have updated my my gene sequencing program from my previous post. That post explains what each functions accomplish. If you need clarifications feel free to ask. Any tips to make the code more ...
Ethan Hetrick's user avatar
6 votes
1 answer
463 views

GenBank to FASTA format using regular expressions without Biopython

This is a Biopython alternative with pretty straightforward code. How can I make this more concise? ...
Ethan Hetrick's user avatar
1 vote
2 answers
694 views

Protein Translation - Translate RNA sequences into proteins

RNA can be broken into three nucleotide sequences called codons, and then translated to a polypeptide like so: RNA: "AUGUUUUCU" => translates to Codons: <...
Milliorn's user avatar
  • 620
4 votes
0 answers
127 views

Optimizing hundreds of millions of SQLite database inserts in Python

Some background Feel free to skip this if you're not interested. There is a very popular bioinformatics program called tabix that permits interval-based searches for genetic variants in VCF files. ...
Daniel Standage's user avatar
3 votes
1 answer
251 views

Code to remove columns in a (fasta) file with more than 90% '-' characters in that column

Context: This script reads in a fasta file, counts the number '-' characters, alphabetic characters and total characters for each sequence (sequence descriptions are on lines marked with '>'), and ...
Biomage's user avatar
  • 249
5 votes
1 answer
181 views

Downsample fastqs

I'm working on a project to downsample some fastqs (files that contain sequences). Each line of the fastq bioinformatics format comprises 4 lines chunks (id, dna sequence, "+", quality ...
Yujin Kim's user avatar
4 votes
2 answers
86 views

Run the needle program for a query against the subject files and return the result

I have written the script to run locally the needle program for a query against the subject files. It returns the highest percentage result file as a string. In addition it also converts to html file (...
catuf's user avatar
  • 433
3 votes
1 answer
3k views

Convert text file to html?

I have a script that converts a text file to html. The text file is an output of a program (needle). The function takes the text file as an input. I am aware the script is awful. I use this function ...
catuf's user avatar
  • 433
4 votes
1 answer
122 views

A small protein database

I am making a small database and these are the following files. The scripts are working. How can I improve my scripts? Are there any places where a problem could occur? I have yet to write tests for ...
catuf's user avatar
  • 433
3 votes
1 answer
69 views

Run an external program and extract a pattern match along with the result file

The script takes two input files of protein sequences and runs an external program (installed in linux/MacOS). The result provides a text output file example output.. Identity percentage is extracted ...
catuf's user avatar
  • 433
2 votes
0 answers
737 views

Rosalind - Finding a Shared Motif

Here is my attempt to implement the Ukkonen algorithm for the Finding a Shared Motif problem on rosalind.info. The code works, it produces a correct answer. It does so in 11 seconds. I am hoping to ...
Andrew Au's user avatar
  • 525
5 votes
1 answer
1k views

Building a frequency dictionary from a Pandas dataframe

I need to make a frequency dictionary from a pandas series (from the 'amino_acid' column in dataframe below) that also adds an adjacent row for each entry in the dictionary (from 'templates' column). ...
Luke's user avatar
  • 75
3 votes
1 answer
33 views

Ruby command to edit a field in a SAM file

Inspired by a bioinformatics question on Stack Overflow, I wanted to brush up on my Ruby knowledge, since I’ve been meaning to replace my command-line use of Perl by Ruby. Briefly, the problem ...
Konrad Rudolph's user avatar
4 votes
1 answer
210 views

Lazy Loading a Bioinformatic SAM record

I'm currently writing an API to work with Bioinformatic SAM records. Here's an example of one: ...
Sam's user avatar
  • 332
2 votes
1 answer
73 views

Locate substrings within a file

Here, I am reading in a newline delimited file that can be millions of repeating lines that looks like this: ...
The Nightman's user avatar
2 votes
1 answer
90 views

Looping through file finding sequences

For an assignment, I had to loop through a text file, and report any positions that a user entered sequence was found. Is there any way I can make this code more efficient, because it seems like I'm ...
Linny's user avatar
  • 10k
1 vote
2 answers
84 views

Getting the frequency of letters in each position

I have a text file like this example: ...
user188727's user avatar
6 votes
1 answer
5k views

Needleman-Wunsch Grid Generation in Python

The Needleman-Wunsch algorithm is a way to align sequences in a way that optimizes "similarity". Usually, a grid is generated and then you follow a path down the grid (based off the largest value) to ...
Dair's user avatar
  • 5,864
14 votes
2 answers
781 views

Translate nucleic acid sequence into its corresponding amino acid sequence

Goal of the program The goal of the program is to translate a nucleic acid sequence into its corresponding amino acid sequence. The nucleic sequences have to be formatted in a specific format called <...
felix's user avatar
  • 588
2 votes
2 answers
460 views

Counting average protein length from a proteome fasta file

this code is counting the average protein length (number of amino acids) across the proteome of some microbes. As it stands the code takes a very very long time to run, I think I'm being very ...
Biomage's user avatar
  • 249
6 votes
1 answer
182 views

Mapping DNA nucleotides into two-dimensional coordinates

I am the author of this package that turns DNA sequences into two dimensional visualizations. DNA, for the unaware, consists of four letters (A, T, G, and C). To convert the sequence, I am using this ...
Benjamin Lee's user avatar
3 votes
1 answer
80 views

Counting dinucletotide fractions & j2 index from a genome fasta file

I wrote this code to count the dinucletide fractions that appear in a genome (this is a sequence of two nucleotides, 'A','G','C','T', together). My code also calculates the j2 index (this is a very ...
Biomage's user avatar
  • 249
5 votes
3 answers
1k views

DNA reverse complement as fast as possible

This code is meant to compute the reverse complement for a given sequence of bases. The code is tested versus some test cases and seems to work so far. The primary goal is that it should be as fast ...
DrSvanHay's user avatar
  • 153
6 votes
1 answer
3k views

Counting the occurrences of certain amino-acids in a file

I wrote this code to count the number of amino acids that appear in a proteome. However, I was recently told by someone I could improve it quite a lot to make it more readable and efficient by using ...
Biomage's user avatar
  • 249
8 votes
1 answer
100 views

Highly nested bioinformatics processing

I have a script for parsing BAM files. The script's input thus is lines like ...
Randoms's user avatar
  • 183
7 votes
2 answers
886 views

Calculate Hamming distance between DNA sequences in Ruby

I am requesting a review for my solution to this problem from exercism.io. I'm posting it here since there is not always input on solution submitted through exercism. The problem is as stated: ...
user9503053's user avatar
2 votes
0 answers
457 views

Smith-Waterman algorithm for local sequence alignment with affine gap penalties

The following is a summary from the top of my head so please correct me if I'm wrong. See the Wikipedia article for more. This is about determining the (score / edit distance of the) most similar ...
ngmir's user avatar
  • 121
4 votes
1 answer
352 views

Find a cyclic peptide with a given non-ideal spectrum

For a course I need to build a peptide from scratch that matches the given spectrum. So I start with the amino acids that are in the given spectrum and filter those out that do not have the right ...
user avatar
3 votes
1 answer
69 views

Determining whether a list of pathways and its genes are all included in another list

I am evaluating if a list of pathways and its genes has pathways included in another pathways. So the way I thought about it is to create a function that does just a single comparison. ...
llrs's user avatar
  • 273
6 votes
2 answers
241 views

Genetic Sequence Visualizer - Generating large images

Inspired by this reddit post, I have written a program that accepts a DNA sequence (in a FASTA file format) and generates a graphical representation. HIV virus and Ebola virus My program works like ...
logwet's user avatar
  • 175
11 votes
1 answer
130 views

Python genetic sequence visualizer

I'm a beginner at python, and this is my first major project. Inspired by this reddit post, I wrote a program that accepts a DNA sequence (in a FASTA file format) and generates a graphical ...
logwet's user avatar
  • 175
9 votes
6 answers
3k views

Implementing a DNA codon table in C

I decided to redo the first program I wrote (after the hello world thing). So, what it does is to convert a DNA sequence string to an array of strings that represent the amino acids that are made in a ...
Darius Duesentrieb's user avatar
11 votes
5 answers
2k views

Counting relevant entries in a large bioinformatics file

I have a working example of a piece of code which opens up a file, gathers information about the contents, and outputs a map which contains the information. The file The file type is an in-house ...
Sam's user avatar
  • 332
5 votes
1 answer
261 views

Program to process fastq files

My program evaluates fastq files. The fastq file is just a huge text file (about 1,5gb in my case), which looks like this: ...
Julian's user avatar
  • 51