Giter Club home page Giter Club logo

webblast.jl's Introduction

WebBlast.jl

This package helps you call BLAST (https://blast.ncbi.nlm.nih.gov/) from Julia. It is extremely simple, but tries to remain flexible, as long as you're happy to put in a little extra work.

The main functions you'll use is:

    WebBLAST(query;
        num_hits = 100,
        database = "nt",
        program = "blastn")

NOTE: This relies on querying a public web service, using an API that they list as "deprecated". Please do not count on this working in the long run, and please don't abuse it as that might get it shut down faster.

query must be either a String, or an array of String (if searching multiple sequences). These are expected to be nucleotide or amino acid sequences. Just make sure they (nuc or AA) match the database and program! For example, if you pass in amino acid sequences, you can't use the "nt" database, but database = "pdb" should work.

Installation:

Until the package is registered, please use:

using Pkg
Pkg.add(PackageSpec(name="WebBlast", url = "https://github.com/MurrellGroup/WebBlast.jl.git"))

Example use:

using WebBlast

queries = ["MKTLLLTIGFSLIAILQAQDTPALGKDTVAVSGKWYLKAMTADQEVPE","MRALLLAIGLGLVAALQAQEFPAVGQPLQDLLGRWYLKAMTSDPEIPG"];
blast_array = WebBLAST(queries, program = "blastp", database = "pdb", num_hits = 3);

with output (note the delays, while the BLAST server computes):

Waiting for 35 seconds
Waiting for result...
Waiting for result...
Retrieving hits.

and returns blast_array, which is an array of dictionaries. That array has one element per query (with one query, this will be an array of length 1). Each Query dictionary will have a key "Query_hit_array", which will return an array of hit dictionaries. Each hit can have more than one "High Similarity Pair" (or "HSP"), so the hit dictionary has a key "Hit_hsps" which itself is an array of HSPs. This can be traversed to get whatever you like. For example, here is a code snippet that runs through all HSPs for all hits for all queries and prints out some key properties of the hits:

for query in blast_array
    for hit in query["Query_hit_array"]
        for HSP in hit["Hit_hsps"]
            println("Query: ", query["Query-def"])
            println("Accession: ", hit["Hit_accession"])
            println("Identity: ", HSP["Hsp_identity"])
            println("Query: ", HSP["Hsp_qseq"])
            println("Hit:   ", HSP["Hsp_hseq"])
        end
    end
end

Which gives the following output:

Query: query_1
Accession: 5T43_A
Identity: 14
Query: VSGKWYLKAMTADQEVPE
Hit:   VSGTWYLKAMTVDREFPE
Query: query_1
Accession: 1XKI_A
Identity: 14
Query: VSGKWYLKAMTADQEVPE
Hit:   VSGTWYLKAMTVDREFPE
Query: query_1
Accession: 4RUN_A
Identity: 9
Query: VSGKWYLKAMTADQEVPE
Hit:   ITGTWYVKAMVVDKDFPE
Query: query_2
Accession: 5T43_A
Identity: 14
Query: AVGQPLQDLLGRWYLKAMTSDPEIP
Hit:   ASDEEIQDVSGTWYLKAMTVDREFP
Query: query_2
Accession: 1XKI_A
Identity: 14
Query: AVGQPLQDLLGRWYLKAMTSDPEIP
Hit:   ASDEEIQDVSGTWYLKAMTVDREFP
Query: query_2
Accession: 4QAF_A
Identity: 12
Query: AVGQPLQDLLGRWYLKAMTSD
Hit:   ASDEEIQDVSGTWYLKAMTVD

However, if you don't want to both with all that, you can instead use:

df = flatten_to_dataframe(blast_array)

which will give you a DataFrame with all of the information per HSP, hit, query, etc.

webblast.jl's People

Contributors

hughmurrell avatar murrellb avatar qile0317 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.