Answers.Body: <p>For simple haplotype simulation of unrelated individuals, there is Montana's venerable <a href="https://cran.r-project.org/web/packages/hapsim/index.html" rel="nofollow noreferrer">HapSim</a>. The model used in that tool is simple and may be good enough for your purposes. You will need to acquire a recombination rate map from for example the HapMap consortium or from <a href="https://github.com/joepickrell/1000-genomes-genetic-maps" rel="nofollow noreferrer">1000G</a>. A cursory google search also revealed this tool and walkthrough that may be suited to your problem: <a href="https://adimitromanolakis.github.io/sim1000G/inst/doc/SimulatingFamilyData.html" rel="nofollow noreferrer">https://adimitromanolakis.github.io/sim1000G/inst/doc/SimulatingFamilyData.html</a></p>
  
  <p>There are lots of other tools with more advanced models, but it sounds like those would be overkill here.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-06T17:28:37.150Z
Answers.LastActivityDate: 2018-12-06T17:28:37.150Z
Answers.UserDisplayName: winni2k
Answers.Body: <p>The data in your matrix appears to be from a VCF file (For reference, see <a href="https://github.com/samtools/hts-specs/blob/master/VCFv4.3.pdf" rel="nofollow noreferrer">https://github.com/samtools/hts-specs/blob/master/VCFv4.3.pdf</a>).</p>
  
  <p>In the VCF specification, a heterozygous genotype can be specified as <code>0|1</code>. The zero and one indicate the allele numbers (0=ref, 1=first alt) that make up the genotype. The "pipe" (<code>|</code>) is used to indicate that the alleles are in phase with the previous entry in the file. Therefore, if you observe data like this:</p>
  
  <pre><code>"0|1"    "0|0"
  "0|1"    "1|1"
  "0|1"    "1|1"
  </code></pre>
  
  <p>Then this means that the first sample has the haplotypes [0,0,0] and [1,1,1]; and that the second sample has the haplotypes [0,1,1] and [0,1,1].   </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-02T14:22:23.020Z
Answers.Text: Thanks, but its not what I meant, I wanted to know how to recombine the haplotypes in order to generate new population out of it. Is there a place where recombination is more likely occur? Is there a program where I can input real haplotypes and it will generate a population?
Answers.UserDisplayName: Kozolovska
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-02T14:26:59.990Z
Answers.Text: Oh! Well there certainly are programs for that. Any chance you could rephrase your post to contain that question?
Answers.UserDisplayName: winni2k
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-02T14:29:57.450Z
Answers.Text: Hopes its better, let me know if I left anything unclear.
Answers.UserDisplayName: Kozolovska
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-27T19:28:01.517Z
Answers.LastActivityDate: 2018-11-27T19:28:01.517Z
Answers.UserDisplayName: winni2k
Answers.Body: <p>Ensembl have haplotypes from 1000 Genomes available <a href="http://www.ensembl.org/Homo_sapiens/Transcript/Haplotypes?db=core;g=ENSG00000128573;r=7:114414997-114693768;t=ENST00000403559" rel="nofollow noreferrer">by transcript</a>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-13T07:29:43.617Z
Answers.LastActivityDate: 2018-08-13T07:29:43.617Z
Answers.UserDisplayName: Emily_Ensembl
Body: <p>I am trying to simulate different genome of peoples, I have data (VCF files) of various genes from the 1000K Gene project. </p>
  
  <p>I want to simulate different whole genomes i.e generate a new population by combining real haplotypes I have. I am wondering what is the best way to approach the problem. That is what is an efficient method of generating realistic (Not just randomly select parts and recombining them) new genotypes based on the real genotypes I already have. </p>
  
  <p>I am using Bioconductor packages VariantAnnotation to read and manipulate the VCF files and TxDb.Hsapiens.UCSC.hg19.knownGene to determine the Genes positions. </p>
  
  <p>The data looks as the following: </p>
  
  <pre><code>&gt; gene58@rowRanges
  GRanges object with 91 ranges and 1 metadata column:
                seqnames    ranges strand | paramRangeID
                   &lt;Rle&gt; &lt;IRanges&gt;  &lt;Rle&gt; |     &lt;factor&gt;
    rs551585351        1 229566998      * |         &lt;NA&gt;
    rs528384854        1 229567027      * |         &lt;NA&gt;
    rs542093083        1 229567063      * |         &lt;NA&gt;
    rs561849701        1 229567128      * |         &lt;NA&gt;
    rs531042647        1 229567160      * |         &lt;NA&gt;
            ...      ...       ...    ... .          ...
    rs565479298        1 229569784      * |         &lt;NA&gt;
    rs572772527        1 229569785      * |         &lt;NA&gt;
       rs605430        1 229569803      * |         &lt;NA&gt;
       rs605428        1 229569804      * |         &lt;NA&gt;
    rs368699658        1 229569810      * |         &lt;NA&gt;
    -------
    seqinfo: 86 sequences from "hg19" genome
  </code></pre>
  
  <p>The genotype matrix of the gene: </p>
  
  <pre><code>&gt; gene.mat[1:5, 1:5]
              HG00867 HG02371 HG00759 HG00766 HG00844
  rs551585351 "0|0"   "0|0"   "0|0"   "0|0"   "0|0"  
  rs528384854 "0|0"   "0|0"   "0|0"   "0|0"   "0|0"  
  rs542093083 "0|0"   "0|0"   "0|0"   "0|0"   "0|0"  
  rs561849701 "0|0"   "0|0"   "0|0"   "0|0"   "0|0"  
  rs531042647 "0|0"   "0|0"   "0|0"   "0|0"   "0|0" 
  </code></pre>
  
Tags: <bioconductor><vcf><snp><haplotypes><simulated-data>
Title: Sampling haplotypes
ThreadText: # Sampling haplotypes
  
  (Asked by: username_0 on 2018-08-08)
  
  I am trying to simulate different genome of peoples, I have data (VCF files) of various genes from the 1000K Gene project.
  
  I want to simulate different whole genomes i.e generate a new population by combining real haplotypes I have. I am wondering what is the best way to approach the problem. That is what is an efficient method of generating realistic (Not just randomly select parts and recombining them) new genotypes based on the real genotypes I already have.
  
  I am using Bioconductor packages VariantAnnotation to read and manipulate the VCF files and TxDb.Hsapiens.UCSC.hg19.knownGene to determine the Genes positions.
  
  The data looks as the following:
  
  ```
  > gene58@rowRanges
  GRanges object with 91 ranges and 1 metadata column:
                seqnames    ranges strand | paramRangeID
                   <Rle> <IRanges>  <Rle> |     <factor>
    rs551585351        1 229566998      * |         <NA>
    rs528384854        1 229567027      * |         <NA>
    rs542093083        1 229567063      * |         <NA>
    rs561849701        1 229567128      * |         <NA>
    rs531042647        1 229567160      * |         <NA>
            ...      ...       ...    ... .          ...
    rs565479298        1 229569784      * |         <NA>
    rs572772527        1 229569785      * |         <NA>
       rs605430        1 229569803      * |         <NA>
       rs605428        1 229569804      * |         <NA>
    rs368699658        1 229569810      * |         <NA>
    -------
    seqinfo: 86 sequences from "hg19" genome
  
  ```
  
  The genotype matrix of the gene:
  
  ```
  > gene.mat[1:5, 1:5]
              HG00867 HG02371 HG00759 HG00766 HG00844
  rs551585351 "0|0"   "0|0"   "0|0"   "0|0"   "0|0"  
  rs528384854 "0|0"   "0|0"   "0|0"   "0|0"   "0|0"  
  rs542093083 "0|0"   "0|0"   "0|0"   "0|0"   "0|0"  
  rs561849701 "0|0"   "0|0"   "0|0"   "0|0"   "0|0"  
  rs531042647 "0|0"   "0|0"   "0|0"   "0|0"   "0|0" 
  
  ```
  
  **Tags:** bioconductor, vcf, snp, haplotypes, simulated-data
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2018-12-06. Score: 2 | Accepted answer
  
  For simple haplotype simulation of unrelated individuals, there is Montana's venerable [HapSim](https://cran.r-project.org/web/packages/hapsim/index.html). The model used in that tool is simple and may be good enough for your purposes. You will need to acquire a recombination rate map from for example the HapMap consortium or from [1000G](https://github.com/joepickrell/1000-genomes-genetic-maps). A cursory google search also revealed this tool and walkthrough that may be suited to your problem: <https://adimitromanolakis.github.io/sim1000G/inst/doc/SimulatingFamilyData.html>
  
  There are lots of other tools with more advanced models, but it sounds like those would be overkill here.
  
  
  ---
  
  ### Answer by username_1 on 2018-11-27. Score: 2
  
  The data in your matrix appears to be from a VCF file (For reference, see <https://github.com/samtools/hts-specs/blob/master/VCFv4.3.pdf>).
  
  In the VCF specification, a heterozygous genotype can be specified as `0|1`. The zero and one indicate the allele numbers (0=ref, 1=first alt) that make up the genotype. The "pipe" (`|`) is used to indicate that the alleles are in phase with the previous entry in the file. Therefore, if you observe data like this:
  
  ```
  "0|1"    "0|0"
  "0|1"    "1|1"
  "0|1"    "1|1"
  
  ```
  
  Then this means that the first sample has the haplotypes [0,0,0] and [1,1,1]; and that the second sample has the haplotypes [0,1,1] and [0,1,1].
  
  > **Comments:**
  > **username_0**: Thanks, but its not what I meant, I wanted to know how to recombine the haplotypes in order to generate new population out of it. Is there a place where recombination is more likely occur? Is there a program where I can input real haplotypes and it will generate a population?  
  > **username_1**: Oh! Well there certainly are programs for that. Any chance you could rephrase your post to contain that question?  
  > **username_0**: Hopes its better, let me know if I left anything unclear.  
  
  ---
  
  ### Answer by username_2 on 2018-08-13. Score: 0
  
  Ensembl have haplotypes from 1000 Genomes available [by transcript](http://www.ensembl.org/Homo_sapiens/Transcript/Haplotypes?db=core;g=ENSG00000128573;r=7:114414997-114693768;t=ENST00000403559).
  
  
  ---
  
  