bioinformatics

Removing characters from a list of strings if they don't follow a list

Removing characters from a list of strings if they don't follow a list Question: I have a python code and I’m working with a list of sequences seq0,seq1,seq2,seq3,seq4,seq5 = ‘CCACGCGTCCGCCGCGACCTGCGTTTTCCTGGGGGTCCGCAACTCTGGCTTGACCCAAGGACCCGGCCAC’,’attgccattatataACCCGGCCACCCCCATAGGCAGATGTCAGGACAACTCGCATCTCAGCAGAGCAGCCCCTGGCCCAGG’,’TCXCACCCATAGGCAGATGGCCTCCGCCCCACCCCCGGGAGGATTTCTTAATGGGGTGAAAATGC’,’CAGTCCCCGAAGCCAGGGTTCCGGGACCCCCGGGGCCGAGCTGGGCGCGGGAAAAGAAttacggacttaGTCAGCCCCGCAGGGG’,’ATGGGGTGATCGTCGCTCGCGGGCTCTGTCTTCCTGTTCACCCTCCTCTGCCCCCAACTCCATCTCTGAGACCTCCTGCCCCCCCA’,’AAAAAAGAAGTCGCTCGCGTCGCTCGCGGGCTGGGCTCTGTCTGCGTCGCTCGCGGGCTAGAGAGCCAGGGTGA’ NTs = [seq0,seq1,seq2,seq3,seq4,seq5] nucleotides = [‘G’,’A’,’C’,’T’, ‘U’] if any(x not in nucleotides for x in NTs): print("ERROR: non-nucleotide characters present") so this works so far …

Total answers: 2

How to get a consensus of multiple sequence alignments using Biopython?

How to get a consensus of multiple sequence alignments using Biopython? Question: I am trying to get a consensus sequence from my multiple alignments files (fasta format). I have a few fasta files each containing multiple sequence alignments. When I try to run this function below I get an AttributeError: ‘generator’ object has no attribute …

Total answers: 1

Convert .tab file into pandas dataframe

Convert .tab file into pandas dataframe Question: After downloading a .tab file, I am trying to convert it into a pandas df but it looks very strange when I run this line of code: df = pd.read_csv(‘/Users/me/HUMAN_9606_idmapping_selected.tab’, sep =’t’, nrows=10) File: https://ftp.uniprot.org/pub/databases/uniprot/current_release/knowledgebase/idmapping/by_organism/HUMAN_9606_idmapping_selected.tab.gz How can I convert it to look like a regular df? Asked By: …

Total answers: 1

pip install planemo fails with error: "ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/usr/local/locale'"

pip install planemo fails with error: "ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/usr/local/locale'" Question: I am trying to install planemo like so: /usr/local/bin/pip3 install virtualenv virtualenv .venv . .venv/bin/activate /usr/local/bin/pip3 install planemo The last command fails with this error message: ERROR: Could not install packages due to an …

Total answers: 3

Snakemake scatter-gather with wildcard AmbiguousRuleException

Snakemake scatter-gather with wildcard AmbiguousRuleException Question: My problem is when using Snakemake scatter-gather feature the documentation is basic and i modified my code according to mentioned in this link: rule fastq_fasta: input:rules.trimmomatic.output.out_file output:"data/trimmed/{sample}.fasta" shell:"sed -n ‘1~4s/^@/>/p;2~4p’ {input} > {output}" rule split: input: "data/trimmed/{sample}.fasta" params: scatter_count=config["scatter_count"], scatter_item = lambda wildcards: wildcards.scatteritem output: temp(scatter.split("data/trimmed/{{sample}}_{scatteritem}.fasta")) script: "scripts/split_files.py" rule …

Total answers: 1

Python3: TypeError: 'module' object is not callable

Python3: TypeError: 'module' object is not callable Question: I keep trying to run a bit of python on mac terminal, and I’m hit with the following error: "TypeError: ‘module’ object is not callable" Reference code: import re import pathlib as Path mypath = Path(‘users/pranav/Desktop/sir/samplenames.txt’) Could someone break down the error for me and explain what …

Total answers: 1

Dendropy: Add inner node midway between two nodes

Dendropy: Add inner node midway between two nodes Question: I’m very new to DendroPy. What I want to do seems simple but I can’t figure how to do it correctly and I didn’t find anything on the internet. I want to add a node midway between two nodes in a existing rooted dendropy tree. from …

Total answers: 1

Snakemake not recognizing multiple files as input

Snakemake not recognizing multiple files as input Question: I’m having some trouble running snakemake. I want to perform quality control of some RNA-Seq bulk samples using FastQC. I’ve written the code in a way that all files following the pattern {sample}_{replicate}.fastq.gz should be used as input, where {sample} is the sample id (i.e. SRR6974023) and …

Total answers: 1

"Desired structure doesn't exist" for PDB retrieve_pdb_file method

"Desired structure doesn't exist" for PDB retrieve_pdb_file method Question: Trying to download some protein data from PDB using Biopython’s Bio.PDB.PDBList Here is a min. reproducible example: from Bio.PDB import PDBList pdbl=PDBList() pdbl.retrieve_pdb_file(‘1GAV’, file_format="pdb") This returns: Downloading PDB structure ‘1GAV’… Desired structure doesn’t exists Desired behavior is download of the PDB file to the working directory. …

Total answers: 2

How to save each ligand from a PDB file separately with Bio.PDB?

How to save each ligand from a PDB file separately with Bio.PDB? Question: I have a list of PDB files. I want to extract the ligands of all the files (so, heteroatoms) and save each one separately into PDB files, by using the Bio.PDB module from BioPython. I tried some solutions, like this one: Remove …

Total answers: 1