Answers.Body: <p>In your <code>dataset2 = list()</code>, the MAF argument should be <code>MAF=2_subset[,12]</code> instead of <code>MAF=1_subset[,12]</code>. Since your two datasets have different numbers of lines, this is what causes the error.</p>
  
  <p>I am not sure whether this is a typo in your code, or it is because you do not have MAF information in the second dataset. What I like to do before COLOC is to filter two datasets so they have the same number of lines, and then feed those filtered datasets to the coloc function.</p>
  
  <p>(Also just out of curiosity, is <code>1_subset</code> a data frame for your GWAS results? I think it is not recommended to have variable names starting with a number.)</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-05T18:04:08.607Z
Answers.Text: Thank you for your reply. That is really kind. I dont have MAF for dataset two so used dataset 1 for both. I will try the filter function and then maybe input MAF detail first onto the second dataset using 1st dataset. I did change the names, didnt want to use the disease names on forum. Thank you for double checking! Have a safe day, kind regards!
Answers.UserDisplayName: Ruth Johnson
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-04T13:16:17.567Z
Answers.LastActivityDate: 2020-04-04T13:16:17.567Z
Answers.UserDisplayName: Phoenix Mu
Body: <p>Can anyone offer advice on what the below error code relates to. I am using co-loc R package with 2 GWAS datasets. Using coloc.abf function with pvalues, MAF, sample size and case/control cohort. Thank you </p>
  
  <pre><code>  results &lt;- coloc.abf(  dataset1=list(snp=as.character(1_subset[,2]),pvalues=1_subset[,11],N=1_data_subset<span class="math-container">$sample_size, type="cc",s=0.327,MAF=1_data_subset[,12]),   dataset2=list(snp=as.character(2_subset[,2]),pvalues=2_subset[,8],N=2_subset$</span>sample_size,s=0.4319,MAF=1_subset[,12], type="cc"),p12=1e-06)
  
  
  error code: Error in data.frame(V, z, r, lABF) : 
    arguments imply differing number of rows: 1994, 1992
  In addition: Warning messages:
  1: In 2 * N * f :
    longer object length is not a multiple of shorter object length
  2: In 2 * N * f * (1 - f) :
    longer object length is not a multiple of shorter object length
  3: In r * z^2 :
    longer object length is not a multiple of shorter object length
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-04-03T11:00:05.267Z
Comments.Text: Hi, I can't replicate your error message. Can you double check that the line of code you inputted is the same as that which gave the error message.
Comments.UserDisplayName: user438383
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-04-03T14:21:36.073Z
Comments.Text: The only thing different is that I put the code in a loop to make code quicker if(length(tmp)>0){
    results = coloc.abf(  dataset1=list(snp=as.character(1_subset[,2]),pvalues=1_subset[,11],N=1_subset$sample_size, type="cc",s=0.327,MAF=1_subset[,12]),
      dataset2=list(snp=as.character(2_subset[,2]),pvalues=2_subset[,8],N=2_subset$sample_size,s=CCRATIO,MAF=1_subset[,12], type="cc"),p12=1e-06)
    
  }
Comments.UserDisplayName: Ruth Johnson
Tags: <r>
Title: co-localisation error code using co-loc
ThreadText: # co-localisation error code using co-loc
  
  (Asked by: username_0 on 2020-04-02)
  
  Can anyone offer advice on what the below error code relates to. I am using co-loc R package with 2 GWAS datasets. Using coloc.abf function with pvalues, MAF, sample size and case/control cohort. Thank you
  
  ```
    results <- coloc.abf(  dataset1=list(snp=as.character(1_subset[,2]),pvalues=1_subset[,11],N=1_data_subset$sample_size, type="cc",s=0.327,MAF=1_data_subset[,12]),   dataset2=list(snp=as.character(2_subset[,2]),pvalues=2_subset[,8],N=2_subset$sample_size,s=0.4319,MAF=1_subset[,12], type="cc"),p12=1e-06)
  
  error code: Error in data.frame(V, z, r, lABF) : 
    arguments imply differing number of rows: 1994, 1992
  In addition: Warning messages:
  1: In 2 * N * f :
    longer object length is not a multiple of shorter object length
  2: In 2 * N * f * (1 - f) :
    longer object length is not a multiple of shorter object length
  3: In r * z^2 :
    longer object length is not a multiple of shorter object length
  
  ```
  
  **Tags:** r
  
  > **Comments:**
  > **username_1**: Hi, I can't replicate your error message. Can you double check that the line of code you inputted is the same as that which gave the error message.  
  > **username_0**: The only thing different is that I put the code in a loop to make code quicker if(length(tmp)>0){   results = coloc.abf(  dataset1=list(snp=as.character(1_subset[,2]),pvalues=1_subset[,11],N=1_subset$sample_size, type="cc",s=0.327,MAF=1_subset[,12]),     dataset2=list(snp=as.character(2_subset[,2]),pvalues=2_subset[,8],N=2_subset$sample_size,s=CCRATIO,MAF=1_subset[,12], type="cc"),p12=1e-06)    }  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2020-04-04. Score: 1 | Accepted answer
  
  In your `dataset2 = list()`, the MAF argument should be `MAF=2_subset[,12]` instead of `MAF=1_subset[,12]`. Since your two datasets have different numbers of lines, this is what causes the error.
  
  I am not sure whether this is a typo in your code, or it is because you do not have MAF information in the second dataset. What I like to do before COLOC is to filter two datasets so they have the same number of lines, and then feed those filtered datasets to the coloc function.
  
  (Also just out of curiosity, is `1_subset` a data frame for your GWAS results? I think it is not recommended to have variable names starting with a number.)
  
  > **Comments:**
  > **username_0**: Thank you for your reply. That is really kind. I dont have MAF for dataset two so used dataset 1 for both. I will try the filter function and then maybe input MAF detail first onto the second dataset using 1st dataset. I did change the names, didnt want to use the disease names on forum. Thank you for double checking! Have a safe day, kind regards!  
  
  ---
  
  