forked from araiho/Intro_Biocomp_ND_317_Tutorial11
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProblem2Attempt
More file actions
43 lines (28 loc) · 1.05 KB
/
Copy pathProblem2Attempt
File metadata and controls
43 lines (28 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
## Problem 2 ##
#Load Libraries
library(regexr)
#Reading data into an object
readData=scan(file="motifsort.fasta", what = "charecter")
#Convert object to a vector
vectorData=data.frame(readData)
#Create output files
file.create("motif1")
file.create("motif2")
file.create("unknown")
#for loop filtering out sequence desgination lines
for (i in vectorData[,1]){
}
#for loop to search for motifs and sort
for(i in data[,1]){
if(grepl("AKKPRVZE", data[i,1])){
write(data[i,1], file = "motif1", append = TRUE)
} else {if (grepl("AAQWWRNYGG", data[i,1])){
write(data[i,1], file = "motif2", append = TRUE)
} else { if (!grepl("sequence", data[i,1])){
write(data[i,1], file = "unknown", append = TRUE)
}}
}}
#attempts to add the sequence number in front of the sequences sorted into the different motif files (these are removed from the if loop to try and troubleshoot)
write(data[(i-1),1], file = "motif1", append= TRUE)
write(data[(i-1),1], file = "motif2", append= TRUE)
write(data[(i-1),1], file = "unknown", append= TRUE)