Skip to content

O'Connor-Chung submission#2

Open
henrichung wants to merge 2 commits into
araiho:masterfrom
koconn23:master
Open

O'Connor-Chung submission#2
henrichung wants to merge 2 commits into
araiho:masterfrom
koconn23:master

Conversation

@henrichung

Copy link
Copy Markdown

No description provided.

@araiho araiho left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good job! 4/4

Comment thread Exercise11_1.R

rm *.hmm

cat *.tbl | grep -v "#" | awk '{print $1 = substr($1, length($1)-3, length($1)), $3, $5}' > hmmOut.txt

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very efficient and generalizable! nice!

Comment thread Exercise11_2.R
}
}
}
}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good job. another approach could be:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants