User Tools

Site Tools


microbial_forensics

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
microbial_forensics [2021/10/05 12:17] – [분석과정(2) - distance matrix에서 확률 밀도 함수(pdf) 구하기] hyjeongmicrobial_forensics [2021/10/05 12:42] (current) – [plot_pdfs_from_distance_matrix.R 코드의 수정판] hyjeong
Line 33: Line 33:
  
 ===== plot_pdfs_from_distance_matrix.R 코드의 수정판 ===== ===== plot_pdfs_from_distance_matrix.R 코드의 수정판 =====
 +함수만 선언한 [[https://github.com/FOI-Bioinformatics/MicrobialForensics/blob/master/src/plot_pdfs_from_distance_matrix.R|원본 R 코드]]로는 plot이 잘 그려지지 않아서 약간의 수정을 가했습니다.
 +  * 함수 선언 전까지의 9줄은 데이터 파일을 읽어서 처리하기 위한 것입니다.
 +  * 함수의 default argument로 주어지는 lim 벡터는 원본(c(0.05,0.18))대로 하면 그림을 그릴 수 있는 범위를 벗어나기에 약간의 시행착오를 거쳐서 수정하였습니다.
 +  * Plot 파일의 이름과 형식은 eps가 아닌 pdf로 수정하였습니다.
 +  * ggplot()의 그림은 print() 함수를 실행하여 파일로 저장하도록 하였습니다. 원본 코드 그대로는 파일이 제대로 생기지 않았습니다. 아래의 코드를 사용하여 얻은 플롯을 첨부합니다({{ :df_dist.pdf |}}).
 +
   mat.org=read.table("selected_listeria_dist.csv",sep=",")   mat.org=read.table("selected_listeria_dist.csv",sep=",")
   dim(mat.org) # 148 x 148   dim(mat.org) # 148 x 148
Line 97: Line 103:
   }   }
      
 +  # 원본 R 코드는 바로 직전까지에 해당합니다. 실제 함수를 호출하기 위해 다음의 한 줄을 삽입했습니다.
   dat = plot_pdfs_from_distance_matrix(mat, index1)   dat = plot_pdfs_from_distance_matrix(mat, index1)
      
 +===== 앞으로 해결할 문제 ===== 
 +위의 코드를 실행하여 얻어진 분포(dat 데이터프레임으로 반환됨)를 kernel density estimation으로 처리하여 연속형 확률 분포와 유사하게 만드는 것이 바로 다음에 진행해야 할 일입니다. 구체적인 코드는 제시하지 않았습니다. 다음으로는 8개의 clinical sample에 대하여 다음의 likelihood ratio('evidential value')를 구하는 것입니다. 
 +{{ :lr.png?200 |}} 
 +이 수식으로 표현된 evidential value를 구하는 방법은 논문 5쪽 왼쪽단에 다음과 같이 기술하였습니다. 
 +  To calculate evidential values, the genetic distances from  
 +  sequences associated with facility 1 were calculated for the  
 +  sequences obtained from each patient, and the densities under  
 +  Hm and Ha were compared according to Eq. (4). For each distance,  
 +  a likelihood ratio was obtained from the PDFs and the average  
 +  likelihood ratio for each patient were reported. All the calculated  
 +  evidential values were strongly supportive or contradictive,  
 +  depending on the origin of each isolate (Table 1), and the  
 +  assignments of clinical samples to their respective sources were  
 +  fully consistent with the findings of Chen et al. [29].
microbial_forensics.1633403826.txt.gz · Last modified: by hyjeong