def compound_idxs_not_evaluated(self) -> List[int]: """ Returns list of compound indices where ms1 note is not 'remove' and ms2 note is None or 'no selection' """ out = [] for i, compound in enumerate(self.data[0].compounds): ms1_note = ma_data.extract(compound, ["identification", "ms1_notes"]) ms2_note = ma_data.extract(compound, ["identification", "ms2_notes"]) if (not _is_remove(ms1_note)) and (not _has_selection(ms2_note)): out.append(i) return out
def compound_indices_marked_remove(self) -> List[int]: """ outputs: list of compound_idx of the compound identifications with ms1_notes to remove """ ids = ["identification", "ms1_notes"] return [ i for i, j in enumerate(self.data[0].compounds) if _is_remove(ma_data.extract(j, ids)) ]
def test_extract_dict01(): assert gdhf.extract({"foo": 1, "bar": 2}, ["bar"]) == 2
def test_extract_tuple03(): assert gdhf.extract(("foo", "bar"), [9], "zoop") == "zoop"
def test_extract_tuple02(): assert gdhf.extract(("foo", "bar"), [-1]) == "bar"
def test_extract_list05(): assert gdhf.extract("okay", [], 99) == "okay"
def test_extract_list04(): assert gdhf.extract([], [0], 99) == 99
def test_extract_list03(): assert gdhf.extract([1, 2], [5], 99) == 99
def test_extract_list02(): assert gdhf.extract([1, 2], [5]) is None
def test_extract_list01(): assert gdhf.extract([1, 2], [0]) == 1
def test_extract_metatlas_dataset03(metatlas_dataset): assert gdhf.extract(metatlas_dataset, ["foo"], "zoop") == "zoop"
def test_extract_metatlas_dataset02(metatlas_dataset): ids = [0, 0, "identification", "compound", 0, "inchi_key"] assert gdhf.extract(metatlas_dataset, ids, "zoop") == "OLXZPDWKRNYJJZ-RRKCRQDMSA-N"
def test_extract_default01(): assert gdhf.extract({"foo": 1, "bar": 2}, ["foo", "bar"], "zoop") == "zoop"
def test_extract_dict02(): assert gdhf.extract({"foo": 1, "bar": 2}, ["blah"], "zoop") == "zoop"