Friday, April 1, 2011

iphone 개발 수업 4주차

4/1
<UI table view>
보통 서버에서 UI table view 의 리스트를 10~20 정도씩 받아온다(한꺼번에 다 받아 오는게 아니라).  그리고 아이폰은 터치해서 리스트 스크롤을 올리면 윗 셀이 없어지고 아래 셀이 생기는데, 이것은 없어지는 셀이 재사용 큐에 들어갔다가 내용이 바뀌어서 다시 UI table view 에 보이는 것이다. 그런데 table view에 여러개의 섹션이 있을때 각 섹션에서 없어지는 셀이 재사용큐에 들어갔다가 다시 재사용되는데 이때 어떻게 셀들을 구분하느냐, 식별자를 이용해서 이를 구별한다.
--------------------------------------------------------------------------------------------------


<Navigation 기반 application의 구조(World photos 예) > 
WorldPhotosAppDelegate ; 시스템 이벤트를 처리
   UINavigationController *navigationController; 화면 전환하는 객체(화면을 구성(backButton(혹은 leftButton), text, rightButton(이를 UINavigationBar라 함) 과 View가 있다), stack을 가지고 있어서 그 안에 UIviewController들이 있다. 이중에 하나를 선택헤서 View에 나타냄)


RootViewController ; RootViewController 객체가 생기면 RootViewController.xib xml에 안에 있는 내용을 나타냄(이벤트도 관리) , 이것이 첫 화면인데 이는 navigationController 의 stack에 첫화면으로 저장되어 있어서 이를 view 에 나타내기 때문이다.


RootViewController 의 UINavigationItem ; UINavigation Bar의 내용 설정, RootViewController가 이를 속성으로 가지고 있다.


PhotoDetailViewController ; photoDetailViewController.xib 이름의 xml 파일(이것은 interface builder로 만듬)의 객체를 생성하고 그 화면의 이벤트를 처리.


PhotoDetailViewController 의 UINavigationItem ; UINavigation Bar의 내용 설정


%%WorldPhotosAppDelegate와 navigationController는 RootViewController와 PhotoDetailViewController 에 의해 공유된다.%%
%%[[UIApplication sharedApplication]delegate]; 하면 UIApplication에서 공유하고 있는 것중 delegate를 return, 그러니까 WorldPhotosAppDelegate 를  return.%%


처음 시작하면 navigationController stack에는 RootViewController만이 들어 있다. 그래서 그것이 화면에 보이게 됨. RootViewController의 didSelectRowAtIndexPath 메소드 안에서 [self.navigationController pushViewController:detailViewController animated:YES]; 처럼 공유하고 있는 navigationController의 pushViewController메소드를 이용해서 화면에 보이고자하는 viewController, 즉 여기서는 detailViewController를 stack에 넣어서 화면 전환이 일어나게 한다(animated 는 화면을 자연스럽게 바꿀것인지, 아니면 확 바꿀 것이지를 나타냄). 이렇게 해서 detailViewController가 화면에 나타나게 되는데 이때는 UInavigation Bar 에는 backButton이 생기는데(RootViewController 화면에서는 이 버튼이 없다, 첫화면이라) 이 버튼을 누르면 다시 뒤 화면, 즉 RootViewController의 화면이 나타나게 되는데 이는  [self.navigationController [popViewController]]; 를 실행해서 stack 안에 detailViewController를 제거했기때문이다.

EstimateS and something others

두가지에 막혀 있다. 어쩌면 세가지. 하나는 taxonomic rank에 대한 이해가 부족하다. rank term. 어떤건 kingdom, phylum, class, order등의 정보가 다 있는데, 어떤건 그러하지 않고, 그러하지 않는건지 아니면 내가 그 tern을 제대로 특정 rank에 놓지 못한것이지도 판단이 되지 않는다. 다른 하나는 통계학적 접근. 다른 하나는 aligner에 대한 것. 어찌보면 핵심부에 속하는 것들에 지금 막혀있다. 힘빠져.
하나씩 해야지. 이번에 통계적인 것에 대한 내용을 들여다 보려 한다. 시작은 EstimatS라는 프로그램의 설명부터 해서 species richness, 그리고 두 community 간에 shared species를 계산하는 논문까지(항상 그렇듯 계획은 좋다. 시작은 창대하나 끝이 미약해서..).

<EstimateS>
http://viceroy.eeb.uconn.edu/EstimateSPages/AboutEstimateS.htm
일단 뭔지는 모르나 EstimateS가 하는 일부터 알아보자. 


-rarefaction and species accumulation curves
일단은 expected spcies accumulation curves(=sample-based rarefaction curve)를 구한단다. 이건 resampling technique이 아니라네. 그리고 individual-based rarefaction curves를 구한다.


-species richness estimators and diversity indices
non-parametric species richness를 구한다. 그런데 sample-based data와 abundance-based data에 대해서. 음.. log-linear confidence interval을 구한다. sample-based rarefaction curve의 aymptotic function에 기초한 species richness estimator를 구한다.


-shared species estimation and biotic similarity indices, with estimators
sample pairs에 대해 Chao's estimator of total shared species를 구한다.




아.. 전혀 알아들을수 없다. 좀더 자세한 user guide를 봐보자.
http://viceroy.eeb.uconn.edu/EstimateSPages/EstSUsersGuide/EstimateSUsersGuide.htm

-Introduction
일단 용어 정리부터 한다. 
sample 이라 함은 특정 지역, 면적, 내지는 시간 단위의 list of species 또는 OTU를 의미. 
species abundance data(=abundance data)는 counts로 sample 안에 각 species의 counts, 즉 수를 의미.
incidence data라 함은 presence/absence(=occurrence) data 으로 sample 안에 각 species가 있냐 없냐를 의미하는 데이터. 
마지막 말은 좀 이해 안되네. abundance data랑 summed incidence data랑 같은거 아닌가. summed incidence data가 frequencies of occurence 라면 어짜피 count인데.. 요건 음 패스. 여튼 이로써 뭐에 대해 뭘 구한다라는 말에서 뭐에 대해가 좀 이해가 되는듯.
아 이 뒤의 내용은 아무래도 Gotelli & Colwell (2001) 를 봐야 할거 같아서 급선회 한다.


<Quantifying biodiversity: procedures and pigfalls in the measurement and comparison of species richness>
-Taxon sampling curves
species richness가 중요한 measurement이긴 한데 정확히 측정하기 어렵다. 왜? 다양한 taxa가 있는 곳에서는 sampling을 많이 할수록 species가 많은걸로 나올테니까.
근데 speices 
taxon sampling curve를 4가지로 분류. 기준은 1. sampling protocol(individual-based 냐 sample based냐), 과 2. accumulation curves냐 rarefaction curves냐 .
첫번째 기준의 individual based라 함은 그냥 두특정 locality의 species를 비교할때 individual based 방식은 특정 locality에서 랜덤하게 sampling해서 species를 카운트 하는것이고 sample based는 특정 locality를 quadrat으로 구획해서 나눠진 quadrat중 계산되어진  quadrat의 species를 축적해서 더하는것. 
두번째 기준의 accumulation curve는 말그대로 데이터 collection과정중에 생기는 species 값을 축적해서 curve를 그리는것. 반면 rarefaction curve는 1부터 N 까지 random sampling을 반복적으로 해서 나오는 average species count를 그린것.
accumulation curve는 왼쪽에서 오른쪽으로, 반면에 rarefaction curve 오른쪽에서 왼쪽으로 그려지는데. 이는 rarefaction curve가 accumulation curve의 right end를 기준으로 sampling 사이즈를 변화하면서 반복적으로 sampling해서 나온 average species count를 기록하기 때문. 
그리고 sample-based curve가 individual-based curve보다 아래 있는데 이는 spatial or temporal autocorrelation 에 의한것.


-Comparing assemblages using taxon sampling curves
두 communities가 측정된 species richness가 다를수 있는데, 이는 진짜 생물학적으로다가 다를 수도 있는것이고 아니면 sampling effort나 condition의 차이에 의한 것일수도 있다. 그렇기에 그냥 raw taxon count를 비교하는건 문제가 있다.
만약 accumulation curves가 asymptote에 닿으면 raw count를 비교하는게 의미 있을수도 있으나 거의 그럴 일은 없다. 그러나 appropriate scaling을 통해서 accumulation curve를 비교하는게 가능. individual-based dataset의 경우 현실적인 문제(individual을 조사할때 보통 순서 까지 recording 하지 않기 때문)에서 accumulation curve를 구하는것이 문제가 있는데 이럴땐 rarefaction 을 이용.   individual의 경우 individual-based rarefraction만 사용 가능.하지만 sample-bassed 데이터의 경우 individual-based, sample-based rarefraction을 둘다 사용가능. 근데 sample-based을 사용(patchiness 때문에 individual-based rarefaction은 overestimate된다). sample-based rarefaction curve를 사용한다고 하더라도 taxa의 수를 plot 할 때는 individual의 accumulate의 수로 해야 한다(sample당 individual의 갯수가 다르므로).




-Computing rarefaction curves
1.individual-based rarefaction
randomize를 위한 re-sampling 말고 combinatoric theory에 근거한 mathematical expression이 있다. Sanders이야기 하는데 여튼 이건 틀린거고 hypergeometric sampling distribution에 근거한 derivation model이 있다. 그리고 Coleman의 random placement curve를 이용하면 빠른 계산이 가능하다
2.sample-based rarefaction


-Category-subcategory ratios and their pitfalls
1.individuals and species
2.species and genera


-Species richness VS. species density


-Asymptotic estimators of species richness

http://www.vsni.co.uk/products/genstat/htmlhelp/ecology/AccumulationCurve.htm
그럼 species accumulation curve는 어따 쓰냐? species richness를 추정하는데 사용한다. asymptotic line이 species richness가 되는건가.. 
그리고 rarefaction이라 함은 sampling effect가 특정 level까지 떨어질때의 species의 갯수를 추정하는데 사용하는 method.