100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Summary

Summary Bioinformatics cheatsheet

Rating
-
Sold
-
Pages
10
Uploaded on
22-03-2025
Written in
2024/2025

Bioinformatics cheatsheet to use for the exam. It includes all the exercises and additional information on certain codes. It is separated in the different steps, so only copy paste and variable adjustments should be made.

Institution
Course









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Study
Course

Document information

Uploaded on
March 22, 2025
Number of pages
10
Written in
2024/2025
Type
Summary

Subjects

Content preview

Exam_cheatsheet

March 22, 2025


1 Exam cheatsheet

1.1 Prepare data

[ ]: from Bio.Blast import NCBIWWW, NCBIXML
from Bio import Entrez, SeqIO, Phylo, AlignIO
import pandas as pd
import time, os, alv, re
from IPython.display import Image #optional

[ ]: %load_ext rpy2.ipython

[ ]: %%R
library("ape")
library("adephylo")
library("phytools")

[ ]: baseName = ""
#can add additional baseName, then number them and do not forget to add them in␣
,→downstream (see SARS excersise)

folderName = "exercise_"

#change baseName to the file with everything before .fasta
#change folderName to excercise_baseName (the variable you name your baseName)
#e.g. baseName= HIV_virus folderName= exercise_HIV_virus

[ ]: %Rpush baseName folderName

[ ]: %%bash -s "$folderName"
mkdir ${1} # if folder already exists and you wish to overwrite, you can try␣
,→$mkdir -p ${1}



Move the uploaded file into the folder for this exercise. You can also directly upload the sequence
file to today’s exercise folder. In that case, skip the next cell.
[ ]: %%bash -s "$baseName" "$folderName"
cp ${1}.fasta ${2}/${1}.fasta


1

, #if multiple files need to be moved
cp $1.#fileFormat $2/$1.#fileFormat

[ ]: os.chdir(folderName)



1.2 BlastN search (session01)

[ ]: inputFile = baseName+'.fasta'
query = SeqIO.read(inputFile, format="fasta")
search_type = "blastn"
database = "nt"
max_nr_hits = 100
before = round(time.time(), ndigits=0)
blast_stream = NCBIWWW.qblast(program = search_type,
database = database,
sequence = query.seq,
alignments = 1,
hitlist_size = max_nr_hits)
after = round(time.time(), ndigits=0)
text = f"The BLAST search took {after - before} seconds."
print(text)

Save result BlastN
[ ]: blastn_result_file = baseName+".blastn.result.xml"
with open(blastn_result_file, 'w') as file:
file.write(blast_stream.read())

[ ]: blastn_result_file = baseName+".blastn.result.xml"

Extract the sequences in fasta format from the BLAST search results
[ ]: all_data_fasta = baseName+".blastn.result.fasta"

with open(blastn_result_file) as result_handle:
blast_records = NCBIXML.parse(result_handle)
with open(all_data_fasta, 'w') as fasta_handle:
for blast_record in blast_records:
for alignment in blast_record.alignments:
for hsp in alignment.hsps:
db_seq = hsp.sbjct
db_id = alignment.accession
fasta_handle.write(f">{db_id}\n{db_seq}\n")




2
$15.79
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached


Also available in package deal

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
sisivorst Katholieke Universiteit Leuven
Follow You need to be logged in order to follow users or courses
Sold
30
Member since
2 year
Number of followers
4
Documents
17
Last sold
1 week ago

5.0

1 reviews

5
1
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions