Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 1 - Hill fitting 폴더에 포함된 IC50_mcmc.R 코드경로 및 컴파일 에러 #3

Open
shanmdphd opened this issue Apr 23, 2020 · 2 comments
Assignees
Labels
good first issue Good for newcomers question Further information is requested

Comments

@shanmdphd
Copy link
Member

shanmdphd commented Apr 23, 2020

Issue 1 - Hill fitting 폴더에 포함된 IC50_mcmc.R 코드경로 및 컴파일 에러

1. 데이터 경로 설정 문제

# read in patch clamp data
datadf<-read.csv(datafile)
datadf<-datadf[datadf$drug==drug,]
datadf<-datadf[with(datadf,order(drug,conc,channel)),]

2. IC50_mcmc.R을 컴파일을 한 후 발생하는 에러

[Error example 1]
-에러와 관련된 R 코드 부분

#--- required argument
if(is.null(args$drug)) stop("Missing drug argument!")
drug<-args$drug
   - 컴파일 결과
   > #--- required argument
   > if(is.null(args$drug)) stop("Missing drug argument!")
      에러: Missing drug argument!
    > drug<-args$drug

[Error example 2]
-에러와 관련된 R 코드 부분

# save samples to table
drugdir<-sprintf("results/%s/",drug)
system(paste0("mkdir -p ",drugdir))
   -컴파일 결과 발생하는 에러
   > # save samples to table
   > drugdir<-sprintf("results/%s/",drug)
   > system(paste0("mkdir -p ",drugdir))
     /Rtools/bin/mkdir: missing operand
   Try '/Rtools/bin/mkdir --help' for more information.
   [1] 1

문의사항

  1. 데이터 경로 설정 문제 :
    • datadf<-read.csv(datafile)라고 나타내고 있지만, datafile 경로에 어떤 파일을 포함해야 하는지 모르겠습니다. 명확한 파일명을 알려주셨으면 합니다.
  2. IC50_mcmc.R을 컴파일을 한 후 발생하는 에러 문제:
    • 위에서 언급한 '2. [Error example 1]과 [Error example 2]' 부분과 관련한 에러는 read.csv(datafile)에 명확한 데이터 경로를 제시하지 않아 발생한 에러인 것 같습니다. 만약 문제가 다른 원인에 있다면, 해결방법을 알려주시기를 부탁드립니다.

Originally posted by @platanus-study in #1 (comment)

@shanmdphd
Copy link
Member Author

shanmdphd commented Apr 23, 2020

@platanus-study 선생님,
질문 올려주셔서 감사합니다. #1 의 댓글로 달려져 있어 새로 이슈를 생성하였습니다.

https://github.com/FDA/CiPA/blob/master/Hill_fitting/README.md 를 읽어보십시오. 또한 https://github.com/FDA/CiPA/blob/master/Hill_fitting/run_IC50_mcmc.sh 파일의 16번 줄의 코드가 힌트가 될 수 있습니다. 즉 R 파일을 자체로 실행하는게 아니라 shell (cmd)에서 Rscript 를 사용해서 실행되게 되어 있습니다. 이는 CiPA의 모든 R 파일이 공통적으로 갖고 있는 방식입니다. R파일은 shell에서 몇가지 argument를 가져야만 온전히 실행가능합니다.

답변: Rstudio terminal 에서 다음과 같이 실행해보세요.

mkdir logfiles
Rscript IC50_mcmc.R -d cisapride > logfiles/cisapride

image

위 코드의 의미는 "1) logfiles 이름의 하위 디렉토리를 만들고, 2) -d argument로 cisapride를 입력하여 IC50_mcmc.R를 실행한 뒤 중간에 나오는 출력물을 logfiles/cisapride에 저장하라" 는 의미입니다. 코드 실행 후 logfiles 디렉토리를 열면 cisapride 파일이 생성되어 있습니다. 내용은 아래와 같습니다.

cisapride의 농도별, 채널별 block data는 어디서 가져오는건지 의문이 들 수 있는데,
data/drug_block.csv 에서 가져오게 됩니다. 만일 자신이 실험한 값을 쓰고자 한다면 유사한 형태의 파일을 만들고 -f argument를 사용해 경로를 지정해 줍니다.

R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=Korean_Korea.949  LC_CTYPE=Korean_Korea.949   
[3] LC_MONETARY=Korean_Korea.949 LC_NUMERIC=C                
[5] LC_TIME=Korean_Korea.949    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] FME_1.3.6.1     coda_0.19-3     rootSolve_1.8.2 deSolve_1.28   
[5] optparse_1.6.6 

loaded via a namespace (and not attached):
[1] minqa_1.2.4      MASS_7.3-51.5    compiler_3.6.3   Rcpp_1.0.4.6    
[5] getopt_1.20.3    grid_3.6.3       minpack.lm_1.2-1 lattice_0.20-41 
[1] 0
[1] 0
[1] "cisapride, hERG channel"

Parameters:
          Estimate Std. Error t value Pr(>|t|)    
log10IC50  1.05205    0.08415  12.502 6.57e-11 ***
h          0.62098    0.07511   8.267 6.99e-08 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 10.2 on 20 degrees of freedom

Parameter correlation:
          log10IC50        h
log10IC50   1.00000 -0.07151
h          -0.07151  1.00000
number of accepted runs: 25663 out of 30000 (85.54333%) 
      log10IC50          h var_model
mean 1.04936356 0.64013792 104.32230
sd   0.08813762 0.08744411  23.77717
min  0.73322649 0.40996348  53.04595
max  1.34196241 1.20270017 202.43168
q025 0.99050839 0.57973714  87.64366
q050 1.04523909 0.63118630 100.92294
q075 1.10754379 0.69063019 117.26204
[1] "cisapride, ICaL channel"

Parameters:
          Estimate Std. Error t value Pr(>|t|)
log10IC50   6.9669     6.2700   1.111    0.293
h           0.4261     0.5191   0.821    0.431

Residual standard error: 0.9055 on 10 degrees of freedom

Parameter correlation:
          log10IC50       h
log10IC50    1.0000 -0.9962
h           -0.9962  1.0000
number of accepted runs: 15082 out of 30000 (50.27333%) 
     log10IC50        h var_model
mean  6.014778 4.832520 0.8649787
sd    2.242236 2.977291 0.2784697
min   2.309271 0.258822 0.3510731
max   9.999050 9.997047 2.3316762
q025  4.027632 2.081875 0.6706486
q050  5.995384 4.763502 0.8139247
q075  7.928539 7.484341 0.9857648
[1] "cisapride, IK1 channel"

Parameters:
          Estimate Std. Error t value Pr(>|t|)
log10IC50   4.4696     2.6990   1.656    0.129
h           0.5133     0.5304   0.968    0.356

Residual standard error: 5.261 on 10 degrees of freedom

Parameter correlation:
          log10IC50      h
log10IC50     1.000 -0.988
h            -0.988  1.000

또한 results/cisapride 디렉토리를 보시면 여러개의 rds 파일이 생성되어 있습니다. 필요한 경우 R에서 load하여 2000회의 MCMC 시뮬레이션 된 원자료를 사용할 수 있습니다.

image

@shanmdphd shanmdphd added the good first issue Good for newcomers label Apr 23, 2020
@shanmdphd
Copy link
Member Author

한개의 약물(위에서 cisapride)이 아닌 12개 모두에 대해 실행하고 싶으면 아래 코드를 실행하세요.

sh run_IC50_mcmc.sh

image

@shanmdphd shanmdphd added the question Further information is requested label Apr 23, 2020
@shanmdphd shanmdphd self-assigned this Apr 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant