[Lab] awk, grep, wc and sed

grep 그리고 wc 는 자주 쓰니까 다 잘 알고 있다고 생각 합니다. 예를 들어

  • grep ATGC my.fasta : 이건 my.fasta안에서 ATGC가 있는 모든 줄을 표시 합니다
  • grep -c ATGC my.fasta : 이건 my.fasta안에서 ATGC가 있는 줄이 몇 줄인지 알려줍니다
  • wc -l  my.count_table : 이건 my.count_table안에 몇 줄이 있는지 알려줍니다, 따라서 1을 빼면 unique sequence 수를 알 수 있고 “grep -c ‘>’ my.fasta 와 동일 한 숫자가 나와야합니다

다음은 awk 입니다. 아주 좋은 command인데 생각 보다 많은 사람들이 쓰지 않고 Excel로 처리 하고 있는데 awk가 더 편합니다 awk는 “행” 말고 “열”을 표시 할때 사용 합니다. 예를 들며 column5개 있는 excel 데이터를 메모장에 copy paste 해서 a.txt 랑 이름으로 저장 해서 3번째 column만 보여주고 싶으면 1 command. 2번째가 0.05 이하인 경우 5번째 표시 하고싶으면 2 command. 3번째 column, 4번째 column을 표시 하고 싶고 사이사이를 <tab>으로 separation표시 할려면 3command

  1. awk ‘{print $3}’ a.txt
  2. awk ‘{if($2<0.05) print $5}’ a.txt
  3. awk ‘{print $3″\t”$4}’ a.txt

다음은 sed 라고 하는 command 인데 sed는 문자를 치환 해줍니다. 예를 들어 a.txt랑 메모장에 ABcDEFG 라고 있는데 그걸 ABCDEFG로 수정 해서 b.txt에 저장 하고싶다면 command 1처럼 실행 하면 c를 C로 치환 해줍니다. 모든 줄에 적용 됩니다. 하지만 첫번째 c만 치환 해주고 같은 줄에 한번 더 c가 있으면 치환 안해줍니다. 한줄에 있는 모든 c를 C로 치환을 원한다면 g를 추가 하시면 됩니다 (command 2)

  1. sed ‘s/c/C/’ a.txt >b.txt
  2. sed ‘s/c/C/g’ a.txt >b.txt

[Lab]How to run mothur on sari server

You can watch this instead : How to run mothur on sari.jejunu.ac.kr

Make a text file with two columns for zip file name and sample name, like below.

Screen Shot 2019-12-23 at 9.31.01 AM.png

copy this file to sari server by typing

Screen Shot 2019-12-23 at 9.32.21 AM.png

login to sari server with miseq ID like below

Screen Shot 2019-12-23 at 9.33.11 AM.png

go to work directory (cd work) and execute batch.sh like belowScreen Shot 2019-12-23 at 9.35.29 AM.png

your_email@gmail.com => your email address

unno => your user name

constipation => your experiment name (must be 1 word)

When mothur is finished, you will receive email notice

[Lab] Old MiSeq data

I tried a few tests today. I ran mothur to analyze old data generated in 2015 April. I am not sure how we used to prepare MiSeq samples but reads were not aligned as expected. I used full length silve V. 128 to align the reads, which was aligned starting from 13862-23444, while recent data are usually aligned 11895-25318 regardless of which sequencing company generated the data. My guess is the old MiSeq data in our Lab does not have primer sequences. So please be careful if you are using batch file when you analyze old data set.

Screen Shot 2019-12-19 at 12.41.32 PM.png