Skip to content

Commit

Permalink
vcf: moving RB and FRB to FORMAT instead of INFO
Browse files Browse the repository at this point in the history
  • Loading branch information
wdecoster committed Mar 2, 2024
1 parent 6e91688 commit 5028b9f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "STRdust"
version = "0.6.0"
version = "0.7.0"
edition = "2021"


Expand Down
18 changes: 9 additions & 9 deletions src/vcf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,12 @@ impl fmt::Display for VCFRecord {
match &self.alt_seq {
Some(alts) => {
let (FORMAT, ps) = match self.ps {
Some(ps) => ("GT:SUP:SC:PS", format!(":{}", ps)),
None => ("GT:SUP:SC", "".to_string()),
Some(ps) => ("GT:RB:FRB:SUP:SC:PS", format!(":{}", ps)),
None => ("GT:RB:FRB:SUP:SC", "".to_string()),
};
write!(
f,
"{chrom}\t{start}\t.\t{ref}\t{alt}\t.\t.\t{flags}END={end};RB={l1},{l2};FRB={fl1},{fl2};STDEV={sd1},{sd2}{somatic}{outliers}\t{FORMAT}\t{genotype1}|{genotype2}:{sup1},{sup2}:{score1},{score2}{ps}",
"{chrom}\t{start}\t.\t{ref}\t{alt}\t.\t.\t{flags}END={end};STDEV={sd1},{sd2}{somatic}{outliers}\t{FORMAT}\t{genotype1}|{genotype2}:{l1},{l2}:{fl1},{fl2}:{sup1},{sup2}:{score1},{score2}{ps}",
chrom = self.chrom,
start = self.start,
flags = self.flags,
Expand Down Expand Up @@ -289,12 +289,6 @@ pub fn write_vcf_header(fasta: &str, bam: &str, sample: &Option<String>) {
println!(
r#"##INFO=<ID=END,Number=1,Type=Integer,Description="End position of the repeat interval">"#
);
println!(
r#"##INFO=<ID=RB,Number=2,Type=Integer,Description="Repeat length of the two alleles in bases relative to reference">"#
);
println!(
r#"##INFO=<ID=FRB,Number=2,Type=Integer,Description="Full repeat length of the two alleles in bases">"#
);
println!(
r#"##INFO=<ID=STDEV,Number=2,Type=Integer,Description="Standard deviation of the repeat length">"#
);
Expand All @@ -308,6 +302,12 @@ pub fn write_vcf_header(fasta: &str, bam: &str, sample: &Option<String>) {
r#"##INFO=<ID=CLUSTERFAILURE,Number=0,Type=Flag,Description="If unphased input failed to cluster in two haplotype">"#
);
println!(r#"##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">"#);
println!(
r#"##FORMAT=<ID=RB,Number=2,Type=Integer,Description="Repeat length of the two alleles in bases relative to reference">"#
);
println!(
r#"##FORMAT=<ID=FRB,Number=2,Type=Integer,Description="Full repeat length of the two alleles in bases">"#
);
println!(r#"##FORMAT=<ID=PS,Number=1,Type=Integer,Description="Phase set identifier">"#);
println!(r#"##FORMAT=<ID=SUP,Number=2,Type=Integer,Description="Read support per allele">"#);
println!(r#"##FORMAT=<ID=SC,Number=2,Type=Integer,Description="Consensus score per allele">"#);
Expand Down

0 comments on commit 5028b9f

Please sign in to comment.