Beispiel #1
0
 def setUp(self):
     self.motif = motif.Motif("O..x.-+")
Beispiel #2
0
 def setUp(self):
     self.motif = motif.Motif('O..x.-+')
 def test_filter(self):
     for data in self.data.values():
         for f in [
             {
                 "ambiguous": True
             },
             {
                 "ambiguous": False
             },
             {
                 "p": .1
             },
             {
                 "q": .1
             },
             {
                 "fold": 1.5
             },
             {
                 "fold": 1 / 1.5
             },
             {
                 "asym_fold": 1.5
             },
             {
                 "asym_fold": 1 / 1.5
             },
             {
                 "sequence": "AVDSLVPIGR"
             },
             {
                 "sequence": ["AVDSLVPIGR"]
             },
             {
                 "protein": "Pkm"
             },
             {
                 "protein": ["Pkm"]
             },
             {
                 "ion_score": 10
             },
             {
                 "isolation": 15
             },
             {
                 "fn": lambda x: len(x["Sequence"]) > 5
             },
             {
                 "series":
                 data["Isolation Interference"] < data["Ion Score"]
             },
             {
                 "missed_cleavage": 0
             },
             {
                 "median_quant": 10000
             },
             {
                 "only_validated": False
             },
             {
                 "mod": "Y"
             },
             {
                 "mod": "Phospho"
             },
             {
                 "mod": [(None, "Phospho")]
             },
             {
                 "p": .1,
                 "inverse": True
             },
             {
                 "motif": motif.Motif(".......xP......")
             },
             {
                 "confidence": "Low"
             },
             {
                 "confidence": "Medium"
             },
             {
                 "confidence": "High"
             },
             {
                 "group_a": "CK-p25 Hip",
                 "group_b": "CK Hip"
             },
         ]:
             data.filter(f)
    def setUp(self):
        self.foreground = [
            i.strip()
            for i in FOREGROUND.split('\n')
            if i.strip()
        ]
        self.background = [
            i.strip()
            for i in BACKGROUND.split('\n')
            if i.strip()
        ]
        self.output = []

        for line in OUTPUT.split('\n'):
            line = line.strip()

            if not line:
                continue

            tokens = line.split('|')

            m = motif.Motif(tokens[1].strip())

            fore_hits = int(tokens[2].split('/')[0])
            fore_size = int(tokens[2].split('/')[1])

            back_hits = int(tokens[3].split('/')[0])
            back_size = int(tokens[3].split('/')[1])

            p_val = float(tokens[4])

            self.output.append(
                (
                    m,
                    fore_hits, fore_size,
                    back_hits, back_size,
                    p_val,
                )
            )

        self.output = pd.DataFrame(
            data=self.output,
            columns=[
                'Motif',
                'Foreground Hits',
                'Foreground Size',
                'Background Hits',
                'Background Size',
                'p-value',
            ],
        )
        # Re-sort as the p-values on Brian's tables are truncated a bit short.
        self.output['sort-p-value'] = pd.Series(
            [
                motif._motif_sig(
                    row['Foreground Hits'],
                    row['Foreground Size'],
                    row['Background Hits'],
                    row['Background Size'],
                )
                for _, row in self.output.iterrows()
            ],
            index=self.output.index,
        )
        self.output.sort_values(by=['sort-p-value', 'Motif'], inplace=True)
        self.output.reset_index(drop=True)
Beispiel #5
0
 def test_filter(self):
     for data in self.data.values():
         for f in [
             {
                 'ambiguous': True
             },
             {
                 'ambiguous': False
             },
             {
                 'p': .1
             },
             {
                 'q': .1
             },
             {
                 'fold': 1.5
             },
             {
                 'fold': 1 / 1.5
             },
             {
                 'asym_fold': 1.5
             },
             {
                 'asym_fold': 1 / 1.5
             },
             {
                 'sequence': 'AVDSLVPIGR'
             },
             {
                 'sequence': ['AVDSLVPIGR']
             },
             {
                 'protein': 'Pkm'
             },
             {
                 'protein': ['Pkm']
             },
             {
                 'ion_score': 10
             },
             {
                 'isolation': 15
             },
             {
                 'fn': lambda x: len(x['Sequence']) > 5
             },
             {
                 'series':
                 data['Isolation Interference'] < data['Ion Score']
             },
             {
                 'missed_cleavage': 0
             },
             {
                 'median_quant': 10000
             },
             {
                 'only_validated': False
             },
             {
                 'mod': 'Y'
             },
             {
                 'mod': 'Phospho'
             },
             {
                 'mod': [(None, 'Phospho')]
             },
             {
                 'p': .1,
                 'inverse': True
             },
             {
                 'motif': motif.Motif('.......xP......')
             },
             {
                 'confidence': 'Low'
             },
             {
                 'confidence': 'Medium'
             },
             {
                 'confidence': 'High'
             },
             {
                 'group_a': 'CK-p25 Hip',
                 'group_b': 'CK Hip'
             },
         ]:
             data.filter(f)