| name | biological-expert |
| version | 1.0.0 |
| description | Expert-level biology, biotechnology, genetics, bioinformatics, and computational biology |
| category | scientific |
| tags | ["biology","biotechnology","genetics","bioinformatics","genomics"] |
| allowed-tools | ["Read","Write","Edit","Bash(python:*)"] |
Biological Sciences Expert
Expert guidance for biology, biotechnology, genetics, bioinformatics, and computational biology applications.
Core Concepts
Molecular Biology
- DNA, RNA, and protein structure
- Central dogma (transcription, translation)
- Gene expression and regulation
- Genetic mutations and variations
- CRISPR and gene editing
- Protein folding and structure
Genomics & Bioinformatics
- DNA sequencing (Sanger, NGS, long-read)
- Genome assembly and annotation
- Sequence alignment (BLAST, BLAT)
- Variant calling and analysis
- RNA-seq analysis
- Phylogenetic analysis
Systems Biology
- Metabolic pathways
- Protein-protein interactions
- Gene regulatory networks
- Mathematical modeling
- Pathway analysis
- Network biology
DNA Sequence Analysis
from Bio import SeqIO, Seq
from Bio.Seq import Seq
from Bio.SeqUtils import gc_fraction, molecular_weight
from typing import Dict, List
class DNAAnalyzer:
"""Analyze DNA sequences"""
def __init__(self, sequence: str):
self.sequence = Seq(sequence.upper())
def basic_stats(self) -> Dict:
"""Calculate basic sequence statistics"""
return {
"length": len(self.sequence),
"gc_content": gc_fraction(self.sequence) * 100,
"molecular_weight": molecular_weight(self.sequence, "DNA"),
"nucleotide_counts": self._count_nucleotides()
}
def _count_nucleotides(self) -> Dict[str, int]:
"""Count each nucleotide"""
return {
'A': self.sequence.count('A'),
'T': self.sequence.count(),
: .sequence.count(),
: .sequence.count()
}
() -> :
(.sequence.transcribe())
() -> :
(.sequence.translate(table=table))
() -> :
(.sequence.reverse_complement())
() -> []:
orfs = []
strand, seq [(+, .sequence), (-, .sequence.reverse_complement())]:
frame ():
trans = seq[frame:].translate(to_stop=)
i, aa (trans):
aa == :
j (i + , (trans)):
trans[j] == :
orf_len = (j - i) *
orf_len >= min_length:
orfs.append({
: strand,
: frame,
: i * + frame,
: j * + frame,
: orf_len,
: (trans[i:j])
})
orfs
() -> []:
positions = []
motif = motif.upper()
i ((.sequence) - (motif) + ):
(.sequence[i:i+(motif)]) == motif:
positions.append(i)
positions
Sequence Alignment
from Bio import pairwise2
from Bio.pairwise2 import format_alignment
import numpy as np
class SequenceAligner:
"""Perform sequence alignments"""
@staticmethod
def global_alignment(seq1: str, seq2: str,
match: float = 2,
mismatch: float = -1,
gap_open: float = -0.5,
gap_extend: float = -0.1):
"""Perform global alignment (Needleman-Wunsch)"""
alignments = pairwise2.align.globalms(
seq1, seq2,
match, mismatch,
gap_open, gap_extend
)
best = alignments[0]
return {
"aligned_seq1": best.seqA,
"aligned_seq2": best.seqB,
"score": best.score,
"identity": SequenceAligner._calculate_identity(best.seqA, best.seqB)
}
@staticmethod
def local_alignment(seq1: str, seq2: str,
match: float = 2,
mismatch: float = -1,
gap_open: float = -0.5,
gap_extend: = -):
alignments = pairwise2.align.localms(
seq1, seq2,
, mismatch,
gap_open, gap_extend
)
best = alignments[]
{
: best.seqA,
: best.seqB,
: best.score,
: SequenceAligner._calculate_identity(best.seqA, best.seqB)
}
() -> :
matches = ( a, b (seq1, seq2) a == b a != )
(matches / ((seq1), (seq2))) *
Genomic Variant Analysis
from dataclasses import dataclass
from typing import Optional
@dataclass
class Variant:
chromosome: str
position: int
reference: str
alternate: str
quality: float
genotype: str
depth: int
allele_frequency: Optional[float] = None
class VariantAnnotator:
"""Annotate genetic variants"""
def __init__(self):
self.gene_annotations = {}
def annotate_variant(self, variant: Variant) -> Dict:
"""Annotate variant with functional consequences"""
annotation = {
"variant": f"{variant.chromosome}:{variant.position}{variant.reference}>{variant.alternate}",
"type": self._classify_variant_type(variant),
"effect": self._predict_effect(variant),
"quality": variant.quality,
"depth": variant.depth
}
if variant.allele_frequency:
annotation["allele_frequency"] = variant.allele_frequency
annotation["rarity"] = ._classify_rarity(variant.allele_frequency)
annotation
() -> :
ref_len = (variant.reference)
alt_len = (variant.alternate)
ref_len == alt_len == :
ref_len < alt_len:
ref_len > alt_len:
:
() -> :
._classify_variant_type(variant) == :
() -> :
af > :
af > :
:
RNA-seq Analysis
import pandas as pd
import numpy as np
from scipy import stats
class RNASeqAnalyzer:
"""Analyze RNA-seq expression data"""
def __init__(self, counts_matrix: pd.DataFrame):
"""
counts_matrix: genes x samples matrix of raw counts
"""
self.counts = counts_matrix
self.normalized = None
def normalize_counts(self, method: str = "tpm"):
"""Normalize count data"""
if method == "tpm":
self.normalized = (self.counts / self.counts.sum(axis=0)) * 1e6
elif method == "log2":
self.normalized = np.log2(self.counts + 1)
return self.normalized
def differential_expression(self, condition1: List[str],
condition2: List[str],
method: = ) -> pd.DataFrame:
results = []
gene .counts.index:
expr1 = .counts.loc[gene, condition1]
expr2 = .counts.loc[gene, condition2]
method == :
statistic, pvalue = stats.ttest_ind(expr1, expr2)
fc = expr2.mean() / (expr1.mean() + )
log2fc = np.log2(fc)
results.append({
: gene,
: expr1.mean(),
: expr2.mean(),
: fc,
: log2fc,
: pvalue,
: pvalue < (log2fc) >
})
pd.DataFrame(results)
() -> []:
Best Practices
Data Analysis
- Use appropriate statistical tests
- Account for multiple testing correction
- Validate results with independent methods
- Document data preprocessing steps
- Use version control for analysis scripts
- Maintain reproducible workflows
Sequence Analysis
- Quality control of sequencing data
- Use appropriate reference genomes
- Validate variant calls
- Consider batch effects
- Use established bioinformatics tools
- Benchmark against known datasets
Computational Biology
- Use efficient data structures for large datasets
- Parallelize computationally intensive tasks
- Validate biological interpretations
- Consult domain experts
- Document assumptions clearly
- Use standardized file formats (FASTA, VCF, BAM)
Anti-Patterns
❌ No quality control of input data
❌ Ignoring batch effects
❌ No multiple testing correction
❌ Over-interpreting correlations
❌ Inadequate sample sizes
❌ Not validating computational predictions
❌ Ignoring biological context
Resources