Bioconductor R/Example

From ScientificComputing
Jump to: navigation, search

As an example for using Bioconductor, we will compare two globally aligned strings and create a consensus matrix.

[leonhard@euler03 ~]$ module load gcc/4.8.2 bioconductor/3.0
Using OpenBLAS build of bioconductor R-3.0
[leonhard@euler03 ~]$ cat test.R 
library(Biostrings)
## Compare two globally aligned strings
string1 <- "ACTTCACCAGCTCCCTGGCGGTAAGTTGATC---AAAGG---AAACGCAAAGTTTTCAAG"
string2 <- "GTTTCACTACTTCCTTTCGGGTAAGTAAATATATAAATATATAAAAATATAATTTTCATC"
compareStrings(string1, string2)
## Create a consensus matrix
nw1 <-
pairwiseAlignment(AAStringSet(c("HLDNLKGTF", "HVDDMPNAL")), AAString("SMDDTEKMSMKL"),
substitutionMatrix = "BLOSUM50", gapOpening = 3, gapExtension = 1)
consensusMatrix(nw1)
[leonhard@euler03 ~]$ bsub -n 1 -W 4:00 -R "rusage[mem=2048]" "R --vanilla --slave < test.R > test.out"
Generic job.
Job <31331058> is submitted to queue <normal.4h>.
[leonhard@euler03 ~]$ bjobs
JOBID      USER        STAT  QUEUE      FROM_HOST   EXEC_HOST   JOB_NAME   SUBMIT_TIME
31331058   leonhard    PEND  normal.4h  euler03                 * test.out Nov  8 13:38
[leonhard@euler03 ~]$ bjobs
JOBID      USER        STAT  QUEUE      FROM_HOST   EXEC_HOST   JOB_NAME   SUBMIT_TIME
31331058   leonhard    RUN   normal.4h  euler03     e1442       * test.out Nov  8 13:38
[leonhard@euler03 ~]$ bjobs
No unfinished job found
[leonhard@euler03 ~]$ grep "[1]" lsf.o31331058
[1] "??TTCAC?A??TCC?T???GGTAAGT??AT?---AAA??---AAA???A?A?TTTTCA??"
  [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
-    0    0    0    0    2    2    2    1    1     0     0     0
A    0    0    0    0    0    0    0    0    0     0     1     0
D    0    0    2    1    0    0    0    0    0     0     0     0
F    0    0    0    0    0    0    0    0    0     0     0     1
K    0    0    0    0    0    0    0    0    0     0     1     0
L    0    1    0    0    0    0    0    0    0     1     0     1
M    0    0    0    0    0    0    0    1    0     0     0     0
N    0    0    0    1    0    0    0    0    0     1     0     0
P    0    0    0    0    0    0    0    0    1     0     0     0
V    0    1    0    0    0    0    0    0    0     0     0     0 

You can find more examples in the reference manuals of the corresponding Bioconductor packages.