bch441-work-abc-units/BIN-MYSPE.R

89 lines
3.2 KiB
R
Raw Normal View History

2017-10-04 03:38:48 +00:00
# BIN-MYSPE.R
2017-09-12 20:09:20 +00:00
#
# Purpose: A Bioinformatics Course:
2017-10-04 03:38:48 +00:00
# R code accompanying the BIN-MYSPE unit
2017-09-12 20:09:20 +00:00
#
2017-10-23 16:37:09 +00:00
# Version: 1.0.1
2017-09-12 20:09:20 +00:00
#
2017-09-21 21:49:55 +00:00
# Date: 2017 09 21
2017-09-12 20:09:20 +00:00
# Author: Boris Steipe (boris.steipe@utoronto.ca)
#
2017-10-23 16:37:09 +00:00
# V 1.0.1 Move ABC-makeMYSPElist.R to ./scripts directory
# V 1.0 Final code, after rewriting BLAST parser and updating MYSPElist
2017-10-04 03:38:48 +00:00
# V 0.1 First code copied from BCH441_A03_makeMYSPElist.R
2017-09-12 20:09:20 +00:00
#
# TODO:
#
#
# == HOW TO WORK WITH LEARNING UNIT FILES ======================================
#
# DO NOT SIMPLY source() THESE FILES!
2017-09-21 21:49:55 +00:00
#
2017-09-12 20:09:20 +00:00
# If there are portions you don't understand, use R's help system, Google for an
# answer, or ask your instructor. Don't continue if you don't understand what's
# going on. That's not how it works ...
#
# ==============================================================================
2017-10-04 03:38:48 +00:00
2017-09-21 21:49:55 +00:00
#TOC> ==========================================================================
2017-10-04 03:38:48 +00:00
#TOC>
#TOC> Section Title Line
#TOC> -----------------------------------------------
#TOC> 1 Preparations 39
#TOC> 2 Suitable MYSPE Species 51
#TOC> 3 Adopt "MYSPE" 65
2017-10-04 03:38:48 +00:00
#TOC>
2017-09-21 21:49:55 +00:00
#TOC> ==========================================================================
2017-10-04 03:38:48 +00:00
2017-09-21 21:49:55 +00:00
# = 1 Preparations ========================================================
#
2017-09-12 20:09:20 +00:00
2017-09-21 21:49:55 +00:00
# Execute the two conditionals below:
if (! file.exists(".myProfile.R")) {
stop("PANIC: profile file does not exist. Fix problem or ask for help.")
}
if (! exists("myStudentNumber")) {
stop("PANIC: profile data wasn't loaded. Fix problem or ask for help.")
}
2017-09-12 20:09:20 +00:00
2017-10-04 03:38:48 +00:00
# = 2 Suitable MYSPE Species ==============================================
2017-09-12 20:09:20 +00:00
2017-09-21 21:49:55 +00:00
# In this unit we will select one species from a list of genome sequenced fungi
# and write it into your personalized profile file. This species will be called
2017-10-04 03:38:48 +00:00
# "MYSPE" (Your Favourite Organism) for other learning units and exercises.
2017-09-12 20:09:20 +00:00
2017-09-21 21:49:55 +00:00
# A detailed description of the process of compiling the list of genome
2017-09-12 20:09:20 +00:00
# sequenced fungi with protein annotations and Mbp1 homologues is in the file
2017-10-23 16:37:09 +00:00
# ./scripts/ABC-makeMYSPElist.R
2017-09-21 21:49:55 +00:00
2017-10-23 16:37:09 +00:00
# Task: Study ./scripts/ABC-makeMYSPElist.R, it implements a typical workflow
# of selecting and combining data from public-domain data resources.
2017-09-21 21:49:55 +00:00
2017-10-04 03:38:48 +00:00
# = 3 Adopt "MYSPE" =======================================================
2017-09-21 21:49:55 +00:00
# In the code below, we load the resulting vector of species name, then pick one
# of them in a random but reproducible way, determined by your student number.
2017-09-12 20:09:20 +00:00
2017-10-04 03:38:48 +00:00
load("data/MYSPEspecies.RData") # load the species names
set.seed(myStudentNumber) # seed the random number generator
MYSPE <- sample(MYSPEspecies, 1) # pick a species at random
set.seed(NULL) # reset the random number generator
2017-09-12 20:09:20 +00:00
# write the result to your personalized profile data so we can use the result in
# other functions
2017-10-04 03:38:48 +00:00
cat(sprintf("MYSPE <- \"%s\"\n", MYSPE), file = ".myProfile.R", append = TRUE)
2017-09-12 20:09:20 +00:00
2017-10-04 03:38:48 +00:00
MYSPE # so, which species is it ... ?
biCode(MYSPE) # and what is it's "BiCode" ... ?
2017-09-12 20:09:20 +00:00
2017-09-21 21:49:55 +00:00
# Task: Note down the species name and its five letter label on your Student
# Wiki user page. Use this species whenever this or future assignments refer
# to MYSPE. In code, we will automatically load it from your .myProfile.R file.
2017-09-12 20:09:20 +00:00
# [END]