Difference: ProtocolsPythonSnippets (2 vs. 3)

Revision 32021-11-30 - MattMcGuffie

Line: 1 to 1
 
META TOPICPARENT name="ComputationList"

Python snippets for biology

Requires BioPython to be installed
Line: 47 to 47
 from tempfile import NamedTemporaryFile import pandas as pd
Changed:
<
<
def BLAST(seq, db = 'nr_db', type = "p"):
>
>
def BLAST(seq, db = 'path/to/db', Type = "blastn"):
  # 'seq' is a sequence (as a str) of a protein or nucleotide sequence # 'db' points to location of local BLAST database # 'type' specifies the type of BLAST (e.g. 'n', 'p', 'x', etc)
Line: 62 to 62
  # 'extras' are further flags that can be called on the CL

subprocess.call( #the actual CL BLAST

Changed:
<
<
(f'blast{type} -query {query.name} -out {tmp.name} ' f'-db {db} {extras} -word_size {str(wordsize)} -outfmt "6 {flags}"'),
>
>
(f'{Type} -query {query.name} -out {tmp.name} ' f'-db {db} {extras} -outfmt "6 {flags}"'),
  shell=True)

with open(tmp.name, "r") as file_handle: #opens BLAST file

 
This site is powered by the TWiki collaboration platform Powered by Perl This site is powered by the TWiki collaboration platformCopyright ©2022 Barrick Lab contributing authors. Ideas, requests, problems? Send feedback