|
| 1 | +# jsrc genome |
| 2 | + |
| 3 | +Genome-level analysis tools. `jsrc genome` covers genome statistics, feature detection, comparative analysis, evolutionary analysis, and annotation utilities. |
| 4 | + |
| 5 | +## cpg |
| 6 | + |
| 7 | +CpG islands are genomic regions with high CpG dinucleotide density and GC content, typically located near gene promoters and associated with gene regulation. This command predicts CpG islands using the classic sliding window method (Gardiner-Garden & Frommer 1987). |
| 8 | + |
| 9 | +A window is considered a candidate CpG island if GC% ≥ 50% and observed/expected CpG ratio ≥ 0.6. Adjacent qualifying windows are merged, and regions shorter than `--min-len` are filtered out. |
| 10 | + |
| 11 | +```bash |
| 12 | +jsrc genome cpg -fa genome.fa |
| 13 | +jsrc genome cpg -fa genome.fa --window 200 --min-len 200 --min-gc 55 --json |
| 14 | +``` |
| 15 | + |
| 16 | +## orf |
| 17 | + |
| 18 | +ORF finding is the first step in gene prediction for unannotated sequences. Given a FASTA file, this command scans for open reading frames from ATG to stop codons, reporting coordinates, length, frame, and translated protein sequence. |
| 19 | + |
| 20 | +By default, only frame 1 is searched, reporting ORFs ≥ 100 nt. Use `--all-frames` to search all three forward frames, `--min-len` to adjust length threshold, and `--top N` to keep only the longest N ORFs per sequence. |
| 21 | + |
| 22 | +```bash |
| 23 | +jsrc genome orf -fa genome.fa --min-len 300 --all-frames |
| 24 | +jsrc genome orf -fa contigs.fa --top 5 --json |
| 25 | +``` |
| 26 | + |
| 27 | +## promoter |
| 28 | + |
| 29 | +When studying gene regulation, you often need to examine promoter regions. For example, to check if several genes have a transcription factor binding site in their upstream 2kb region, you first need to extract these regions in batch. |
| 30 | + |
| 31 | +This command does exactly that: given a genome, GFF, and gene ID list, it automatically calculates coordinates and extracts upstream/downstream sequences. |
| 32 | + |
| 33 | +Example input (`genes.txt`): |
| 34 | + |
| 35 | +```txt |
| 36 | +GENE001 |
| 37 | +GENE002 |
| 38 | +GENE003 |
| 39 | +``` |
| 40 | + |
| 41 | +By default, it extracts 2000bp upstream and 0bp downstream. You can adjust with `-up` and `-down`. |
| 42 | + |
| 43 | +```bash |
| 44 | +jsrc genome promoter -fa genome.fa -gff genes.gff -ids genes.txt -o promoters.fa -up 1500 -down 500 |
| 45 | +``` |
| 46 | + |
| 47 | +If your GFF uses a different feature label than `gene` (e.g., `mRNA`), set `-feature` accordingly. |
| 48 | + |
| 49 | +## repeat |
| 50 | + |
| 51 | +Find simple sequence repeats (SSR / microsatellites / STR) in genomic sequences. Scans for tandem repeat motifs within specified unit length range and minimum repeat count. |
| 52 | + |
| 53 | +Default settings search for mono- to hexa-nucleotide repeats (unit length 1–6) with at least 3 repetitions. Commonly used for microsatellite marker development and repeat annotation. |
| 54 | + |
| 55 | +```bash |
| 56 | +jsrc genome repeat -fa genome.fa |
| 57 | +jsrc genome repeat -fa genome.fa --min-unit 2 --max-unit 4 --min-reps 5 --json |
| 58 | +``` |
| 59 | + |
| 60 | +## island |
| 61 | + |
| 62 | +Genomic island detection identifies regions with deviant GC content that may indicate horizontal gene transfer, pathogenicity islands, or other foreign DNA. This command uses a sliding window approach to scan for GC content anomalies. |
| 63 | + |
| 64 | +Windows exceeding the GC threshold are marked as candidate islands. Adjacent candidate windows are merged into a single island. Use `--min-length` to filter out short regions. |
| 65 | + |
| 66 | +```bash |
| 67 | +jsrc genome island -fa genome.fa |
| 68 | +jsrc genome island -fa genome.fa --window 5000 --step 1000 --gc-threshold 0.6 --min-length 10000 --json |
| 69 | +``` |
| 70 | + |
| 71 | +## palindrome |
| 72 | + |
| 73 | +Palindromic sequences (inverted repeats) are often associated with transposons, restriction enzyme recognition sites, and hairpin structures. This command finds palindromic structures in sequences. |
| 74 | + |
| 75 | +A palindrome consists of two reverse-complementary arms separated by a gap. You can set arm length range (`--min-arm`, `--max-arm`) and maximum gap length (`--max-gap`). |
| 76 | + |
| 77 | +```bash |
| 78 | +jsrc genome palindrome -fa genome.fa |
| 79 | +jsrc genome palindrome -fa genome.fa --min-arm 8 --max-arm 30 --max-gap 20 --top 100 --json |
| 80 | +``` |
| 81 | + |
| 82 | +## stats |
| 83 | + |
| 84 | +Basic genome assembly quality metrics. This command calculates N50/L50, total length, sequence count, gap statistics, and GC content. |
| 85 | + |
| 86 | +N50 is the weighted median length—sort all sequences by length, sum from longest to shortest, and N50 is the length when cumulative sum reaches half the total. L50 is the number of sequences needed to reach N50. Higher values indicate better assembly contiguity. |
| 87 | + |
| 88 | +```bash |
| 89 | +jsrc genome stats -fa assembly.fa |
| 90 | +jsrc genome stats -fa assembly.fa --json |
| 91 | +``` |
| 92 | + |
| 93 | +## gc-skew |
| 94 | + |
| 95 | +Cumulative GC skew analysis is used to predict replication origin (oriC) and terminus (ter) in bacterial genomes. GC skew is defined as (G-C)/(G+C), typically showing a distinct minimum near the replication origin. |
| 96 | + |
| 97 | +This command calculates sliding window cumulative GC skew, outputting position and cumulative skew for each window. Visualize with plotting tools to find the curve's lowest point. |
| 98 | + |
| 99 | +```bash |
| 100 | +jsrc genome gc-skew -fa genome.fa |
| 101 | +jsrc genome gc-skew -fa genome.fa --window 10000 --step 5000 --json |
| 102 | +``` |
| 103 | + |
| 104 | +## window |
| 105 | + |
| 106 | +Sliding window GC and AT skew analysis. This command calculates GC content, GC skew, and AT skew for each window at specified window size and step. |
| 107 | + |
| 108 | +GC skew = (G-C)/(G+C), AT skew = (A-T)/(A+T). These metrics reveal local compositional features and replication bias. |
| 109 | + |
| 110 | +```bash |
| 111 | +jsrc genome window -fa genome.fa |
| 112 | +jsrc genome window -fa genome.fa --window 50000 --step 10000 --json |
| 113 | +``` |
| 114 | + |
| 115 | +## codon |
| 116 | + |
| 117 | +Codon usage frequency and RSCU (Relative Synonymous Codon Usage) analysis. Input CDS sequences in FASTA format to count codon occurrences and calculate RSCU. |
| 118 | + |
| 119 | +RSCU = observed frequency / expected frequency (assuming uniform synonymous codon usage). RSCU > 1 indicates higher-than-average usage, < 1 indicates lower. |
| 120 | + |
| 121 | +Optional features: |
| 122 | +- `--cai`: Calculate CAI (Codon Adaptation Index), requires reference gene set (typically highly expressed genes) |
| 123 | +- `--enc`: Calculate ENC (Effective Number of Codons), range 20-61, lower values indicate stronger codon bias |
| 124 | + |
| 125 | +```bash |
| 126 | +jsrc genome codon -fa cds.fa --top 20 |
| 127 | +jsrc genome codon -fa cds.fa --cai highly_expressed.fa --enc --json |
| 128 | +``` |
| 129 | + |
| 130 | +## distance |
| 131 | + |
| 132 | +Calculate pairwise genetic distances in multiple sequence alignments. Supports four distance models: |
| 133 | + |
| 134 | +- **hamming**: Hamming distance, number of differing sites |
| 135 | +- **p**: p-distance, proportion of differing sites |
| 136 | +- **jc**: Jukes-Cantor distance, corrects for multiple substitutions |
| 137 | +- **k2p**: Kimura 2-parameter distance, distinguishes transitions and transversions |
| 138 | + |
| 139 | +Input must be aligned sequences (equal length). |
| 140 | + |
| 141 | +```bash |
| 142 | +jsrc genome distance -fa aligned.fa --method p |
| 143 | +jsrc genome distance -fa aligned.fa --method k2p --json |
| 144 | +``` |
| 145 | + |
| 146 | +## kaks |
| 147 | + |
| 148 | +Calculate Ka/Ks ratio for two aligned CDS sequences. Ka is the nonsynonymous substitution rate, Ks is the synonymous substitution rate, and Ka/Ks (ω) reflects selection pressure: |
| 149 | + |
| 150 | +- ω < 1: purifying selection (negative selection) |
| 151 | +- ω = 1: neutral evolution |
| 152 | +- ω > 1: positive selection |
| 153 | + |
| 154 | +Input must be exactly two aligned CDS sequences with length divisible by 3. |
| 155 | + |
| 156 | +```bash |
| 157 | +jsrc genome kaks -fa aligned_cds.fa |
| 158 | +jsrc genome kaks -fa aligned_cds.fa --json |
| 159 | +``` |
| 160 | + |
| 161 | +## density |
| 162 | + |
| 163 | +Calculate gene or feature density distribution along the genome. This command reads genome FASTA and GFF annotation, counting features in sliding windows and calculating density (features per kb) and coverage. |
| 164 | + |
| 165 | +Use `--feature-type` to specify which feature type to count (e.g., gene, CDS, exon). Useful for visualizing uneven gene distribution. |
| 166 | + |
| 167 | +```bash |
| 168 | +jsrc genome density -fa genome.fa -gff genes.gff |
| 169 | +jsrc genome density -fa genome.fa -gff genes.gff --feature-type CDS --window 20000 --step 10000 --json |
| 170 | +``` |
| 171 | + |
| 172 | +## motif-scan |
| 173 | + |
| 174 | +Scan genomes for DNA motifs. Supports IUPAC degenerate base codes (R=A/G, Y=C/T, N=any, etc.) and allows mismatches. |
| 175 | + |
| 176 | +Commonly used for transcription factor binding site prediction, restriction enzyme site finding, etc. |
| 177 | + |
| 178 | +```bash |
| 179 | +jsrc genome motif-scan -fa genome.fa -m TATAAA |
| 180 | +jsrc genome motif-scan -fa genome.fa -m GCRWTG --mismatch 1 --top 50 --json |
| 181 | +``` |
| 182 | + |
| 183 | +## ani |
| 184 | + |
| 185 | +k-mer-based Average Nucleotide Identity (ANI) calculation. ANI is a standard metric for measuring genome similarity, commonly used for species delineation (ANI > 95% typically indicates same species). |
| 186 | + |
| 187 | +This command uses Jaccard similarity (shared k-mers / total k-mers) as an ANI approximation, requiring no sequence alignment and running fast. |
| 188 | + |
| 189 | +```bash |
| 190 | +jsrc genome ani -fa genome1.fa genome2.fa |
| 191 | +jsrc genome ani -fa genome1.fa genome2.fa -k 21 --json |
| 192 | +``` |
| 193 | + |
| 194 | +## compare |
| 195 | + |
| 196 | +Genome comparison and difference statistics based on global alignment. Uses the edlib library for efficient global alignment, calculating edit distance, identity, and difference sites. |
| 197 | + |
| 198 | +**Note**: This command requires edlib: `pip install edlib` |
| 199 | + |
| 200 | +```bash |
| 201 | +jsrc genome compare -fa genome1.fa genome2.fa |
| 202 | +jsrc genome compare -fa genome1.fa genome2.fa --json |
| 203 | +``` |
0 commit comments