예제 #1
0
 def setup_class(cls):
     cls.fragment = Fragment('Glucose', 'C6H12O6')
     cls.frag_key = 'glucose_C6H12O6'
     cls.label_dict = {'C13': 4}
     cls.label_key = 'C13_4'
     cls.intensities = numpy.array([2345, 5673, 456, 567.3])
     cls.intensity_err = [2345, 5673, 456, 567.3]
예제 #2
0
 def setup_class(cls):
     cls.fragment = Fragment('Glucose',
                             'C5H10NO2S',
                             label_dict={
                                 'C13': 5,
                                 'N15': 1
                             })
     cls.fragment_isotope_none = Fragment('Glucose',
                                          'C5H10NO2S',
                                          label_dict={'C13': 0})
     cls.fragment_natural_isotope = Fragment('Glucose',
                                             'C5H10NO2S',
                                             label_dict={
                                                 'C13': 0,
                                                 'N14': 1
                                             })
     cls.fragment_mass = Fragment('Glucose',
                                  'C6H12O6',
                                  isotracer='C13',
                                  isotope_mass=181,
                                  molecular_mass=180)
     cls.fragment_mode = Fragment('Glucose',
                                  'C6H12O6',
                                  isotracer='C13',
                                  isotope_mass=181,
                                  mode='pos')
     cls.fragment_unlabel_nat = Fragment('Glucose',
                                         'C6H12O6',
                                         label_dict={'C12': 5})
예제 #3
0
def test_fragmentdict_model():
    cit_frag = Fragment('Citruline', 'C6H13N3O3', label_dict={'C13': 0})
    fragments_dict = {
        'Citruline_C13_0_N15_0':
        Infopacket(frag=cit_frag,
                   data={'sample_1': np.array([0.3624])},
                   unlabeled=True,
                   name='Acetic')
    }
    lab_sam_dict = {(0, 0): {'sample_1': 0.3624}}
    assert algo.fragmentdict_model(['C13', 'N15'], fragments_dict,
                                   lab_sam_dict) == {
                                       'Citruline_C13_0_N15_0':
                                       Infopacket(frag=cit_frag,
                                                  data={'sample_1': 0.3624},
                                                  unlabeled=True,
                                                  name='Acetic')
                                   }
df = pd.DataFrame({'Name': {0: 'Acetic', 1: 'Acetic', 2: 'Acetic'}, \
   'Parent': {0: 'Acetic', 1: 'Acetic', 2: 'Acetic'}, \
    'Label': {0: 'C12 PARENT', 1: 'C13-label-1', 2: 'C13-label-2'}, \
     'Intensity': {0: 0.3624, 1: 0.040349999999999997, 2: 0.59724999999999995}, \
      'Formula': {0: 'H4C2O2', 1: 'H4C2O2', 2: 'H4C2O2'}, \
      'info2': {0: 'culture_1', 1: 'culture_1', 2: 'culture_1'}, \
       'Sample Name': {0: 'sample_1', 1: 'sample_1', 2: 'sample_1'}})

correc_inten_dict = {'sample_1': {(0, 1): np.array([ 0.0619]), (0, 0): np.array([ 0.2456]), \
     (3, 0): np.array([ 0.0003]), (3, 1): np.array([ 0.0001]), (2, 1): np.array([ 0.0015]), \
      (2, 0): np.array([ 0.0071]), (5, 0): np.array([ 0.]), (5, 1): np.array([ 0.60045]), \
      (1, 0): np.array([ 0.06665]), (4, 1): np.array([ 0.]), (1, 1): np.array([ 0.0164]), \
       (4, 0): np.array([ 0.])}}

acetic_frag = Fragment('Acetic', 'H4C2O2', label_dict={'C13': 0})
fragments_dict = {
    'Acetic_C13_0':
    iso.Infopacket(frag=acetic_frag,
                   data={'sample_1': np.array([0.3624])},
                   unlabeled=True,
                   name='Acetic')
}

label_list = [(0, 1), (0, 0), (3, 0), (3, 1), (2, 1), (2, 0), (5, 0), \
                 (5, 1), (1, 0), (4, 1), (1, 1), (4, 0)]


def test_corr_matrix():
    iso_tracer = 'C'
    with pytest.raises(KeyError):
예제 #5
0
def output_constants():
    nest_dict = {
        out.OutKey(name='L-Methionine', formula='C5H10NO2S'): {
            'N15_0_C13_5': {
                'sample_1': 3.156529191428407e-08
            },
            'N15_0_C13_4': {
                'sample_1': -4.6457232333485042e-06
            },
            'N15_0_C13_1': {
                'sample_1': 0.055358607526132128
            },
            'N15_0_C13_0': {
                'sample_1': 0.26081351241574013
            },
            'N15_0_C13_3': {
                'sample_1': 0.00010623115401093528
            },
            'N15_0_C13_2': {
                'sample_1': 0.0045440397693722904
            },
            'N15_1_C13_0': {
                'sample_1': 0.064545716018271096
            },
            'N15_1_C13_1': {
                'sample_1': 0.013283380798059349
            },
            'N15_1_C13_2': {
                'sample_1': 0.00084379489120955248
            },
            'N15_1_C13_3': {
                'sample_1': 6.1161350126415117e-05
            },
            'N15_1_C13_4': {
                'sample_1': -1.8408545189878132e-06
            },
            'N15_1_C13_5': {
                'sample_1': 0.60114017085422033
            }
        }
    }

    acetic_frag = Fragment('Acetic', 'H4C2O2', label_dict={'C13': 1, 'C13': 2})

    fragment_dict = {
        'Acetic_C13_1':
        Infopacket(frag='H4C2O2',
                   data={'sample_1': 1},
                   unlabeled=False,
                   name='Acetic'),
        'Acetic_C13_2':
        Infopacket(frag='H4C2O2',
                   data={'sample_1': 0},
                   unlabeled=False,
                   name='Acetic')
    }
    metabolite_dict = {('Acetic', 'H4C2O2'): fragment_dict}

    metabolite_dict = {
        ('L-Methionine', 'C5H10NO2S'): {
            'C13_1': {
                'sample_1': 3.18407678e-07
            },
            'C13_0': {
                'sample_1': 0.48557866
            }
        }
    }

    df = pd.DataFrame({
        'Sample': {
            0: 'sample_1',
            1: 'sample_1',
            2: 'sample_1',
            3: 'sample_1',
            4: 'sample_1',
            5: 'sample_1',
            6: 'sample_1',
            7: 'sample_1',
            8: 'sample_1',
            9: 'sample_1',
            10: 'sample_1',
            11: 'sample_1'
        },
        'Formula': {
            0: 'C5H10NO2S',
            1: 'C5H10NO2S',
            2: 'C5H10NO2S',
            3: 'C5H10NO2S',
            4: 'C5H10NO2S',
            5: 'C5H10NO2S',
            6: 'C5H10NO2S',
            7: 'C5H10NO2S',
            8: 'C5H10NO2S',
            9: 'C5H10NO2S',
            10: 'C5H10NO2S',
            11: 'C5H10NO2S'
        },
        'Intensity': {
            0: 3.156529191428407e-08,
            1: -4.6457232333485042e-06,
            2: 0.055358607526132128,
            3: 0.26081351241574013,
            4: 0.00010623115401093528,
            5: 0.0045440397693722904,
            6: 0.064545716018271096,
            7: 0.013283380798059349,
            8: 0.00084379489120955248,
            9: 6.1161350126415117e-05,
            10: -1.8408545189878132e-06,
            11: 0.60114017085422033
        },
        'Name': {
            0: 'L-Methionine',
            1: 'L-Methionine',
            2: 'L-Methionine',
            3: 'L-Methionine',
            4: 'L-Methionine',
            5: 'L-Methionine',
            6: 'L-Methionine',
            7: 'L-Methionine',
            8: 'L-Methionine',
            9: 'L-Methionine',
            10: 'L-Methionine',
            11: 'L-Methionine'
        },
        'Label': {
            0: 'N15_0_C13_5',
            1: 'N15_0_C13_4',
            2: 'N15_0_C13_1',
            3: 'N15_0_C13_0',
            4: 'N15_0_C13_3',
            5: 'N15_0_C13_2',
            6: 'N15_1_C13_0',
            7: 'N15_1_C13_1',
            8: 'N15_1_C13_2',
            9: 'N15_1_C13_3',
            10: 'N15_1_C13_4',
            11: 'N15_1_C13_5'
        }
    })
    return nest_dict, df