czbiohub-sf / Rapid-QC-MS

Realtime quality control for mass spectrometry data acquisition
https://czbiohub-sf.github.io/Rapid-QC-MS
Other
15 stars 2 forks source link

QC processing algorithm #41

Closed wasimsandhu closed 2 years ago

wasimsandhu commented 2 years ago
  1. Intensity dropout for X number of internal standards
  2. Internal standard retention time shifting out of X range from in-run average
  3. X number of samples where the in-run RT shift of an internal standard is moving in one direction
  4. Internal standard precursor m/z shifting out of X range from library m/z
wasimsandhu commented 2 years ago

Snippet for testing AutoQC algorithm:

folder = "/Users/wasim.sandhu/Downloads/EMGO003/"
files = [f for f in os.listdir(folder) if os.path.isfile(os.path.join(folder, f))]
for file in files:

    sample_peak_list = folder + file

    if "Pos" in file:
        df_features = db.get_internal_standards("C18", "Positive Mode")
        polarity = "Pos"
    elif "Neg" in file:
        df_features = db.get_internal_standards("C18", "Negative Mode")
        polarity = "Neg"
    else:
        continue

    feature_list = df_features["name"].astype(str).tolist()

    df_peak_list = peak_list_to_dataframe(sample_peak_list=sample_peak_list, internal_standards=feature_list)
    qc_dataframe, qc_result = qc_sample("EMGO003", polarity, df_peak_list, df_features, False)
    print(qc_result)