Answers.Body: <p>Adam Locke (a collaborator of this project) suggests that removing covariate information for the unselected individuals (i.e. setting it to NA) works around this problem:</p>
  
  <blockquote>
    <p>I believe the problem is that he is using a pre-computed kinship matrix including both males and females, and when using the “—peopleIncludeFile” it can’t properly select the right people from the kinship matrix. I don’t know that others have tried to do analysis this way. An alternative, that I think has worked for others, is to generate phenotype variables that have values only for males or females (so, e.g., BMI, BMI_females, BMI_males). For whatever reason, this appears to correctly only use the and select the samples desired without the kinship matrix.</p>
  </blockquote>
  
  <p>Presumably a kinship matrix that is generated for just the subset individuals will work as well, although I don't like the idea that rvtests isn't able to do a label lookup on the kinship matrix to find the correct individuals.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-10T13:12:47.700Z
Answers.LastActivityDate: 2017-06-10T13:12:47.700Z
Answers.UserDisplayName: gringer
Body: <p>I've been processing data for a consortium project that uses the <a href="https://github.com/zhanxw/rvtests" rel="nofollow noreferrer">rvtests</a> toolkit. Our data analysis process uses a kinship matrix and the calculation of inverse-normalised transformed statistics after covariate adjustment (for 1kG-imputed data from a SNPchip). One of the operations we have been asked to do is to analyse males and females separately for a number of different phenotypes.</p>
  
  <p>Here's an example of the command line that I'm running:</p>
  
  <pre><code>rvtest --inVcf chr${ch}.imputed.poly.vcf.gz \
   --pheno ../scripts/phenotypes.raw.2017-May-01.ped \
   --pheno-name ${traitName} \
   --out rv_results/${traitName}_FEMALE_chr${ch} \
   --kinship kinship_matrix.kinship \
   --meta score,cov[windowSize=500000] \
   --peopleIncludeFile ../scripts/female.iids.txt \
   --covar ../scripts/covar.2017-May-11.ped \
   --covar-name ${covs} --useResidualAsPhenotype --dosage DS
  </code></pre>
  
  <p>Unfortunately, the kinship matrix doesn't interact well with the <code>--peopleinclude</code> parameter. When I run this, the program complains about unexpected columns in the kinship matrix (starting at one column greater than the number of females in the dataset). I suspect what is happening is that rvtests is assuming that the kinship matrix applies to the sample set <em>after</em> filtering, rather than applying to the total sample set. This sets off a few warning bells in my head, because it means that rvtest is probably ignoring the column/row labels in the kinship matrix that it has generated.</p>
  
  <p>How can I work around this problem?</p>
  
Tags: <microarray>
Title: How can I combine a kinship matrix with subset individuals when using rvtests?
ThreadText: # How can I combine a kinship matrix with subset individuals when using rvtests?
  
  (Asked by: username_0 on 2017-06-10)
  
  I've been processing data for a consortium project that uses the [rvtests](https://github.com/zhanxw/rvtests) toolkit. Our data analysis process uses a kinship matrix and the calculation of inverse-normalised transformed statistics after covariate adjustment (for 1kG-imputed data from a SNPchip). One of the operations we have been asked to do is to analyse males and females separately for a number of different phenotypes.
  
  Here's an example of the command line that I'm running:
  
  ```
  rvtest --inVcf chr${ch}.imputed.poly.vcf.gz \
   --pheno ../scripts/phenotypes.raw.2017-May-01.ped \
   --pheno-name ${traitName} \
   --out rv_results/${traitName}_FEMALE_chr${ch} \
   --kinship kinship_matrix.kinship \
   --meta score,cov[windowSize=500000] \
   --peopleIncludeFile ../scripts/female.iids.txt \
   --covar ../scripts/covar.2017-May-11.ped \
   --covar-name ${covs} --useResidualAsPhenotype --dosage DS
  
  ```
  
  Unfortunately, the kinship matrix doesn't interact well with the `--peopleinclude` parameter. When I run this, the program complains about unexpected columns in the kinship matrix (starting at one column greater than the number of females in the dataset). I suspect what is happening is that rvtests is assuming that the kinship matrix applies to the sample set *after* filtering, rather than applying to the total sample set. This sets off a few warning bells in my head, because it means that rvtest is probably ignoring the column/row labels in the kinship matrix that it has generated.
  
  How can I work around this problem?
  
  **Tags:** microarray
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2017-06-10. Score: 2 | Accepted answer
  
  Adam Locke (a collaborator of this project) suggests that removing covariate information for the unselected individuals (i.e. setting it to NA) works around this problem:
  
  > I believe the problem is that he is using a pre-computed kinship matrix including both males and females, and when using the “—peopleIncludeFile” it can’t properly select the right people from the kinship matrix. I don’t know that others have tried to do analysis this way. An alternative, that I think has worked for others, is to generate phenotype variables that have values only for males or females (so, e.g., BMI, BMI\_females, BMI\_males). For whatever reason, this appears to correctly only use the and select the samples desired without the kinship matrix.
  
  Presumably a kinship matrix that is generated for just the subset individuals will work as well, although I don't like the idea that rvtests isn't able to do a label lookup on the kinship matrix to find the correct individuals.
  
  
  ---
  
  