def setupBlazegraph(cls):
        """
        Sets up some data for testing methods in this class that queries Blazegraph.
        Assumes that Blazegraph is initially empty when testing.
        """
        g = Graph()
        g.add((n.agn43_AP009048_closed_0, rdf.type, faldo.Region))
        g.add((n.agn43_AP009048_closed_0, rdf.type, n.reference_gene))
        g.add((n.agn43_AP009048_closed_0, n.is_gene_of, n.AP009048))
        g.add((n.agn43_AP009048_closed_0, n.has_sequence, Literal("ACGTTGCA", datatype=XSD.string)))
        g.add((n.agn43, n.has_copy, n.agn43_AP009048_closed_0))
        g.add((n.agn43_AP009048_closed_0_begin, faldo.position, Literal("2073676", datatype=XSD.string)))
        g.add((n.agn43_AP009048_closed_0_end, faldo.position, Literal("2076795", datatype=XSD.string)))
        g.add((n.agn43_AP009048_closed_0, faldo.begin, n.agn43_AP009048_closed_0_begin))
        g.add((n.agn43_AP009048_closed_0, faldo.end, n.agn43_AP009048_closed_0_end))
        g.add((n.agn43, n.has_copy, n.agn43_AP009048_closed_0))
        g.add((n.AP009048, n.has_gene, n.agn43_AP009048_closed_0))

        g.add((n.ecpC_CP002729_closed_0, rdf.type, faldo.Region))
        g.add((n.ecpC_CP002729_closed_0, n.has_sequence, Literal("ACGTTGCA", datatype=XSD.string)))
        g.add((n.ecpC, n.has_copy, n.ecpC_CP002729_closed_0))
        g.add((n.CP002729, n.has_gene, n.ecpC_CP002729_closed_0))

        BlazegraphUploader().upload_data(generate_output(g))

        del g
Пример #2
0
    def upload(cls, seqdata, func):
        """Uploads sequence data to Blazegraph based on the inputted function
        argument

        Args:
            seqdata: a SequenceMetadata instance storing sequence-related data
            that would otherwise be a data clump:
            func: function that handles RDF conversion based on the type of
            genome
        """
        graph = Graph()
        seq_rdf = Sequence(graph, **seqdata.generate_kwargs())

        func(seqdata, seq_rdf)

        BlazegraphUploader().upload_data(generate_output(graph))
Пример #3
0
    def upload(cls, contigswrapper, func):
        """Uploads contig data to Blazegraph based on inputted function argument

        Args:
            contigswrapper: ContigsWrapper instance that is a wrapper for
            contig metadata
            func: function that handles RDF conversion based on the type of
            genome
        """
        graph = Graph()
        for (accession_name, seq) in contigswrapper.contigs:
            contig_rdf = Contig(
                graph,
                **contigswrapper.generate_kwargs(accession_name, seq)
            )
            func(contigswrapper, contig_rdf)

            BlazegraphUploader().upload_data(generate_output(graph))
Пример #4
0
    def create_gene(cls, metadata):
        """
        Creates a Gene object to export the data out in the turtle format
        with the appropriate RDF tags and
        uploads it into Blazegraph.

        Args:
            metadata(GeneMetadata): An instance that contains metadata
            pertaining to an individual gene
        """
        graph = Graph()
        name = metadata.name

        if check_named_individual(name):
            print "%s already in Blazegraph." % name
        else:
            kwargs = metadata.build_kwargs()
            Gene(graph, **kwargs).rdf()
            BlazegraphUploader().upload_data(generate_output(graph))