Saturday, July 24, 2010

chapter 5 (TCP 기반 서버 / 클라이언트 2)

앞에서 구현한 TCP 서버/ 클라이언트는 프로그래밍 관점에서만 공부한 것이다. 이는 TCP의 동작 방식을 고려 하지 않았는데 이번장을 통해 TCP의 이론적인 부분을 이해한다.

-에코 클라이언트의 완벽 구현-


왼쪽 echo_client.c를 보면 45~46의 코드를 보면 "read, write 함수가 호출될 때마다 문자열 단위로 실제 입출력이 이뤄진다"는 잘못된 가정이 있는 것을 알수 있다. 그러나 TCP는 연결 지향형으로 전송 데이터의 경계가 없다. 그렇기 때문에 한 데이터를 서버가 두 패킷에 나눠 보낼수도 있고 여러 문자열이 한 패킷에 올 수도 있다. 이 문제를 아래 echo_client2.c 에서 보듯이 write로 전송한 문자열의 길이만큰 read로 읽을때까지 반복하면 해결된다.


에코 클라이언트 이외의 경우에는? 에플리케이션 프로토콜의 정의 : 위의 경우는 수신할 데이터의 크기를 알 경우지만 일반적으로는 그렇지 않다. 이럴 때 필요한것이 어플리케이션 프로토콜.
어플리케이션 프로토콜이란? 클라이언트의 구현과정에서 만들어지는 약속

-TCP의 이론적인 이야기-
TCP 소켓의 생성에서 소멸과정을 크게 3단계로 나눌수 있다.
1.상대 소켓과의 연결 : Three-way handshaking (3번의 shaking에 걸쳐서 이루어진다. 호스트 A가 접속하고자 하는 호스트 B에 패킷을 보내고 B에서는 받은 패킷을 확인하면서 새로운 패킷을 보내고 다시 A가 B에서 온 패킷을 확인하는 과정)
2.상대 소켓과의 데이터 송수신 :
3.상대 소켓과의 연결 종료 : Four-way handshaking으로 호스트 A가 연결을 끊기 위한 패킷을 보내면 호스트 B에서 응답 패킷을 보내고 B에서 다시 한번 종료 패킷을 보내면 A에서는 그 패킷을 보고 연결을 종료한다.

Thursday, July 22, 2010

Tuesday, July 20, 2010

chapter 4 (TCP 기반 서버/ 클라이언트 1)

앞서 소켓의 생성과 생성된 소켓에 주소 할당을 알아보았다. 이번에는 연결지향형 소켓을 중심으로 데이터 송수신방법에 대해 살펴보도록 한다.

-TCP와 UDP에 대한 이해-
TCP 소켓 : 프로토콜 체계는 IPv4인 PF_INET 이고 데이터 전송 방식은 연결지향형인 SOCK_STREAM인 유일한 소켓.

TCP/IP 프로토콜 스택 : 오른쪽 그림에서와 같이 4개의 계층으로 나뉘다. 이는 '인터넷 기반의 효율적인 데이터 전송' 이라는 문제를 하나의 큰프로토콜로 해결하려는 것이 아니라 작은 문제로 나눠서 효율적으로 풀기 위한것으로 표준화 작업을 통한 개방형 시스템 설계의 장점을 가진다.

LINK 계층 : 물리적 영역의 표준화로 LAN과 같은 네트워크 표준과 관련된 프로토콜을 정의하는 영역

IP 계층 : 목적지로 데이터를 전송하기 위해서 어떤 경로를 거쳐갈지를 해결하는 것이 IP 계층이고 이 계층에서 사용하는 프로토콜이 IP(internet protocol) 이다. 비연결지향적이며 데이터 손실이 있을 수 있어 신뢰할만한 프로토콜이 아니다.

TCP/UDP 계층 : IP계층에서 데이터 전송을 위한 경로를 알려주면 이를 바탕으로 실제 데이터 송수신을 담당하는 것이 TCP/UDP 경로이고 TCP가 상대적으로 복잡하다. IP 자체는 신뢰할만하지 않기 때문에 TCP 를 통해서 데이터 전송의 성공 확인을 하면서 안정적인 데이터 전송이 가능해 진다.

APPLICATION 계층 : 위의 과정은 소켓이라는 것 하나에 감춰져 있기에 프로그래머들이 자유로워 지는데 이러한 소켓이라는 도구를 사용하여 프로그램의 성격에 데이터 송수신에 대한 규칙을 APPLICATION 프로토콜이라 한다.


-TCP기반 서버, 클라이언트 구현-

TCP 서버에서의 기본적인 함수호출 순서 : socket(소켓 생성) -> bind(소켓 주소 할당) -> listen(연결 요청 대기 상태) -> accept(연결허용) -> read/write(데이터 송수신) -> close(연결종료)

함수의 매개변수와 return 형은 그림 참조

연결요청 대기상태로의 진입 : listen 함수가 호출되어야 클라이언트에 connect 함수가 호출될 수 있다.
매개인자 sock 은 '연결요청 대기상태'(클라이언트가 연결요청을 했을 때 연결 수락까지 요청을 대시시킬수 있는 상태)에 두고자 하는 소켓의 파일 디스크립터, backlog는 '연결 요청 대기 queue'의 크기 정보로 backlog를 5로 하였으면 클라이언트의 연결요청을 5개까지 대기 시킬수 있게 된다.

정리하자면 socket 함수로 생성된 소켓이 listen함수에 의해 문지기 소켓(서버 소켓)이 되어 banklog 만큼의 크기로 대기실을 만들고 이러한 상태가 되면 이를 '연결 요청 대기 상태'라고 한다.

클라이언트의 연결요청 수락 : socket 함수에 의해 만들어진 소켓은 listen함수에 의해 서버소켓이 되고 클라이언트의 연결요청을 대기시킨다. 이러한 대기중인 클라이언트와 데이터를 주고 받을 소켓이 하나 더 필요하다. 이는 accept 함수를 호출함으로서 소켓이 만들어 지고 이 소켓은 대기중인 클라이언트 소켓과 자동으로 연결된다.
 accept 함수의 매개변수는 bind 함수와 같으나 주소정보인 addr 은 bind에서 서버 자신의 주소아지만 accept에서는 연결요청 한 클라이언트의 주소정보이다. 또한 마지막 매개변수인 addrlen은 주소의 변수의 크기를 다른 변수에 저장한 뒤  그 변수의 주소 값을 전달해야 한다.

TCP 클라이언트의 기본적인 함수호출 순서 : 다음은 클라이언트의 구현 순서이다. socket(소켓생성) - > connect(연결요청) -> read/write(데이터 송수신) -> close(연결종료)

connect의 매개변수 중 sockdf 는 클라이언 소켓의 파일 디스크립터, servaddr은 연결요청을 하고자하는 서버의 주소 정보, addrlen은 주소의 변수 길이로 크기 정보를 변수에 저장한다음 그 변수의 주소를 넘겨야 한다.
connect함수의 return은 서버의 listen함수에 의해 대기 큐에 등록되거나 오류에 의한 연결중단이 되었을때 반환된다.
서버구현시 bind를 통해 소켓에 자기 자신의 IP와 PORT를 할당하였는데 클라이언트 구현시 이점이 생략되어 있다. 이는 connect 함수가 호출될때 운영체제(커널)에 의해 자신에게 할당된 IP와 임의의 PORT를 할당해서 생략되어지는 것이다.


-Iterative 기반의 서버, 클라이언트 구현-
에코서버와 에코 클라이언트를 구현하고자 한다. 에코 서버는 클라이언트가 전송하는 문자열 데이터를 그대로 재전송하는 서버이다.

Iterative 서버의 구현 : 오른쪽 그림과 같은 서버의 형식이 iterative 서버이며 이는 한번에 하나의 클라이언트에게만 서비스가 가능하다. 동시에 여러 클라이언트를 상대하기 위해서는 프로세스쓰레드의 개념을 알아야 한다.

이부분은 코드 위주이므로 책을 참조한다.

Monday, July 19, 2010

De novo assembly of a 40 Mb Eukaryotic Genome from Short Sequence Reads: Sordaria macrospora, a Model Organism for Fungal Morphogenesis

To see the most recent de novo assembly paper, I found this paper(http://www.plosgenetics.org/article/info:doi/10.1371/journal.pgen.1000891). I will just focus on genomic assembly part in this paper.


They use solexa and FLX data. They produce a single and two paired-end data of different insert size libraries from solexa and single read from FLX. The amount of data showed in figures. A little bit doubtful point is the amount of read is too small compared with my data. This maybe come from the difference of version of solexa.

assembly process


The assembly process is simple. They assembled the total raw data from both system and contig from FLX data with Velvet. They said that FLX data reduced the gaps in contigs and addition of paired-end data improved N50 size.



confirmation of assembly


Checking the existence of synteny block between draft genome and closed species. Predicted protein from draft genome mapped to relatively closed species.

Genomic Analysis of Organismal Complexity in the Multicellular Green Alga Volvox carteri

I choose this paper for reporting in full, because 
1. this is published in science (what I feel in these days is that science is the most hard  journal to understand exactly, this means that the paper in this journal compress enormous knowledge, so this make me study a lot),
2. this paper contain de novo assembly, so I want to find how they do that and confirm the assemly,
3. they compare two relative species, 
All of these reasons are the factors that make me feel this paper can be my role model paper. 


Saturday, July 17, 2010

AHEAD(the Alliance for Human Epigenomics and Disease)

I found from last paper that Epigenome Project is continued by AHEAD. In this post, I will introduce the article about AHEAD which is published in Nature.  Ah.. the funny thing is.. when I was googling about AHEAD, I found that  Prof, Young-Joon Kim presented his research in AHEAD conference in last year.


The title of article which will be introduced is "Moving AHEAD with an international human epigenome project". This was published on August in 2008.

A plan to 'genomicize' epigenomics research and pave the way for breakthroughs in the prevention, diagnosis and treatment of human disease.


here we discuss the benefits of the AHEAD frame work to coordinate and plan an international Human Epigenome Project.

Epigenetic mechanisms : histone modification, positioning of histone variants, nucleosome remodelling, DNA methylation, small and non-coding RNAs. These things interact with transcription factor or other protein to regulate target gene expression.
epigenetic mechanisms are recognized as being involved disease.
although this mechanisms have heritable characteristics, drug can reverse them.
So more comprehensive characterization of them is needed to maximize utility of them in treatment of disease.
the goal of AHEAD project is provide high-resolution reference epigenome maps.
an international project would provide the bioinformatics tool.

-Early steps- 

About from 2004 global movements were appeared to organize the international community.
In Europe, strong tradition for epigenetic study supported by European Union funding programmes or individual national initiatives. more than US $79M was supported to DNA methylation(HEP, Human Epigenome Project), chromatin profiling(HEROIC,High-Throughput Epigenetic Regulatory Organization In Chromatin) and treatment of neoplastic disease(EPITRON, EPIgenetic TReatment Of Neoplastic disease). The special function is provided by the NoE(Epigenome Network of Excellence).
In U.S. 2004 NCI(international cancer institute)-sponsored Epigenetic Mechanisms in Cancer Think Tank, 2005 NCI workshop, AACR(The Ametican Association for Cancer Research) organized a Human Epigenome Workshop in 2005, 2006.
On the heels of these workshop AACR Human Epigenome Task Force was formed to design strategy and develop a timetable for the implementation of an international Human Epigenome Project. This task force recommended the formation of AHEAD to coordinate a transdisciplinary, international project.


In summary, each country (EU, US) organize and develop their own community and project. And after Human peigenome workshop from AACR, AACR Human Epigenome Task Force was formed and they made AHEAD, internation project to map a defined subject of robust epigenetic makers and support bioinformatics infrastructure.


-The scope of AHEAD-


1.provide complete epigenome maps at very high resolution for important histone modifications across diverse cellular states in both human and mouse
2.complete and catalogue epigenome maps of model yeasts, plants, and animals
3.deliver a high resolution DNA methylation map of the entire human genome in defined cell types and a landmark map for transcription start sites of all protein coding genes and a representative number of other features throughout the genome
4.define non-coding and small RNAs
5.establish a bioinformatics platform including a relational database, website and suite of analytic tools to organize, intergrate and display whole epigenomic data on model organisms and humans.
AHEAD differ from and complement ENCODE(ENCyclopedia Of DNA Elements).
ENCODE is focused on defining the functional sequences in the genome.
AHEAD define the patterns of epigenetic regulation at that sequences.


-Reference epignomes-

The criteria for selection of the reference system:
1.cells should be easy to sample in a reporoducible fashion.
2.cell numbers should be sufficient for analyses of DNA methylation and chromatin modifications.
3.cell progenitors should be identified that can be suitably manipulated and harvested in a pure state.
4.where possible, cells should be amenable to tissue reconstruction and three-dimensional model systems
5.systems must provide insight into key differentiation and related disease states.


-Advances in technology-
there is nothing new, so I just skip this part

-Model organisms-



-Computational challenges-
A central relational database and a web interface which include analytic and statistical tools to present and visualize data are needed.

pseudo gene

I felt the need to clarify about pseudo gene while I organized an annotation of zymo. Therefore in this post I will review about pseudo gene, what it is and how it was happened.
All information comes from  http://en.wikipedia.org/wiki/Pseudogene


Pseudogene : non-expressed or defunctional relatives of known gene (homology to a known gene, nonfunctionality).
1.homology to a known gene : usually sequence identity is between 40% and 100%.
2.nonfunctionality : if any one of the common processes, which are needed in making functional product from DNA, such as transcription and pre-mRNA processing fails, this will be nonfunctional. In high-throughput psudogene identification, modification of stop codon and frameshifts are the most common factors.


Types and origin of pseudogenes


1. Processed (retrptransposed) pseudogenes : retrotransposition event is common in mammals and in case of human 30%~44% of genome is composed of this. In retrotransposition, mRNA transcript of a gene is reverse transcribed back into DNA become pseudogene. This kind of pseudogene have features of cDNA like poly-A tail, introns spliced out and lack of promoter.

2. Non-processed pseudogenes : Through gene duplication A copy of gene is made and subsequent mutation make them as pseudogene. This kind of pseudogene have the most feature of genes.


3. Disable genes (unitary pseudogene) : same mechanism (i.e. mutation) which make non-processed pseudogene happened to genes without duplication and became fixed in population.