O'Connor-Chung submission#2
Conversation
|
|
||
| rm *.hmm | ||
|
|
||
| cat *.tbl | grep -v "#" | awk '{print $1 = substr($1, length($1)-3, length($1)), $3, $5}' > hmmOut.txt |
There was a problem hiding this comment.
Very efficient and generalizable! nice!
| } | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
good job. another approach could be:
There was a problem hiding this comment.
library(stringr)
inFile=scan("motifsort.fasta",sep="\n",what=character())
motif1=file("motif1.fasta",open="w")
motif2=file("motif2.fasta",open="w")
other=file("nomotif.fasta",open="w")
for(i in 1:length(inFile)){
if(str_detect(inFile[i],">")){
seqID=inFile[i]
}else{
if(str_detect(inFile[i],"AKKPRVZE")){
writeLines(seqID,motif1)
writeLines(inFile[i],motif1)
}else if(str_detect(inFile[i],"AAQWWRNYGG")){
writeLines(seqID,motif2)
writeLines(inFile[i],motif2)
}else{
writeLines(seqID,other)
writeLines(inFile[i],other)
}
}
}
close(motif1)
close(motif2)
close(other)
No description provided.