@@ -444,12 +444,17 @@ fn inspect_from_bcf(
444444 duration_ms : u128 ,
445445) -> FileInspection {
446446 let ( has_index, index_path) = detect_index ( path, DetectedKind :: Bcf , options) ;
447+ let path_lower = path. to_string_lossy ( ) . to_ascii_lowercase ( ) ;
448+ let source_context = selected_entry
449+ . as_ref ( )
450+ . map ( |entry| format ! ( "{path_lower}\n {}" , entry. to_ascii_lowercase( ) ) )
451+ . unwrap_or ( path_lower) ;
447452 FileInspection {
448453 path : path. to_path_buf ( ) ,
449454 container,
450455 detected_kind : DetectedKind :: Bcf ,
451456 confidence : DetectionConfidence :: Authoritative ,
452- source : None ,
457+ source : detect_source ( & source_context , & [ ] , DetectedKind :: Bcf ) ,
453458 assembly : Some ( Assembly :: Grch38 ) ,
454459 phased : None ,
455460 selected_entry,
@@ -657,6 +662,38 @@ mod tests {
657662 Some ( "nested/sample.vcf.gz" )
658663 ) ;
659664
665+ let cursor = Cursor :: new ( Vec :: new ( ) ) ;
666+ let mut bcf_zip_writer = zip:: ZipWriter :: new ( cursor) ;
667+ bcf_zip_writer
668+ . start_file (
669+ "23andMe_R6/chr1.bcf" ,
670+ zip:: write:: SimpleFileOptions :: default ( ) ,
671+ )
672+ . unwrap ( ) ;
673+ bcf_zip_writer. write_all ( b"bcf placeholder" ) . unwrap ( ) ;
674+ let bcf_zip_bytes = bcf_zip_writer. finish ( ) . unwrap ( ) . into_inner ( ) ;
675+ let bcf_zip_inspection = inspect_bytes (
676+ "sample_23andMe_R6.zip" ,
677+ & bcf_zip_bytes,
678+ & InspectOptions :: default ( ) ,
679+ )
680+ . unwrap ( ) ;
681+ assert_eq ! ( bcf_zip_inspection. detected_kind, DetectedKind :: Bcf ) ;
682+ assert_eq ! (
683+ bcf_zip_inspection
684+ . source
685+ . as_ref( )
686+ . and_then( |source| source. vendor. as_deref( ) ) ,
687+ Some ( "23andMe" )
688+ ) ;
689+ assert_eq ! (
690+ bcf_zip_inspection
691+ . source
692+ . as_ref( )
693+ . and_then( |source| source. platform_version. as_deref( ) ) ,
694+ Some ( "r6" )
695+ ) ;
696+
660697 let missing = read_zip_sample_lines_from_bytes ( & zip_bytes, "missing.vcf" ) . unwrap_err ( ) ;
661698 assert ! ( missing. to_string( ) . contains( "failed to open zip entry" ) ) ;
662699
0 commit comments