|
|
@@ -365,8 +365,8 @@ mod tests {
|
|
|
|
|
|
#[test]
|
|
|
fn gene_translocations() -> anyhow::Result<()> {
|
|
|
- let gene_name = "NOTCH1";
|
|
|
- let translocs = read_translocs("/data/tmp_trl.tsv")?;
|
|
|
+ let gene_name = "TLX1";
|
|
|
+ let translocs = read_translocs("/data/tlx1_translocations.tsv")?;
|
|
|
|
|
|
// Select translocations having one partner with gene_name
|
|
|
let translocs: Vec<TranslocData> = translocs
|
|
|
@@ -841,9 +841,9 @@ mod tests {
|
|
|
|
|
|
#[test]
|
|
|
fn lol() -> anyhow::Result<()> {
|
|
|
- let id = "NM_017617.5"; // NOTCH1
|
|
|
+ // let id = "NM_017617.5"; // NOTCH1
|
|
|
// let id = "NM_000314.8"; // PTEN
|
|
|
- // let id = "NM_001015877.2"; // PHF6
|
|
|
+ let id = "NM_001015877.2"; // PHF6
|
|
|
// let id = "NM_001005361.3"; // DNM2
|
|
|
// let id = "NM_002185.5"; // IL7R
|
|
|
let pten_cfg = loliplot::SvgConfig {
|
|
|
@@ -933,4 +933,83 @@ mod tests {
|
|
|
|
|
|
Ok(())
|
|
|
}
|
|
|
+
|
|
|
+ #[test]
|
|
|
+ fn hoxa_translocations() -> anyhow::Result<()> {
|
|
|
+ let translocs = read_translocs("/data/hoxa_translocations.tsv")?;
|
|
|
+
|
|
|
+ // Chromosomes to render
|
|
|
+ let mut chroms: Vec<String> = Vec::new();
|
|
|
+ for chr_id in 0..24 {
|
|
|
+ let chr_name = if chr_id <= 21 {
|
|
|
+ format!("chr{}", chr_id + 1)
|
|
|
+ } else if chr_id == 22 {
|
|
|
+ "chrX".to_string()
|
|
|
+ } else {
|
|
|
+ "chrY".to_string()
|
|
|
+ };
|
|
|
+
|
|
|
+ let present = translocs
|
|
|
+ .iter()
|
|
|
+ .any(|t| t.left_chr == chr_name || t.right_chr == chr_name);
|
|
|
+ if present && !chroms.contains(&chr_name) {
|
|
|
+ chroms.push(chr_name);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ let cfg = circ::CircosConfig {
|
|
|
+ r: 300.0,
|
|
|
+ ..Default::default()
|
|
|
+ };
|
|
|
+
|
|
|
+ let mut circos = circ::Circos::new_with_chrom(&chroms, cfg)?;
|
|
|
+
|
|
|
+ // LABELS
|
|
|
+ let mut hm: HashMap<String, (usize, u32, usize)> = HashMap::new();
|
|
|
+
|
|
|
+ translocs.iter().for_each(|t| {
|
|
|
+ let left_chrom_id = *circos.chroms_ids.get(&t.left_chr).unwrap();
|
|
|
+ hm.entry(t.left_gene.to_string())
|
|
|
+ .and_modify(|e| e.2 += 1)
|
|
|
+ .or_insert((left_chrom_id, t.left_pos, 1));
|
|
|
+
|
|
|
+ let right_chrom_id = *circos.chroms_ids.get(&t.right_chr).unwrap();
|
|
|
+ hm.entry(t.right_gene.to_string())
|
|
|
+ .and_modify(|e| e.2 += 1)
|
|
|
+ .or_insert((right_chrom_id, t.right_pos, 1));
|
|
|
+ });
|
|
|
+ circos.add_labels(
|
|
|
+ &hm.iter()
|
|
|
+ .map(|(gene, (id, pos, n))| (format!("{gene} (n={n})"), *id, *pos))
|
|
|
+ .collect::<Vec<(String, usize, u32)>>(),
|
|
|
+ );
|
|
|
+
|
|
|
+ // ARCS
|
|
|
+ translocs.iter().for_each(|t| {
|
|
|
+ let left_chrom_id = *circos.chroms_ids.get(&t.left_chr).unwrap();
|
|
|
+ let right_chrom_id = *circos.chroms_ids.get(&t.right_chr).unwrap();
|
|
|
+ circos.tracks[circos.ref_track.unwrap()].add_cord(
|
|
|
+ circ::Attach::Data {
|
|
|
+ set_idx: left_chrom_id,
|
|
|
+ start: t.left_pos,
|
|
|
+ end: None,
|
|
|
+ },
|
|
|
+ circ::Attach::Data {
|
|
|
+ set_idx: right_chrom_id,
|
|
|
+ start: t.right_pos,
|
|
|
+ end: None,
|
|
|
+ },
|
|
|
+ circos.config.r - (circos.config.r * 0.1),
|
|
|
+ 0.3,
|
|
|
+ "red".to_string(),
|
|
|
+ 2,
|
|
|
+ );
|
|
|
+ });
|
|
|
+
|
|
|
+ circos.save_to_file(
|
|
|
+ &format!("/data/genes_results/HOXA_translocations.svg"),
|
|
|
+ 100.0,
|
|
|
+ )?;
|
|
|
+ Ok(())
|
|
|
+ }
|
|
|
}
|