Skip to contents

as.data.frame() is a function that converts the tidyproteomics data object into a tibble. This tibble is in the long-format, such that a there is a single observation per line.

Usage

# S3 method for tidyproteomics
as.data.frame(data, shape = c("long", "wide"), values = NULL, drop = NULL)

Arguments

data

tidyproteomics data object

shape

the orientation of the quantitative data as either a single measure per row (long), or as multiple measures per protein/peptide (wide).

values

indicates the selected normalization to output. The default is that selected at the time of normalization.

Value

a tibble

Examples

library(dplyr, warn.conflicts = FALSE)
library(tidyproteomics)

# convert the data-object to a data.frame
hela_proteins %>% as.data.frame() %>% as_tibble()
#> # A tibble: 42,330 × 20
#>    sample_id sample_file sample  replicate protein    abundance_raw description 
#>    <chr>     <chr>       <chr>   <chr>     <chr>              <dbl> <chr>       
#>  1 9e6ed3ba  F1          control 1         Q15149       1011259992. Plectin OS=…
#>  2 9e6ed3ba  F1          control 1         Q09666        659299359. Neuroblast …
#>  3 9e6ed3ba  F1          control 1         H0YDN1           239911. Plectin OS=…
#>  4 9e6ed3ba  F1          control 1         Q14204        385570969  Cytoplasmic…
#>  5 9e6ed3ba  F1          control 1         P49327       1441909420. Fatty acid …
#>  6 9e6ed3ba  F1          control 1         P78527        622951615. DNA-depende…
#>  7 9e6ed3ba  F1          control 1         P21333        604798069. Filamin-A O…
#>  8 9e6ed3ba  F1          control 1         P35579       1070673931. Myosin-9 OS…
#>  9 9e6ed3ba  F1          control 1         O75369        325748424. Filamin-B O…
#> 10 9e6ed3ba  F1          control 1         A0A0D9SGF6    196230866. Spectrin al…
#> # ℹ 42,320 more rows
#> # ℹ 13 more variables: biological_process <chr>, cellular_component <chr>,
#> #   molecular_function <chr>, gene_id_entrez <chr>, gene_name <chr>,
#> #   wiki_pathway <chr>, reactome_pathway <chr>, gene_id_ensemble <chr>,
#> #   num_peptides <dbl>, num_psms <dbl>, num_unique_peptides <dbl>,
#> #   protein_group <chr>, imputed <dbl>

# select the wide format
hela_proteins %>% as.data.frame(shape = 'wide') %>% as_tibble()
#> # A tibble: 7,055 × 26
#>    protein  description biological_process cellular_component molecular_function
#>    <chr>    <chr>       <chr>              <chr>              <chr>             
#>  1 Q15149   Plectin OS… cell differentiat… cytoplasm;cytoske… motor activity;st…
#>  2 Q09666   Neuroblast… metabolic process  cell surface;cyto… structural molecu…
#>  3 H0YDN1   Plectin OS… cell growth        cytosol;endoplasm… motor activity    
#>  4 Q14204   Cytoplasmi… cell differentiat… cell surface;cyto… motor activity;st…
#>  5 P49327   Fatty acid… cellular homeosta… cytoplasm;cytoske… structural molecu…
#>  6 P78527   DNA-depend… cell differentiat… cytosol;membrane;… RNA binding;signa…
#>  7 P21333   Filamin-A … cell differentiat… cell surface;cyto… antioxidant activ…
#>  8 P35579   Myosin-9 O… cell differentiat… cytoplasm;cytoske… antioxidant activ…
#>  9 O75369   Filamin-B … cell growth;coagu… cytoplasm;cytoske… motor activity;st…
#> 10 A0A0D9S… Spectrin a… cell growth        endoplasmic retic… motor activity;st…
#> # ℹ 7,045 more rows
#> # ℹ 21 more variables: gene_id_entrez <chr>, gene_name <chr>,
#> #   wiki_pathway <chr>, reactome_pathway <chr>, gene_id_ensemble <chr>,
#> #   num_peptides <dbl>, num_psms <dbl>, num_unique_peptides <dbl>,
#> #   protein_group <chr>, abundance_raw_control_1_raw <dbl>,
#> #   abundance_raw_control_2_raw <dbl>, abundance_raw_control_3_raw <dbl>,
#> #   abundance_raw_knockdown_1_raw <dbl>, abundance_raw_knockdown_2_raw <dbl>, …

# select the wide format & drop some columns
hela_proteins %>%
   as.data.frame(shape = 'wide',
                 drop = c('description','wiki_pathway','reactome_pathway','biological_process')) %>%
   as_tibble()
#> # A tibble: 7,055 × 22
#>    protein    cellular_component     molecular_function gene_id_entrez gene_name
#>    <chr>      <chr>                  <chr>              <chr>          <chr>    
#>  1 Q15149     cytoplasm;cytoskeleto… motor activity;st… 5339           PLEC     
#>  2 Q09666     cell surface;cytoplas… structural molecu… 79026          AHNAK    
#>  3 H0YDN1     cytosol;endoplasmic r… motor activity     NA             PLEC     
#>  4 Q14204     cell surface;cytosol;… motor activity;st… 1778           DYNC1H1  
#>  5 P49327     cytoplasm;cytoskeleto… structural molecu… 2194           FASN     
#>  6 P78527     cytosol;membrane;nucl… RNA binding;signa… 5591           PRKDC    
#>  7 P21333     cell surface;cytoplas… antioxidant activ… 2316           FLNA     
#>  8 P35579     cytoplasm;cytoskeleto… antioxidant activ… 4627           MYH9     
#>  9 O75369     cytoplasm;cytoskeleto… motor activity;st… 2317           FLNB     
#> 10 A0A0D9SGF6 endoplasmic reticulum… motor activity;st… NA             SPTAN1   
#> # ℹ 7,045 more rows
#> # ℹ 17 more variables: gene_id_ensemble <chr>, num_peptides <dbl>,
#> #   num_psms <dbl>, num_unique_peptides <dbl>, protein_group <chr>,
#> #   abundance_raw_control_1_raw <dbl>, abundance_raw_control_2_raw <dbl>,
#> #   abundance_raw_control_3_raw <dbl>, abundance_raw_knockdown_1_raw <dbl>,
#> #   abundance_raw_knockdown_2_raw <dbl>, abundance_raw_knockdown_3_raw <dbl>,
#> #   imputed_control_1_raw <dbl>, imputed_control_2_raw <dbl>, …