> For the complete documentation index, see [llms.txt](https://help.bioinsight.illumina.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.bioinsight.illumina.com/dragen-protein-quantification/after-counting-and-normalization/using-the-adat.md).

# Using the ADAT

ADATs can be analyzed in R or Python using parsers created by SomaLogic.

DRAGEN Protein Quantification v3.0.0 is compatible with SomaData v1.2.4 (Python - formerly called Canopy) and SomaDataIO v6.4.0 (R).

> <mark style="color:orange;">**NOTE**</mark>: The Python package SomaData was formerly called Canopy. The GitHub repository may still use the Canopy name.

* Python: <https://github.com/SomaLogic/Canopy>
* R: <https://github.com/SomaLogic/SomaDataIO>

SomaData creates an ADAT object, which is an extension of a Pandas DataFrame.

* rows correspond to samples
* columns correspond to SOMAmers
* values are normalized counts

Below are examples on parsing an ADAT in Python and R.

### Parsing ADAT in Python

```python
import somadata

# read the adat
my_adat = somadata.read_adat('/path/to/my/file1.adat')

# retrieve sample metadata
sample_meta = my_adat.index.to_frame(index=False)

# retrieve SOMAmer metadata
soma_meta = my_adat.columns.to_frame(index=False)

# retrieve the scale factors for all plates
plate_scale_factors_dict = my_adat.header_metadata['PlatformSpecificPlateScale_ScaleFactor']

### additional optional manipulation 

# concatenate multiple adats into a single adat
my_adat2 = somadata.read_adat('/path/to/my/file2.adat')
my_merged_adat = soma.smart_adat_concatenation([my_adat, my_adat2])

# write it to a file 
my_merged_adat = my_merged_adat.to_adat('/path/to/merged/adat')
```

### Parsing ADAT in R

```r
library(SomaDataIO)

# check all package functions
ls("package:SomaDataIO")

#read the adat
my_adat <- read_adat('/path/to/my/file1.adat')

# retrieve sample metadata
sample_meta <- my_adat[getMeta(my_adat)]

# retrieve SOMAmer metadata
soma_meta <- my_adat[getAnalytes(my_adat)]

# create a function that parses the header
parse_adat_header <- function(adat_file, max_lines = 500) {
  header_lines <- readLines(adat_file, n = max_lines)
  table_row <- grep("TABLE_BEGIN", header_lines)
  header_lines[1:(table_row-1)] %>% 
    strsplit("\t") %>% 
    {
      values <- map(., 2) # Get values from key value pairs
      keys <- map_chr(., 1) # Get keys...
      setNames(values, keys)
    }
}

my_adat_header <- parse_adat_header('/path/to/my/file1.adat')

# retrieve the scale factors for all plates
plate_scale_factors_dict = my_adat_header$PlatformSpecificPlateScale_ScaleFactor

### additional optional manipulation 
my_adat2 = read_adat('/path/to/my/file2.adat')
my_merged_adat = rbind(my_adat, my_adat2)

# write it to a file 
my_merged_adat = write_adat(my_merged_adat, '/path/to/merged/adat')

```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.bioinsight.illumina.com/dragen-protein-quantification/after-counting-and-normalization/using-the-adat.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
