Questions tagged [python]

python is a programming language, widely used in bioinformatics

Filter by
Sorted by
Tagged with
2 votes
0 answers
26 views

Extracting positions from PAF files in order to extract sequences from a Fastq file with Python

I have used Minimap2 to create a paf file by aligning a Fastq file against itself. Now from this Paf file I can see where the reads overlap, and I want to take these positions, and use them to extract ...
1 vote
1 answer
30 views

Given a FASTA file with a set of genes, how do I determine that set's conservation among a genetic order?

Given a set of genes in a FASTA-formatted file, for example: exFasta.fa, what is the best way to determine how well conserved the genes in that file are among an ...
  • 11
1 vote
0 answers
24 views

From SMILE get Amber force in Python

I have a list of SMILES of small molecules and I want to be able to simulate these molecules with an Amber force field in Python. Currently, I use RDkit to convert the smile into a PDB file: ...
  • 11
2 votes
1 answer
40 views

How to tackle an Index Error in my code for finding ORFs

I have created a python code that prints out all lengths of ORFs in a DNA sequence (start codon - "ATG", stop codons - "TAG", "TAA" and "TGA". It seems to give ...
3 votes
1 answer
59 views

Plot phylogenetic tree from list of edges

I have a dataset that I wish to convert to tree or phylo format like in the ape package, in order to plot the phylogenetic tree. It is formatted like a list of ...
  • 33
1 vote
1 answer
21 views

How to calculate frequency of a category with respect to the value in another column?

I was trying to calculate the frequency of disease_present (yes) when smoking status is y (yes) for each group (A, B, C, D) <...
3 votes
3 answers
71 views

How to run python request for list of url's with multiple page numbers?

Hi I am trying to get the cancer ontologies (obo_id and label) from EBI-OLS. Earlier I have used the below code to get the obo_id terms and ...
  • 383
4 votes
1 answer
53 views

calculating mutation frequencies for every gene

I have a dataset for mutation data and I want to calculate mutation frequencies across all genes df (This is only the small subset of data) ...
  • 319
2 votes
1 answer
65 views

Math on Pandas Columns

I have a pandas dataframe that reads in a PAF file from minimap2. What I would like to do is take the first 5 columns of the data from to create a BED file. I used this to extract the first 5 columns: ...
  • 453
2 votes
1 answer
56 views

Automate the def function in pandas for correlation

...
  • 307
2 votes
1 answer
72 views

Python list comprehension to calculate the set of categories for each row

My data = data ...
  • 383
1 vote
0 answers
50 views

How to plot average gene expression in scanpy?

I would like to make a UMAP where the cells are colored by the average expression of the bulk signature genes but I am not confident that I did it correctly. I would like to use scanpy for it. I did ...
1 vote
1 answer
89 views

Primer trimming-fasta files

My goal: I want to trim off the primers (Forward : CGAGAAGACCCTRTGRAGCT, Reverse : GTTGGGGYGACCNYGG) from a fasta file with a lot of dna sequences allowing for some (e.g. 3) mismatches (identity). ...
2 votes
0 answers
61 views

How to make a UMAP for single cell data and color cells by average expression of a list of genes in scanpy?

I would like to make a UMAP where the cells are colored by the average expression of the bulk signature genes but I am not confident that I did it correctly. I would like to use scanpy for it. I did ...
1 vote
1 answer
27 views

calculate the backchain RMSD between two pdb files by pymol in Python

i have two protein pdb files and want to calculate the backchain RMSD between them. As far as I know the GUI of Pymol can use align to calculate the RMSD (but I don't know if it is the backchain RMSD)....
2 votes
1 answer
52 views

how to do manual search on NCBI with biopython and add link to publication

I'm trying to reproduce a complex manual search on NCBI using BioPython, but obviously something is not right. My command line is not working, but I'd especially like a way to have an accurate search ...
3 votes
2 answers
52 views

hierarchical clustering of kmers and their counts

I have a list of kmers and their frequencies broken down like this: ...
  • 453
2 votes
2 answers
56 views

Sort dictionary in descending order

Hi I am looking to sort a list of kmers into descending order. I used KMC to obtain a list of kmers from a fastq file separated by tab (e.g.; kmer count). From there I have written this python script ...
  • 453
4 votes
1 answer
39 views

Trim reads 1kb upstream of sequence

I need a quick way to trim multiple reads in a FASTA file. I need to trim everything that is 1kbp upstream of this sequence ...
  • 453
-1 votes
3 answers
199 views

Find open reading frames in a DNA sequence

I have a fast file containing DNA sequences. I've already cleaned the file and has only DNA sequences with no gaps or errors or white space characters. I want to find open reading frames in the fasta ...
user avatar
2 votes
2 answers
48 views

expansions and contractions from OrthoFinder

The input file looks like this, and the complete file can be found here: ...
1 vote
1 answer
28 views

How to get single histogram plot for all groups in different colours?

I am using the below script to get the histogram plot for all values together. However, I want a single plot but different colours for different groups (A, B, C) ...
3 votes
3 answers
306 views

How to write FASTA records using "Bio.SeqIO.write()"

Update: Biopython document says that "Bio.SeqIO.FastaIO.FastaWriter" class is obsolete. Now my question becomes how to I use Bio.SeqIO.write() fucntion to ...
  • 534
2 votes
0 answers
32 views

pyScenic CLI for ctx is giving error: Not a single module loaded

Hi I ran pyScenic's ctx via the command in command prompt: ...
  • 21
2 votes
2 answers
55 views

To get background_gradient plot for all data frames in the for loop

I tried the below code to get the background_gradient plot for each diabetes_group. It is giving me only plot for the last group in the plot. How to get background_gradiant for all items (...
  • 383
2 votes
1 answer
70 views

How to statistically test the strength and weakness of a correlated pair?

Subset of df before groupby looks like ...
  • 383
3 votes
2 answers
143 views

dealing with a list of VEP files

I'm new to dealing with big and compressed data so, I have some questions regarding that I have 1000 files, each file has the extension (vep.txt.gz) I want to read these files, then filter them. The ...
  • 31
2 votes
1 answer
88 views

How to get separate histograms plots on the basis of the column value?How to detect which plot has most deviation?

I have a data frame (df) which has correlations calculated for different genes with respect to different ID combinations. I want to get separate histogram plot based on the gene name (separate plot ...
  • 307
2 votes
0 answers
54 views

Drawing synteny using CIRCOS from progressive MAUVE alignment

I am using Mauve app to align two whole genomes. I've aligned these genomes (gbk files) with the progressive Mauve aligner, and I got sp.sslist, sp.xmfa, sp.guide_tree,sp.backbone file, sp.bbcols etc ...
  • 21
3 votes
1 answer
51 views

Merge the dataframes with python iterator

I have 3 experiment files (File1.tsv, File2.tsv, File3.tsv) from three experiments and 1 library file (library_file.tsv). I want ...
  • 307
1 vote
2 answers
49 views

How to apply a mathematical function to a matrix in R

I have a matrix that looks something like this: chr pos het chrI 27 2 chrI 55 0 chrI 27 0 chrI 55 1 It's essentially a VCF file that I have converted into a TSV. I want to be able to take all ...
  • 453
3 votes
0 answers
37 views

How to concatenate 2 `mdata` of `muon` package?

I used muon(https://github.com/scverse/muon) for single cell Multimodal omics analysis. How to concatenate 2 mdata from ...
  • 131
1 vote
4 answers
224 views

How to download ligands for PDB structure

I have some PDB IDs and for every structure, I need all its ligands, so I want to automate the process. The ligands are different for every chain: ...
  • 215
4 votes
2 answers
111 views

Searching motifs in sequence and their frequencies

This is a two part question. I am searching for a motif, and in that search I wanted to also find the total number of sequences in my FASTA file, but the code I wrote is not yielding that please see ...
  • 133
-2 votes
2 answers
137 views

Merge data frame on either of the 2 columns in R or python

I have two data frames. One data frame with one column and second data frame with two columns. I need to merge first data frame with either column of the second data frame and returns the values. ...
1 vote
2 answers
51 views

How can I get the coordinates of Hydrogen atoms attached to alpha-carbon?

I am trying to extract the hydrogen atoms attached to the Ca carbon in N no. of proteins. I would be needing the coordinates to calculate its centroid. How should I do it in python ?
2 votes
1 answer
317 views

How to manually trim FASTA file sequences with the information provided in the header and store it into a new FASTA file? - Python

I have a FASTA file that has reads like this: >SRR5655563.745 745 length=126 (type=T,start=2,end=12,length=11,identity=81.8182%) ...
3 votes
3 answers
110 views

Read Clustal file in Python

This question was also asked on StackOverflow 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 ...
1 vote
1 answer
38 views

HTTP status code: 400 "Value must be an integer" error uploading JSON schema results to benchling

I am writing a benchling uploader script in python to upload data from a csv file in a JSON formatted schema to the benchling API platform. My function to create the JSON schema in the script looks ...
  • 91
1 vote
1 answer
100 views

Reading a Fast5-file with Python

I am trying to extract data from fast5-file with python 3.9.13 in Ubuntu. I have found a library "fast5_research"(This package comprises an API to HDF containers used by the research groups ...
  • 21
0 votes
2 answers
57 views

How to extract date of acquisiton from mzXML and mzML files with Python?

I would like to extract date of acquisiton from mzXML and mzML files, using Python. Is it possible e.g. with Pyteomics? pymzml is only for mzML files. Are there other libraries that can do that? I ...
  • 1,273
5 votes
4 answers
190 views

File I/O error using nglview.show_biopython(structure)

So I have been trying to get into visualizing proteins in python, so after some research I ended up on a tutorial that was teaching you how to visualize a protein from the COVID-19 virus, so I went ...
4 votes
1 answer
53 views

RNA folding at specific temperature with ViennaRNA in python

I am trying to get dot-bracket-notations of single stranded RNA via the ViennaRNA python package (https://pypi.org/project/ViennaRNA/) at different temperatures. I have read in the docs (https://www....
  • 41
1 vote
0 answers
37 views

Visualise multiple disappearing pdb files in Pymol

I have a sequence of pdb files which I want to load in pymol window so that it gives an impression of a video. I am using cmd.load function in a loop and deleting the loaded file in the next step. But ...
1 vote
1 answer
59 views

Can I perform Expression Analysis on this 10x dataset?

10x Genomics: 20k Human PBMCs is the dataset. Description of the dataset: Inputs/Libraries Human peripheral blood mononuclear cells (PBMCs) of a healthy male donor aged 30-35 were obtained by 10x ...
  • 141
0 votes
1 answer
87 views

finding the frequency of a motif-matching peptide

This question has also been asked on Biostars I want to find the frequency of each motif-matching peptide. The sequences are: ...
  • 133
1 vote
0 answers
48 views

ETE4 manual or improved code description

ETE3 * (Environment for Tree Exploration) is a major package and in particular Python package to navigate phylogenetic trees. It is the premier coding library/package for tree manipulation. ETE4.0.0 ...
  • 9,665
2 votes
2 answers
30 views

finding overlapping motifs to increase length of motif

I am able to find matching motif in my sequence, and I would like to now find overlapping motifs. Basically, after matching my motif, I want to find the 6 amino acids after it. This is the code below ...
  • 133
1 vote
2 answers
137 views

motif searching in a multi-fasta file

I am having trouble trying to search for motifs in a multi fasta file. I have used two techniques one gives me the name of the sequence where the motif is found but doesn't give me the the motif and ...
  • 133
2 votes
1 answer
95 views

finding motifs in fasta file with multiple sequences

I am able to find matching motifs on a single sequence, as well as their position as shown below : ...
  • 133

1
2 3 4 5
11