Questions tagged [python]
python is a programming language, widely used in bioinformatics
597
questions
2
votes
0
answers
123
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
46
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 ...
1
vote
0
answers
84
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:
...
2
votes
1
answer
54
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
192
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 ...
1
vote
1
answer
34
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
790
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 ...
4
votes
1
answer
132
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)
...
2
votes
1
answer
113
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:
...
2
votes
1
answer
57
views
2
votes
1
answer
88
views
Python list comprehension to calculate the set of categories for each row
My data = data
...
1
vote
0
answers
300
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
210
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
161
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 ...
2
votes
1
answer
281
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
77
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
101
views
hierarchical clustering of kmers and their counts
I have a list of kmers and their frequencies broken down like this:
...
2
votes
2
answers
111
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 ...
4
votes
1
answer
46
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 ...
-1
votes
3
answers
785
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 ...
2
votes
2
answers
58
views
expansions and contractions from OrthoFinder
The input file looks like this, and the complete file can be found here:
...
1
vote
1
answer
54
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
1k
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 ...
2
votes
0
answers
103
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:
...
2
votes
2
answers
68
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 (...
2
votes
1
answer
73
views
How to statistically test the strength and weakness of a correlated pair?
Subset of df before groupby looks like
...
3
votes
2
answers
252
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 ...
2
votes
1
answer
308
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 ...
2
votes
0
answers
145
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 ...
3
votes
1
answer
122
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 ...
1
vote
2
answers
97
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 ...
3
votes
0
answers
158
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 ...
1
vote
4
answers
613
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:
...
4
votes
2
answers
191
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 ...
-2
votes
2
answers
252
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
65
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
607
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
207
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
104
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 ...
1
vote
1
answer
309
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 ...
0
votes
2
answers
186
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 ...
5
votes
4
answers
258
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
156
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....
1
vote
0
answers
66
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
votes
1
answer
79
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 ...
0
votes
1
answer
95
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:
...
2
votes
1
answer
244
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 ...
2
votes
2
answers
35
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 ...
2
votes
2
answers
240
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 ...
2
votes
1
answer
162
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 :
...