This script was designed to create a data set with each individual Sample in Freezerworks that will tell you the total number and/or volume of aliquots based on the sample type. It can also summarize by Participant ID, report the total number of collections per participant, sort/filter by different criteria, and report the number of distinct participants that match your criteria.

Primary Output:
  • Sample Summary Table: Lists each individual sample. Columns summarize the number of aliquots of each sample type
  • Participant Summary Table: Lists each participant. Columns summarize the number of aliquots of each sample type

For more detail on a SINGLE Sample Type:
  • Sample Summary with Status: Lists each individual sample. Columns summarize the total number of aliquots with a breakdown by aliquot status
  • Parent ID Summary with Status: Lists each parent aliquot. Columns summarize the total number of aliquots with a breakdown by aliquot status
  • Participant Summary with Status: Lists each participant. Columns summarize the total number of aliquots with a breakdown by aliquot status

To Use:
Cheatsheet of Study Abbreviations and Column Names:

You'll need to export two files from Freezerworks, one for Samples and one for Aliquots. The script works for .txt files (default format for FW exports). When you run the script in R, make sure the exported files are in the working directory.

Once you copy and paste the script into R, DO NOT try to run parts of the script multiple times (for example if you edit a section). It will mess up the output. To run a part again, “Restart and Run all chunks”.

Please fill out ALL of the options below before launching. You can change your selections and relaunch if needed.


Sample file: First pull up all samples in list view, click on "Reports" from the top bar, and select "Samples Backup". Remove the "Sample Notes" and "Aliquots Notes" fields from the column on the right and export the file. Enter the name of the exported file, including .txt. You do not need quotes.


Aliquots file: Go back to the list view, and click on the Aliquots tab to view all Aliquots. Now do the same thing, but select "Basic Aliquots Export". You do not need to alter any fields, simply export the file. This will take several minutes. Enter the name of the exported file, including .txt. You do not need quotes.


Do you want “Pulled” Aliquots to be removed from the summary?

Yes
No

Do you want “Depleted” Aliquots to be removed from the summary?

Yes
No

Do you want Aliquots that have been “Provided to Collaborator” to be removed from the summary?

Yes
No

Do you want the summary to be of one study, or all studies?
If you want to limit it to one study, enter the Study Abbreviation:

One Study
All Studies

Filter by any sample level criteria?

(TEW_Participant_ID, TEW_Visit, X0_Visit_Date, Freezerworks.ID,
Number.of.Aliquots.Total, Number.of.Aliquots.with.Positions)

Enter any filters using this example format. You can include as many or as few as you want. Use logical operators (&, | , == , !=, >, < , >= , <=) if needed.

Example input:
TEW_Participant_ID=="P04" & TEW_Visit=="Day 13"

Yes
No

These are the output columns. If you’re only interested in a few, list them here. No quotes needed, just the column names separated by commas.


[9] "No.Urine_Supernatants"
[10] "No.Full_Supernatants"
[11] "No.Urine_Pellets"
[12] "No.Urine_Resin"
[13] "No.Urinalysis"
[14] "No.Serum"
[15] "Total_Volume_Serum"
[16] "No.Serum_0.1"
[17] "No.Serum_0.25"
[18] "No.Serum_0.5"
[19] "No.Serum_1"
[20] "No.Ct_Plasma"
[21] "No.Ex_Plasma"
[22] "No.CPT_Plasma"
[23] "No.DNAStreck_Plasma"
[24] "No.RNAStreck_Plasma"
[25] "Total_Volume_Plasma"
[26] "No.Ct_Plasma_0.25"
[27] "No.Ct_Plasma_0.5"
[28] "No.Ct_Plasma_1"
[29] "No.Ex_Plasma_0.25"
[30] "No.Ex_Plasma_0.5"
[31] "No.Ex_Plasma_1"
[32] "No.CPT_Plasma_0.25"
[33] "No.CPT_Plasma_0.5"
[34] "No.CPT_Plasma_1"
[35] "No.DNAStreck_Plasma_1"
[36] "No.DNAStreck_Plasma_1.5"
[37] "No.RNAStreck_Plasma_1"
[38] "No.Plasma_Ex_Qiazol"
[39] "No.Plasma_CPT_Qiazol"
[40] "No.BCP_15_50mL"
[41] "No.BCP_Other"
[42] "No.BCP_Qiazol"
[43] "No.WBC"
[44] "No.WBC_CPT"
[45] "No.WBC_Qiazol"
[46] "No.Stool_EDTA_50"
[47] "No.Stool_EDTA_2"
[48] "No.Stool_Genotek"
[49] "No.DNA"
[50] "No.RNA"
[51] "No.Monocytes"
[52] "No.Leukocytes"
[53] "No.Whole_Blood_EDTA"
[54] "No.Whole_Blood_CPT"
[55] "No.Whole_Blood_Serum"
[56] "No.Whole_Blood_DNA_Streck"
[57] "No.Whole_Blood_RNA_Streck"
[58] "No.Whole_Blood_PAXgene"
[59] "No.Whole_Urine"
[60] "No.Whole_Stool"
[61] "No.Blood_Collections"
[62] "No.Urine_Collections"
[63] "No.Stool_Collections"

Note: Any number in a column name is the volume (mL). For serum and plasma samples, columns with numbers report the number of aliquots in a sample that are greater than or equal to the specific volume. Because serum is often saved in 100uL aliquots, No.Serum_0.1 counts the number of aliquots exactly equal to 100uL. For Stool and BCP samples, the number just refers to the container size of the aliquot.

The last three columns are essentially a True/False of whether or not Blood, Urine, or Stool was collected from that sample, therefore the values will always be either “1” or “NA”.

Some Columns
All Columns

Do you want any of the output columns to meet specific criteria? If so, list the criteria here.

Example: I only want samples where urine and at least 3 mL of serum were collected. You would enter

No.Whole_Urine>=1 & Total_Volume_Serum>=3

Yes
No

Do you want the R to report the number of unique Participant IDs that meet the above criteria?

Yes
No

Do you want to sort/order the summary for the individual samples?

Enter the names of the columns you want to sort (in order). Include “Samples$” ahead of the column name
Example: Samples$TEW_Participant_ID, Samples$TEW_Visit

Yes
No

Do you want to sort/order the summary for the different participants?

Enter the names of the columns you want to sort (in order). Include “SampleSum$” ahead of the column name.

Column names include:
TEW_Participant_ID
TEW_Study_Abbrev
Number.of.Aliquots.Total
Number.of.Aliquots.with.Positions
All of the columns selected from the “Samples” output above
n
(Column “n” is the total number of samples from the participant that meet your criteria)

Example: SampleSum$TEW_Study_Abbrev, SampleSum$n

Yes
No

Do you want to the summary for each sample to be exported as a txt file? If yes, put what you want the file to be named.

Yes
No

Do you want to the summary for each participant to be exported as a txt file? If yes, put what you want the file to be named.

Yes
No

Sample Summary with Status:
Do you want to the summary for each participant to be exported as a txt file? If yes, put what you want the file to be named.

For which sample type?

Yes
No

Do you want to sort/order this output table?

Enter the names of the columns you want to sort (in order). Include “Sample_Type_With_Status$” ahead of the column name. Column names are listed below
"TEW_Study_Abbrev"
"TEW_Participant_ID"
"Freezerworks.ID"
"X0_Visit_Date"
"TEW_Visit"
"TEW_Collection_Date"
"TEW_SampleType"
"No.Total"
"No.Distributed"
"No.Pulled"
"No.Depleted"
"No.Provided.to.Collab"

Example: Sample_Type_With_Status$TEW_Participant_ID


Parent ID Summary with Status:
For more detail on a single sample type, do you want a Parent ID Summary summary with a breakdown by aliquot status?

For which sample type?

Yes
No

Do you want to sort/order this output table?

Enter the names of the columns you want to sort (in order). Include “Sample_Type_Summary_by_Parent_Aliquot$” ahead of the column name. Column names are listed below
"TEW_Study_Abbrev"
"TEW_Participant_ID"
"Freezerworks.ID"
"X0_Visit_Date"
"TEW_Visit"
"TEW_Collection_Date"
"TEW_SampleType"
"No.Total"
"No.Distributed"
"No.Pulled"
"No.Depleted"
"No.Provided.to.Collab"
"Parent.Aliquot.ID"

Example: Sample_Type_Summary_by_Parent_Aliquot$TEW_Participant_ID


Participant Summary with Status:
For more detail on a single sample type, do you want a Participant ID summary with a breakdown by aliquot status?

For which sample type?

Yes
No

Do you want to sort/order this output table?

Enter the names of the columns you want to sort (in order). Include “Sample_Type_Summary_by_Participant$” ahead of the column name. Column names are listed below
"TEW_Study_Abbrev"
"TEW_Participant_ID"
"Freezerworks.ID"
"X0_Visit_Date"
"TEW_Visit"
"TEW_Collection_Date"
"TEW_SampleType"
"No.Total"
"No.Distributed"
"No.Pulled"
"No.Depleted"
"No.Provided.to.Collab"

Example: Sample_Type_Summary_by_Participant$TEW_Participant_ID