<jupyter_start><jupyter_text>NB06d Absolute Quantification[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/CSBiology/BIO-BTE-06-L-7/gh-pages?filepath=NB06d_Absolute_Quantification_BN.ipynb)[Download Notebook](https://github.com/CSBiology/BIO-BTE-06-L-7/releases/download/NB06b_NB06b_NB06c_NB06c_NB06d_NB06d/NB06d_Absolute_Quantification_BN.ipynb)Finally, after careful peptide ion selection, quality control and assuring that our label efficiency allows accurate for quantifications, we can start tocalculate protein abundancies. Since we start again by getting access to our data and its description, this notebook will start off familiar! I. Reading the dataAs promised, we start this notebook with the output of the previous analysis, this notebook assumes that the data from *NB06b Data Access and Quality Control* is stored in a .txt<jupyter_code>type PeptideIon = 
    {|
        ProteinGroup    : string  
        Synonyms        : string
        StringSequence  : string
        PepSequenceID   : int
        Charge          : int
    |}

//This is the filepath you chose in *NB06b Data Access and Quality Control*
// let filePath = @"C:\yourPath\testOut.txt"
let filePath = System.IO.Path.Combine [|__SOURCE_DIRECTORY__ + "/downloads/qualityControlResult_BN.txt"|]

let qConcatDataFiltered =
    Frame.ReadCsv(path = filePath, separators = "\t")
    // StringSequence is the peptide sequence
    |> Frame.indexRowsUsing (fun os -> 
        {|
            ProteinGroup    = os.GetAs<string>("ProteinGroup"); 
            Synonyms        = os.GetAs<string>("Synonyms")
            StringSequence  = os.GetAs<string>("StringSequence");
            PepSequenceID   = os.GetAs<int>("PepSequenceID");
            Charge          = os.GetAs<int>("Charge");
        |}
    )
    |> Frame.filterRows (fun k s -> String.contains "QProt_newPS" k.ProteinGroup)<jupyter_output><empty_output><jupyter_text>II. Extracting ratios and calculating comparisons.Next, we want to look at the stoichiometry between rbcL and rbcS. First, we extract the ratios from our curated results file and plot them.<jupyter_code>let sliceQuantColumns quantColID frame = 
    frame
    |> Frame.filterCols (fun ck os -> ck |> String.contains ("." + quantColID))
    |> Frame.mapColKeys (fun ck -> ck.Split('.') |> Array.item 0)


let ratios = sliceQuantColumns "Ratio" qConcatDataFiltered

ratios
|> Frame.getRow {|Charge = 2; PepSequenceID = 1457965; ProteinGroup = "QProt_newPS;Cre02.g120150.t1.2;Cre02.g120100.t1.2"; StringSequence = "AFPDAYVR"; Synonyms = "RBCS2;RBCS1"|}

let ratiosRbcL =
    ratios
    |> Frame.filterRows (fun r s -> r.Synonyms |> String.contains "rbcL")

let ratiosRbcS =
    ratios
    |> Frame.filterRows (fun r s -> r.Synonyms |> String.contains "RBCS")

let medianRbcL =
    ratiosRbcL
    |> Frame.getNumericCols
    |> Series.mapValues Stats.median
    |> Series.observations

let medianRbcS =
    ratiosRbcS
    |> Frame.getNumericCols
    |> Series.mapValues Stats.median
    |> Series.observations
[
    Chart.Column (medianRbcL)
    |> Chart.withTraceName "rbcL"
    Chart.Column (medianRbcS)
    |> Chart.withTraceName "rbcS"
]
|> Chart.Combine<jupyter_output><empty_output><jupyter_text>Since we are interested in the ratio between rbcL and rbcS, we just divide the rbcL ratio through the ratio of rbcS and compare the result with values from the literature.<jupyter_code>(medianRbcL, medianRbcS)
||> Seq.map2 (fun (s1,v1) (s2,v2) -> s1, v1 / v2)
|> Chart.Column<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1056657223796034, 'fraction_numerical': 0.019263456090651557, 'mean_word_length': 3.733243967828418, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 47, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '98276', 'license': 'MIT', 'n_tokens_mistral': 1257, 'n_tokens_neox': 1150, 'n_words': 288, 'path': 'Notebooks/NB06d_Absolute_Quantification_BN.ipynb', 'repo_name': 'inferential/BIO-BTE-06-L-7', 'size': '3530'}