Variables and Data Types
Tested Stacks:
GATK 4.6.1
Samtools 1.21
Nextflow 24.10
Seurat v5.1
Python 3.12
Prerequisites: Basic Linux CLI & Sequencing Formats
📚 Chapter 2 of 13
0% Course Completed
Python Variables & Data Types for Genomic Analysis
Understanding native Python data structures—strings, integers, floats, lists, tuples, dictionaries, and sets—is the cornerstone of bioinformatic script development.
# 1. Strings (Genomic sequences, chromosome names)
chromosome = "chr1"
sequence = "AGCTGATCGAT"
# 2. Integers & Floats (Coordinates, p-values, coverage)
start_pos = 1450201
end_pos = 1450550
p_value = 1.45e-8
depth_coverage = 48.6
# 3. Dictionaries (Genetic code mapping)
codon_table = {
"ATG": "Methionine (Start)",
"TAA": "Stop",
"TAG": "Stop",
"TGA": "Stop"
}
# 4. Sets (Unique gene identifiers)
sample_genes = {"TP53", "EGFR", "BRCA1", "TP53"}
print("Unique genes:", len(sample_genes)) # Output: 3
⚠️
Common Pitfalls & Troubleshooting Checklist
- Java Heap Exhaustion (GATK / Picard): If processes terminate with
java.lang.OutOfMemoryError, set your environment variable explicitly:export _JAVA_OPTIONS="-Xmx16g -Djava.io.tmpdir=/tmp". - Index Timestamp Mismatch: If tools complain that a BAM index is missing or out of date, regenerate with
samtools index -@ 4 sample.bam. - Conda Channel Conflicts: Avoid ABI incompatibilities between bioconda and conda-forge by setting strict priority:
conda config --set channel_priority strict. - Chromosome Naming Contamination: Always verify whether reference FASTA headers use
chr1or1; divergent naming causes silent alignment drops.
Was this guide helpful to your research?
Help us maintain 100% accurate, peer-reviewed bioinformatics standards.