> For the complete documentation index, see [llms.txt](https://clinical-genomics.gitbook.io/project-mip/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://clinical-genomics.gitbook.io/project-mip/develop/documentation/api/sample_info.md).

# Sample info

**Version: 1.0.0**

The metadata on the case and samples are recorded in a yaml outfile format with the following data structure and keys:

```
analysis_date: string
case: string
mip_version: string
  path: string,
},
[VCF_FILE_KEY]: {  #Hash of hashes
  clinical: {  
    path: string,
  },
  research: {  
    path: string,
  },
},
recipe: { #Hash of hashes
    outdirectory: string,
    outfile: string,
    path: string,
    version: string,
    metafile_tag: {  
      directory: string,
      file: string,
      path: string,
      processed_by: string,
      version: string,
    },
  },
},
sample: { #Hash of hashes
    analysis_type: string
    [METAFILE_TAG]: {  
      path: string,
    },
    recipe: {
      [RECIPE_NAME]: {
        outdirectory: string,
        outfile: string,
        path: string,
        version: string,
        metafile_tag: {
          directory: string,
          file: string,
          path: string,
          processed_by: string,
          version: string,
        },
        [INFILE]: {
          outdirectory: string,
          outfile: string,
          path: string,
          version: string,
          metafile_tag: {  
            directory: string,
            file: string,
            path: string,
            processed_by: string,
            version: string,
          },
        },
      },
    },
  },
},
```

## Methods

get\_family\_member\_id: Return hash with family member ids

```perl
my %family_member_id = get_family_member_id(
    {
        sample_info_href => $sample_info_href,
    }
);
$family_member_id{children} = [<child1_id>, <child2_id>];
$family_member_id{father} = <father_id>;
$family_member_id{mother} = <mother_id>;
```

get\_pedigree\_sample\_id\_attributes: Return the value of for a supplied sample id with a given attribute (e.g. 'sex')

```perl
my $sample_id_sex = get_pedigree_sample_id_attributes({ attribute => q{sex},
                            sample_id => $sample_id,
                            sample_info_href => $sample_info_href,
                              });
```

get\_read\_group: Return hash with read group headers.

```perl
my %read_group = get_read_group(
            {
                infile_prefix    => $infile_prefix,
                platform         => $active_parameter_href->{platform},
                sample_id        => $sample_id,
                sample_info_href => $sample_info_href,
            }
        );
$rg{id} = <$infile_prefix>;
$rg{pu} = <flowcell>.<lane>.<sample_barcode>;
$rg{sm} = <$sample_id>;
$rg{pl} = <$platform>;
$rg{lb} = <$sample_id>; # Dummy value since the actual LB isn't available in MIP (yet)
```

get\_sample\_info\_case\_recipe\_attributes: Return case recipe attribute or attributes hash

```perl
# Scalar
my $path = get_sample_info_case_recipe_attributes(
    {
        attribute        => q{path},
        recipe_name      => $recipe_name,
        sample_info_href => \%sample_info,
    }
);
$path = <string>;

# Hash
my %attribute = get_sample_info_case_recipe_attributes(
    {
        recipe_name      => $recipe_name,
        sample_info_href => \%sample_info,
    }
);
$attribute{path} = <string>;
```

get\_sample\_info\_sample\_recipe\_attributes: Return sample recipe attribute or attributes hash for infile key

```perl
# Scalar
my $path = get_sample_info_sample_recipe_attributes(
    {
        attribute        => q{path},
        infile => $infile,
        recipe_name      => $recipe_name,
        sample_id => $sample_id,
        sample_info_href => \%sample_info,
    }
);
$path = <string>;

# Hash
my %attribute = get_sample_info_sample_recipe_attributes(
    {
        infile => $infile,
        recipe_name      => $recipe_name,
        sample_id => $sample_id,
        sample_info_href => \%sample_info,
    }
);
$attribute{path} = <string>;
```

set\_file\_path\_to\_store: Set file path under store according to file type and file\_tag

```perl
set_file_path_to_store(
    {
        file_tag         => $file_tag,
        file_type        => $file_type,
        path             => $path,
        sample_info_href => \%sample_info,
    }
);
%sample_info = ( store => { $file_type => { $file_tag => $path, }, } );
```
