Questions tagged [python]
python is a programming language, widely used in bioinformatics
559
questions
0
votes
1
answer
46
views
Refactoring pandas using an iterator via chunksize
This question was also asked on Stack Overflow
Bioinformatics rationale eggNOG files can be very big and sump all available RAM for regular to medium sized desktops.
I am looking for advice on using ...
2
votes
1
answer
41
views
Assign score to PyRanges from another PyRanges object
I have two PyRanges objects. PR1 is a set of regions of interest across a chromosome, PR2 tiles the genome and has a score associated with each range.
I need a way to get for each range in PR1 its ...
2
votes
1
answer
41
views
Error while running computeMatrix command in Deeptools
I am trying to get computeMatrix for bigwig file in specific genomic region using deeptools.
Below is the code I am using
...
0
votes
1
answer
31
views
Generating 3D cartesian coordinates of a peptide and computing van der Waal interactions (1-4 atoms) for a given set of dihedral angles?
I wanted to generate 3D Cartesian coordinates of a peptide sequence for fixed bond lengths and bond angles for a given set of backbone dihedral angles and side dihedral angles. I also wanted to ...
1
vote
1
answer
36
views
Tidying MEGAN Taxonomy for Python/R Analysis
I am analysing some WGS data in MEGAN and would like to do some additional analysis in Python/R
I am having trouble Tidying the Taxonomic data in a format which would be conducive to this. Originally ...
1
vote
0
answers
30
views
How to use hashsolo for demultiplexing hashtags?
I am trying to use hashsolo and I want to make sure that I have done things correctly.
I did the below:
...
0
votes
0
answers
6
views
Is there available REGA or COMET versions for downloading & using on a local machine?
I am currently working on verifying the subgenotyping of our sequences and a subsample from the Los Alamos NL database. My supervisor has recommended using REGA & COMET for this purpose. While our ...
1
vote
0
answers
16
views
GDC API: Obtain the Objective Power (or Magnification) of a WSI file
I've been trying to find out a way to retrieve the Objective Power (or Magnification) of a Whole Slide Image file without downloading it first.
I've seen that some WSI's Objective power might be 40x ...
-2
votes
1
answer
154
views
How to calculate Allele frequency from vcf file
Organism under investigation is Plasmodium falciparum. How to calculate the allele frequency for each row?
I tried with this code:
...
1
vote
1
answer
22
views
How to get enriched pathways in the data using continous statistic measure?
I was doing pathway enrichment analysis using the below code
...
2
votes
4
answers
361
views
Parallelize or qsub a bash script
I have a bash script that I would like to parellelize to run on multiple nodes. My goal is to run my python sample_script.py script on pairwise comparisons of samples to see if their variants are a ...
1
vote
1
answer
61
views
Analysing the Effect of a Drug on the Morphological Changes of a Cell Type
We came across a project in our lab that no one exactly knows how to approach. Since, I know a little bit of Python programming, this project was assigned to me.
There is a data from a randomised ...
-2
votes
1
answer
67
views
Histogram plot using R/python with two variables[BC and Control] and their corresponding gene names
How do we plot histogram in R\Python with two variables[BC and Control] and their corresponding gene names examples is below:
Thank you,
3
votes
1
answer
66
views
Download all pubmed central article ids that have a keyword appearing in their titles/abstracts and also falling between two dates
I am using the following code to download all pubmed central article ids that have a keyword appearing in their titles/abstracts and also falling between two dates. The code seems to work when I ...
2
votes
0
answers
49
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
36
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
38
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
44
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
106
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
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
242
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
66
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
83
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
56
views
2
votes
1
answer
83
views
Python list comprehension to calculate the set of categories for each row
My data = data
...
1
vote
0
answers
116
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
112
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
109
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
85
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
57
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
56
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
63
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
41
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
340
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
52
views
expansions and contractions from OrthoFinder
The input file looks like this, and the complete file can be found here:
...
1
vote
1
answer
37
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
582
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
46
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
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 (...
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
...
3
votes
2
answers
171
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
144
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
78
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
61
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
57
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
60
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
339
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
148
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
155
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
56
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 ?