def build(self, database_connection, **kwargs):
     kwargs.setdefault('hypothesis_name', self.hypothesis_metadata['name'])
     task = TextFileGlycanHypothesisSerializer(
         self.prepare_buffer(), database_connection,
         **kwargs)
     task.start()
     return task
Beispiel #2
0
    def test_uniprot_info(self):
        fasta_file = self.setup_tempfile(decorin)
        glycan_file = self.setup_tempfile(o_glycans)
        db_file = self.setup_tempfile("")
        glycan_builder = TextFileGlycanHypothesisSerializer(
            glycan_file, db_file)
        glycan_builder.start()

        glycopeptide_builder = naive_glycopeptide.MultipleProcessFastaGlycopeptideHypothesisSerializer(
            fasta_file,
            db_file,
            glycan_builder.hypothesis_id,
            protease=['trypsin'],
            constant_modifications=constant_modifications,
            variable_modifications=[],
            max_missed_cleavages=2)
        glycopeptide_builder.start()

        post_cleavage = glycopeptide_builder.query(serialize.Peptide).filter(
            serialize.Peptide.base_peptide_sequence ==
            "DEASGIGPEEHFPEVPEIEPMGPVCPFR").first()
        self.assertIsNotNone(post_cleavage)

        self.clear_file(db_file)
        self.clear_file(fasta_file)
        self.clear_file(glycan_file)
Beispiel #3
0
    def test_missing_glycopeptide(self):
        glycan_file = self.setup_tempfile(o_glycans)
        fasta_file = self.setup_tempfile(HEPARANASE)
        db_file = fasta_file + '.db'

        glycan_builder = TextFileGlycanHypothesisSerializer(
            glycan_file, db_file)
        glycan_builder.start()

        glycopeptide_builder = naive_glycopeptide.FastaGlycopeptideHypothesisSerializer(
            fasta_file,
            db_file,
            glycan_builder.hypothesis_id,
            protease='trypsin',
            constant_modifications=constant_modifications,
            max_missed_cleavages=2)
        glycopeptide_builder.start()

        case = glycopeptide_builder.query(
            Glycopeptide.glycopeptide_sequence ==
            "KFKNSTYS(O-Glycosylation)R{Hex:1; HexNAc:1; Neu5Ac:2}").first()
        self.assertIsNotNone(case)

        self.clear_file(glycan_file)
        self.clear_file(fasta_file)
        self.clear_file(db_file)
 def build(self, database_connection, **kwargs):
     if kwargs.get('hypothesis_name') is None:
         kwargs['hypothesis_name'] = (self.hypothesis_metadata['name'])
     task = TextFileGlycanHypothesisSerializer(load_text(),
                                               database_connection,
                                               **kwargs)
     task.start()
     return task
 def build(self, database_connection, **kwargs):
     if kwargs.get('hypothesis_name') is None:
         kwargs['hypothesis_name'] = (self.hypothesis_metadata['name'])
     task = TextFileGlycanHypothesisSerializer(
         load_text(), database_connection,
         **kwargs)
     task.start()
     return task
def _build_glycan_composition_hypothesis_from_text(database_connection, text_file, hypothesis_name,
                                                   identifier=None):
    if hypothesis_name is not None:
        hypothesis_name = hypothesis_name + '-Glycans'
    builder = TextFileGlycanHypothesisSerializer(
        text_file, database_connection, hypothesis_name=hypothesis_name)
    builder.run()
    return builder.hypothesis_id
def _build_glycan_composition_hypothesis_from_text(database_connection,
                                                   text_file,
                                                   hypothesis_name,
                                                   identifier=None):
    if hypothesis_name is not None:
        hypothesis_name = hypothesis_name + '-Glycans'
    builder = TextFileGlycanHypothesisSerializer(
        text_file, database_connection, hypothesis_name=hypothesis_name)
    builder.run()
    return builder.hypothesis_id
def glycan_text(context, text_file, database_connection, reduction, derivatization, name):
    if name is not None:
        name = validate_glycan_hypothesis_name(context, database_connection, name)
        click.secho("Building Glycan Hypothesis %s" % name, fg='cyan')
    reduction = validate_reduction(context, reduction)
    derivatization = validate_derivatization(context, derivatization)
    builder = TextFileGlycanHypothesisSerializer(
        text_file, database_connection, reduction=reduction, derivatization=derivatization,
        hypothesis_name=name)
    builder.display_header()
    builder.start()
    def test_throughput(self):
        fasta_file = fixtures.get_test_data("phil-82-proteins.fasta")
        glycan_file = fixtures.get_test_data("IAV_matched_glycans.txt")
        db_file = self.setup_tempfile("")
        print(db_file)

        glycan_builder = TextFileGlycanHypothesisSerializer(glycan_file, db_file)
        glycan_builder.start()

        glycopeptide_builder = naive_glycopeptide.MultipleProcessFastaGlycopeptideHypothesisSerializer(
            fasta_file, db_file, glycan_builder.hypothesis_id, constant_modifications=constant_modifications,
            variable_modifications=variable_modifications, max_missed_cleavages=2)
        glycopeptide_builder.start()
        self.clear_file(db_file)
    def test_extract_forward_backward(self):
        fasta_file = fixtures.get_test_data("yeast_glycoproteins.fa")
        glycan_file = self.setup_tempfile(simple_n_glycans)
        forward_db = self.setup_tempfile("")
        reverse_db = self.setup_tempfile("")

        glycan_builder = TextFileGlycanHypothesisSerializer(glycan_file, forward_db)
        glycan_builder.start()

        builder = naive_glycopeptide.MultipleProcessFastaGlycopeptideHypothesisSerializer(
            fasta_file, forward_db, 1)
        cnt = builder.extract_proteins()
        assert cnt == 251

        glycan_builder = TextFileGlycanHypothesisSerializer(glycan_file, reverse_db)
        glycan_builder.start()

        rev_builder = naive_glycopeptide.ReversingMultipleProcessFastaGlycopeptideHypothesisSerializer(
            fasta_file, reverse_db, 1)
        cnt = rev_builder.extract_proteins()
        assert cnt == 251
        fwd_prots = builder.query(serialize.Protein).all()
        rev_prots = rev_builder.query(serialize.Protein).all()

        for fx, rx in zip(fwd_prots, rev_prots):
            assert fx.name == rx.name
            assert len(fx.glycosylation_sites) == len(rx.glycosylation_sites)
    def test_throughput(self):
        fasta_file = fixtures.get_test_data("phil-82-proteins.fasta")
        glycan_file = fixtures.get_test_data("IAV_matched_glycans.txt")
        db_file = self.setup_tempfile("")
        print(db_file)

        glycan_builder = TextFileGlycanHypothesisSerializer(glycan_file, db_file)
        glycan_builder.start()

        glycopeptide_builder = naive_glycopeptide.MultipleProcessFastaGlycopeptideHypothesisSerializer(
            fasta_file, db_file, glycan_builder.hypothesis_id, constant_modifications=constant_modifications,
            variable_modifications=variable_modifications, max_missed_cleavages=2)
        glycopeptide_builder.start()
        self.clear_file(db_file)
    def test_uniprot_info(self):
        fasta_file = self.setup_tempfile(decorin)
        glycan_file = self.setup_tempfile(o_glycans)
        db_file = self.setup_tempfile("")
        glycan_builder = TextFileGlycanHypothesisSerializer(glycan_file, db_file)
        glycan_builder.start()

        glycopeptide_builder = naive_glycopeptide.MultipleProcessFastaGlycopeptideHypothesisSerializer(
            fasta_file, db_file, glycan_builder.hypothesis_id,
            protease=['trypsin'],
            constant_modifications=constant_modifications,
            variable_modifications=[], max_missed_cleavages=2)
        glycopeptide_builder.start()

        post_cleavage = glycopeptide_builder.query(serialize.Peptide).filter(
            serialize.Peptide.base_peptide_sequence == "DEASGIGPEEHFPEVPEIEPMGPVCPFR").first()
        self.assertIsNotNone(post_cleavage)

        self.clear_file(db_file)
        self.clear_file(fasta_file)
        self.clear_file(glycan_file)
    def test_missing_glycopeptide(self):
        glycan_file = self.setup_tempfile(o_glycans)
        fasta_file = self.setup_tempfile(HEPARANASE)
        db_file = fasta_file + '.db'

        glycan_builder = TextFileGlycanHypothesisSerializer(glycan_file, db_file)
        glycan_builder.start()

        glycopeptide_builder = naive_glycopeptide.FastaGlycopeptideHypothesisSerializer(
            fasta_file, db_file, glycan_builder.hypothesis_id, protease='trypsin',
            constant_modifications=constant_modifications,
            max_missed_cleavages=2)
        glycopeptide_builder.start()

        case = glycopeptide_builder.query(
            Glycopeptide.glycopeptide_sequence == "KFKNSTYS(O-Glycosylation)R{Hex:1; HexNAc:1; Neu5Ac:2}").first()
        self.assertIsNotNone(case)

        self.clear_file(glycan_file)
        self.clear_file(fasta_file)
        self.clear_file(db_file)
    def test_extract_forward_backward(self):
        fasta_file = fixtures.get_test_data("yeast_glycoproteins.fa")
        glycan_file = self.setup_tempfile(simple_n_glycans)
        forward_db = self.setup_tempfile("")
        reverse_db = self.setup_tempfile("")

        glycan_builder = TextFileGlycanHypothesisSerializer(glycan_file, forward_db)
        glycan_builder.start()

        builder = naive_glycopeptide.MultipleProcessFastaGlycopeptideHypothesisSerializer(
            fasta_file, forward_db, 1)
        cnt = builder.extract_proteins()
        assert cnt == 251

        glycan_builder = TextFileGlycanHypothesisSerializer(glycan_file, reverse_db)
        glycan_builder.start()

        rev_builder = naive_glycopeptide.ReversingMultipleProcessFastaGlycopeptideHypothesisSerializer(
            fasta_file, reverse_db, 1)
        cnt = rev_builder.extract_proteins()
        assert cnt == 251
        fwd_prots = builder.query(serialize.Protein).all()
        rev_prots = rev_builder.query(serialize.Protein).all()

        for fx, rx in zip(fwd_prots, rev_prots):
            assert fx.name == rx.name
            assert len(fx.glycosylation_sites) == len(rx.glycosylation_sites)
def glycan_text(context, text_file, database_connection, reduction,
                derivatization, name):
    if name is not None:
        name = validate_glycan_hypothesis_name(context, database_connection,
                                               name)
        click.secho("Building Glycan Hypothesis %s" % name, fg='cyan')
    reduction = validate_reduction(context, reduction)
    derivatization = validate_derivatization(context, derivatization)
    builder = TextFileGlycanHypothesisSerializer(text_file,
                                                 database_connection,
                                                 reduction=reduction,
                                                 derivatization=derivatization,
                                                 hypothesis_name=name)
    builder.display_header()
    builder.start()