Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,35 @@ Sections commonly used: Features, Bug fixes, Other changes.
union: they came from one molecule. Writes `matrix.mtx`,
`features.tsv` and `transcriptEndDistanceDistribution.txt` under
`Solo.out/Transcript3p/raw/`.
- **`--genomeTransformOutput SAM`** reports alignments in the original
genome's coordinates. `--genomeTransformType Haploid` bakes a VCF's
variants into the genome, so reads carrying those alleles align
without mismatches, but every reported coordinate then refers to a
genome nobody else has. This maps each alignment back through the
conversion blocks written at build time: an indel baked into the
sequence reappears as an `I`/`D` CIGAR operation at the original
position, and junction motifs are reclassified against the original
genome rather than the transformed one. The SAM header comes from
the original genome too. `SJ` and `Quant` remain unimplemented and
are refused, as are the flag combinations whose other outputs would
stay in transformed coordinates.

- **`--genomeType SuperTranscriptome`** condenses the genome to the union
of its annotated exons: overlapping exons are merged, the merged
intervals concatenated, and overlapping transcripts grouped into
superTranscripts, one per condensed chromosome (`st0`, `st1`, ...).
The index then covers only exonic sequence, and introns cannot be
crossed because they are not present. Requires `--sjdbGTFfile`.
Writes `superTranscriptSequences.fasta`, `transcriptSequences.fasta`,
`superTranscriptSJcollapsed.tsv` and
`fullGenome/conversionToFullGenome.tsv` alongside the index.

Diverges from STAR on minus-strand exons, deliberately. STAR condenses
the sequence before filling the reverse-complement half of its genome
buffer, so minus-strand superTranscripts read uninitialised memory;
here they hold the actual reverse complement. Recorded in
`docs-old/dev/divergences.md` and locked by a test asserting the
hand-derived sequence.

### Bug fixes

Expand Down
20 changes: 18 additions & 2 deletions src/genome/mod.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
pub mod fasta;
pub mod supertranscript;
pub mod transform;

use std::path::Path;

use crate::error::Error;
use crate::params::Parameters;

use fasta::parse_fasta_files;
use fasta::{Chromosome, parse_fasta_files};

/// STAR's genome spacing character (used for inter-chromosome padding).
const GENOME_SPACING_CHAR: u8 = 5;
Expand Down Expand Up @@ -213,10 +214,25 @@ impl Genome {
None
};

Self::from_chromosomes(&chromosomes, bin_nbits, transform_blocks)
}

/// Lay out a genome from chromosome sequences already in base codes:
/// pad each to a `2^chr_bin_nbits` boundary, then fill the
/// reverse-complement half.
///
/// [`from_fasta`](Self::from_fasta) is this plus FASTA parsing and the
/// VCF transform. `--genomeType SuperTranscriptome` uses it directly,
/// since its chromosomes are built rather than read.
pub fn from_chromosomes(
chromosomes: &[Chromosome],
bin_nbits: u32,
transform_blocks: Option<Vec<[u64; 3]>>,
) -> Result<Self, Error> {
// First pass: chromosome names/lengths, validating non-zero length.
let mut chr_name = Vec::new();
let mut chr_length = Vec::new();
for chrom in &chromosomes {
for chrom in chromosomes {
let len = chrom.sequence.len() as u64;
if len == 0 {
return Err(Error::Fasta(format!(
Expand Down
Loading
Loading