Skip to content

Commit

Permalink
feat: write out fileDate on ingest (#210) (#215)
Browse files Browse the repository at this point in the history
  • Loading branch information
holtgrewe authored Oct 10, 2023
1 parent d6db0b7 commit 7731958
Show file tree
Hide file tree
Showing 18 changed files with 497 additions and 468 deletions.
7 changes: 7 additions & 0 deletions src/seqvars/ingest/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ pub fn build_output_header(
input_header: &vcf::Header,
pedigree: &Option<mehari::ped::PedigreeByName>,
genomebuild: GenomeRelease,
file_date: &str,
case_uuid: &uuid::Uuid,
worker_version: &str,
) -> Result<vcf::Header, anyhow::Error> {
Expand All @@ -193,6 +194,10 @@ pub fn build_output_header(
use vcf::record::genotypes::keys::key;

let builder = vcf::Header::builder()
.insert(
"fileDate".parse()?,
vcf::header::record::Value::from(file_date),
)?
.add_filter("PASS", Map::<Filter>::new("All filters passed"))
.add_info(
"gnomad_exomes_an".parse()?,
Expand Down Expand Up @@ -466,6 +471,7 @@ mod test {
&input_vcf_header,
&Some(pedigree),
crate::common::GenomeRelease::Grch37,
"20230421",
&uuid::Uuid::parse_str("00000000-0000-0000-0000-000000000000").unwrap(),
"x.y.z",
)?;
Expand Down Expand Up @@ -500,6 +506,7 @@ mod test {
&input_vcf_header,
&Some(pedigree),
crate::common::GenomeRelease::Grch38,
"20230421",
&uuid::Uuid::parse_str("00000000-0000-0000-0000-000000000000").unwrap(),
"x.y.z",
)?;
Expand Down
13 changes: 10 additions & 3 deletions src/seqvars/ingest/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,19 @@ pub mod header;
#[derive(Debug, clap::Parser)]
#[command(author, version, about = "ingest sequence variant VCF", long_about = None)]
pub struct Args {
/// The path to the mehari database.
#[clap(long)]
pub path_mehari_db: String,
/// Value to write to `##fileDate`.
#[arg(long)]
pub file_date: String,
/// The case UUID to write out.
#[clap(long)]
pub case_uuid: uuid::Uuid,
/// The assumed genome build.
#[clap(long)]
pub genomebuild: GenomeRelease,

/// The path to the mehari database.
#[clap(long)]
pub path_mehari_db: String,
/// Path to the pedigree file.
#[clap(long)]
pub path_ped: String,
Expand Down Expand Up @@ -445,6 +449,7 @@ pub fn run(args_common: &crate::common::Args, args: &Args) -> Result<(), anyhow:
&input_header,
&Some(pedigree),
args.genomebuild,
&args.file_date,
&args.case_uuid,
worker_version(),
)
Expand Down Expand Up @@ -494,6 +499,7 @@ mod test {

let args_common = Default::default();
let args = super::Args {
file_date: String::from("20230421"),
case_uuid: uuid::Uuid::parse_str("00000000-0000-0000-0000-000000000000").unwrap(),
max_var_count: None,
path_mehari_db: "tests/seqvars/ingest/db".into(),
Expand Down Expand Up @@ -526,6 +532,7 @@ mod test {
.into();
let args_common = Default::default();
let args = super::Args {
file_date: String::from("20230421"),
case_uuid: uuid::Uuid::parse_str("00000000-0000-0000-0000-000000000000").unwrap(),
max_var_count: None,
path_mehari_db: "tests/seqvars/ingest/db".into(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ expression: "std::fs::read_to_string(out_path_str)?"
##contig=<ID=X,length=155270560,assembly="GRCh37",species="Homo sapiens">
##contig=<ID=Y,length=59373566,assembly="GRCh37",species="Homo sapiens">
##contig=<ID=MT,length=16569,assembly="GRCh37",species="Homo sapiens">
##fileDate=20230421
##SAMPLE=<ID=NA12878,Sex="Male",Disease="Affected">
##PEDIGREE=<ID=NA12878>
##x-varfish-case-uuid=00000000-0000-0000-0000-000000000000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ expression: "std::fs::read_to_string(out_path_str)?"
##contig=<ID=X,length=155270560,assembly="GRCh37",species="Homo sapiens">
##contig=<ID=Y,length=59373566,assembly="GRCh37",species="Homo sapiens">
##contig=<ID=MT,length=16569,assembly="GRCh37",species="Homo sapiens">
##fileDate=20230421
##SAMPLE=<ID=CASE,Sex="Male",Disease="Affected">
##PEDIGREE=<ID=CASE>
##x-varfish-case-uuid=00000000-0000-0000-0000-000000000000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ expression: "std::fs::read_to_string(out_path_str)?"
##contig=<ID=X,length=155270560,assembly="GRCh37",species="Homo sapiens">
##contig=<ID=Y,length=59373566,assembly="GRCh37",species="Homo sapiens">
##contig=<ID=MT,length=16569,assembly="GRCh37",species="Homo sapiens">
##fileDate=20230421
##SAMPLE=<ID=Case_1_father-N1-DNA1-WGS1,Sex="Male",Disease="Unaffected">
##SAMPLE=<ID=Case_1_index-N1-DNA1-WGS1,Sex="Female",Disease="Affected">
##SAMPLE=<ID=Case_1_mother-N1-DNA1-WGS1,Sex="Male",Disease="Unaffected">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ expression: "std::fs::read_to_string(out_path_str)?"
##contig=<ID=X,length=155270560,assembly="GRCh37",species="Homo sapiens">
##contig=<ID=Y,length=59373566,assembly="GRCh37",species="Homo sapiens">
##contig=<ID=MT,length=16569,assembly="GRCh37",species="Homo sapiens">
##fileDate=20230421
##SAMPLE=<ID=CASE,Sex="Male",Disease="Affected">
##PEDIGREE=<ID=CASE>
##x-varfish-case-uuid=00000000-0000-0000-0000-000000000000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ expression: "std::fs::read_to_string(out_path_str)?"
##contig=<ID=chrX,length=156040895,assembly="GRCh38",species="Homo sapiens">
##contig=<ID=chrY,length=57227415,assembly="GRCh38",species="Homo sapiens">
##contig=<ID=chrM,length=16569,assembly="GRCh38",species="Homo sapiens">
##fileDate=20230421
##SAMPLE=<ID=NA12878,Sex="Male",Disease="Affected">
##PEDIGREE=<ID=NA12878>
##x-varfish-case-uuid=00000000-0000-0000-0000-000000000000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ expression: "std::fs::read_to_string(out_path_str)?"
##contig=<ID=chrX,length=156040895,assembly="GRCh38",species="Homo sapiens">
##contig=<ID=chrY,length=57227415,assembly="GRCh38",species="Homo sapiens">
##contig=<ID=chrM,length=16569,assembly="GRCh38",species="Homo sapiens">
##fileDate=20230421
##SAMPLE=<ID=CASE,Sex="Male",Disease="Affected">
##PEDIGREE=<ID=CASE>
##x-varfish-case-uuid=00000000-0000-0000-0000-000000000000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ expression: "std::fs::read_to_string(out_path_str)?"
##contig=<ID=chrX,length=156040895,assembly="GRCh38",species="Homo sapiens">
##contig=<ID=chrY,length=57227415,assembly="GRCh38",species="Homo sapiens">
##contig=<ID=chrM,length=16569,assembly="GRCh38",species="Homo sapiens">
##fileDate=20230421
##SAMPLE=<ID=Case_1_father-N1-DNA1-WGS1,Sex="Male",Disease="Unaffected">
##SAMPLE=<ID=Case_1_index-N1-DNA1-WGS1,Sex="Female",Disease="Affected">
##SAMPLE=<ID=Case_1_mother-N1-DNA1-WGS1,Sex="Male",Disease="Unaffected">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ expression: "std::fs::read_to_string(out_path_str)?"
##contig=<ID=chrX,length=156040895,assembly="GRCh38",species="Homo sapiens">
##contig=<ID=chrY,length=57227415,assembly="GRCh38",species="Homo sapiens">
##contig=<ID=chrM,length=16569,assembly="GRCh38",species="Homo sapiens">
##fileDate=20230421
##SAMPLE=<ID=CASE,Sex="Male",Disease="Affected">
##PEDIGREE=<ID=CASE>
##x-varfish-case-uuid=00000000-0000-0000-0000-000000000000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ expression: "std::fs::read_to_string(&args.path_out)?"
##contig=<ID=X,length=155270560,assembly="GRCh37",species="Homo sapiens">
##contig=<ID=Y,length=59373566,assembly="GRCh37",species="Homo sapiens">
##contig=<ID=MT,length=16569,assembly="GRCh37",species="Homo sapiens">
##fileDate=20230421
##SAMPLE=<ID=Case_1_father-N1-DNA1-WGS1,Sex="Male",Disease="Unaffected">
##SAMPLE=<ID=Case_1_index-N1-DNA1-WGS1,Sex="Female",Disease="Affected">
##SAMPLE=<ID=Case_1_mother-N1-DNA1-WGS1,Sex="Female",Disease="Unaffected">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ expression: "std::fs::read_to_string(&args.path_out)?"
##contig=<ID=X,length=155270560,assembly="GRCh37",species="Homo sapiens">
##contig=<ID=Y,length=59373566,assembly="GRCh37",species="Homo sapiens">
##contig=<ID=MT,length=16569,assembly="GRCh37",species="Homo sapiens">
##fileDate=20230421
##SAMPLE=<ID=NA12878,Sex="Female",Disease="Affected">
##PEDIGREE=<ID=NA12878>
##x-varfish-case-uuid=00000000-0000-0000-0000-000000000000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ expression: "std::fs::read_to_string(&args.path_out)?"
##contig=<ID=X,length=155270560,assembly="GRCh37",species="Homo sapiens">
##contig=<ID=Y,length=59373566,assembly="GRCh37",species="Homo sapiens">
##contig=<ID=MT,length=16569,assembly="GRCh37",species="Homo sapiens">
##fileDate=20230421
##SAMPLE=<ID=NA12878,Sex="Male",Disease="Affected">
##PEDIGREE=<ID=NA12878>
##x-varfish-case-uuid=00000000-0000-0000-0000-000000000000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ expression: "std::fs::read_to_string(&args.path_out)?"
##contig=<ID=X,length=155270560,assembly="GRCh37",species="Homo sapiens">
##contig=<ID=Y,length=59373566,assembly="GRCh37",species="Homo sapiens">
##contig=<ID=MT,length=16569,assembly="GRCh37",species="Homo sapiens">
##fileDate=20230421
##SAMPLE=<ID=CASE,Sex="Male",Disease="Affected">
##PEDIGREE=<ID=CASE>
##x-varfish-case-uuid=00000000-0000-0000-0000-000000000000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ expression: "std::fs::read_to_string(&args.path_out)?"
##contig=<ID=X,length=155270560,assembly="GRCh37",species="Homo sapiens">
##contig=<ID=Y,length=59373566,assembly="GRCh37",species="Homo sapiens">
##contig=<ID=MT,length=16569,assembly="GRCh37",species="Homo sapiens">
##fileDate=20230421
##SAMPLE=<ID=Case_1_father-N1-DNA1-WGS1,Sex="Male",Disease="Unaffected">
##SAMPLE=<ID=Case_1_index-N1-DNA1-WGS1,Sex="Female",Disease="Affected">
##SAMPLE=<ID=Case_1_mother-N1-DNA1-WGS1,Sex="Male",Disease="Unaffected">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ expression: "std::fs::read_to_string(&args.path_out)?"
##contig=<ID=X,length=155270560,assembly="GRCh37",species="Homo sapiens">
##contig=<ID=Y,length=59373566,assembly="GRCh37",species="Homo sapiens">
##contig=<ID=MT,length=16569,assembly="GRCh37",species="Homo sapiens">
##fileDate=20230421
##SAMPLE=<ID=CASE,Sex="Male",Disease="Affected">
##PEDIGREE=<ID=CASE>
##x-varfish-case-uuid=00000000-0000-0000-0000-000000000000
Expand Down
Loading

0 comments on commit 7731958

Please sign in to comment.