|
|
@@ -79,13 +79,15 @@ impl ContigRef {
|
|
|
let chr = a.target_name.clone().unwrap_or("UNKNOWN".to_string());
|
|
|
let del_start = a.target_end;
|
|
|
let del_end = b.target_start;
|
|
|
- Some(format!("{chr}:{del_start}_{del_end}"))
|
|
|
+ let hgvs = format!("{chr}:{del_start}_{del_end}");
|
|
|
+ Some(hgvs)
|
|
|
} else {
|
|
|
let a_chr = a.target_name.clone().unwrap_or("UNKNOWN".to_string());
|
|
|
let a_bp = a.target_end;
|
|
|
let b_chr = b.target_name.clone().unwrap_or("UNKNOWN".to_string());
|
|
|
let b_bp = b.target_end;
|
|
|
- Some(format!("{a_chr}:{a_bp}delins[{b_chr}:{b_bp}]"))
|
|
|
+ let hgvs = format!("{a_chr}:{a_bp}delins[{b_chr}:{b_bp}]");
|
|
|
+ Some(hgvs)
|
|
|
}
|
|
|
}
|
|
|
ContigRef::ChimericMultiple(_) => None,
|
|
|
@@ -330,7 +332,12 @@ impl Contig {
|
|
|
}
|
|
|
|
|
|
pub fn to_igv(&self, dir_path: &str) -> Result<()> {
|
|
|
- let contig_dir = format!("{dir_path}/{}", self.id);
|
|
|
+ let contig_name = if let Some(hgvs) = self.hgvs() {
|
|
|
+ hgvs
|
|
|
+ } else {
|
|
|
+ self.id.clone()
|
|
|
+ };
|
|
|
+ let contig_dir = format!("{dir_path}/{contig_name}");
|
|
|
fs::create_dir_all(contig_dir.clone())?;
|
|
|
|
|
|
let fasta_path = format!("{contig_dir}/contig.fa");
|
|
|
@@ -352,7 +359,7 @@ impl Contig {
|
|
|
write_fasta(&reads_path, &n_reads);
|
|
|
|
|
|
let bam_path = format!("{contig_dir}/{}.bam", self.id);
|
|
|
- create_bam(&fasta_path, &reads_path, &bam_path)?;
|
|
|
+ write_bam(&fasta_path, &reads_path, &bam_path)?;
|
|
|
|
|
|
let bed_path = format!("{contig_dir}/contig.bed");
|
|
|
match &self.contig_ref {
|
|
|
@@ -528,9 +535,7 @@ pub fn write_fai(path: &str) {
|
|
|
faidx.wait().unwrap();
|
|
|
}
|
|
|
|
|
|
-// pub fn write_aln_sh()
|
|
|
-
|
|
|
-pub fn create_bam(ref_path: &str, reads_path: &str, bam_path: &str) -> Result<()> {
|
|
|
+pub fn write_bam(ref_path: &str, reads_path: &str, bam_path: &str) -> Result<()> {
|
|
|
let rg_id = uuid::Uuid::new_v4();
|
|
|
|
|
|
let mm2 = Command::new("minimap2")
|