On Fri, May 10, 2013 at 10:02 PM, Tereza Jezkova UNLV <
jezkovat@unlv.nevada.edu> wrote:

> I created a Snp matrix using a genotypeToSnpMatrix command
>
> The matrix looks like this:
>
> > mat
> $genotypes
> A SnpMatrix with  10 rows and  50581 columns
> Row names:  Rodriguez_Lizard_1240_sequence_1_pileup.txt ...
> Rodriguez_Lizard_623_sequence_1_pileup.txt
> Col names:  RADid_0000001_depth_39:0000000058 ...
> RADid_0078132_depth_33:0000000081
>
> $map
> DataFrame with 50581 rows and 4 columns
>                                snp.names       allele.1           allele.2
>    ignore
>                              <character> <DNAStringSet> <DNAStringSetList>
> <logical>
> 1      RADid_0000001_depth_39:0000000058              C                  A
>     FALSE
> 2     RADid_0000003_depth_152:0000000007              G                A,T
>      TRUE
> 3     RADid_0000003_depth_152:0000000034              G                T,C
>      TRUE
> 4     RADid_0000003_depth_152:0000000046              T                  C
>     FALSE
> 5      RADid_0000010_depth_57:0000000010              T                  C
>     FALSE
> ...                                  ...            ...                ...
>       ...
> 50577  RADid_0078129_depth_31:0000000062              C                  T
>     FALSE
> 50578  RADid_0078132_depth_33:0000000025              T                  C
>     FALSE
> 50579  RADid_0078132_depth_33:0000000033              C                  T
>     FALSE
> 50580  RADid_0078132_depth_33:0000000044              C                  A
>     FALSE
> 50581  RADid_0078132_depth_33:0000000081              C                  T
>     FALSE
>
>
> How do I convert my matrix to a a nucleotide genotype matrix?
> I would like my data to look something like:
>
> Sample 1 Snp 1 T/T
> Sample 2 Snp 1 T/A
> Sample 3 Snp 1 A/A etc.
>
>

as(mat, "character")  will yield a conforming matrix with "A/B" notation in
each cell.  the
representation is only useful for diallelic SNP

from ?read.snps.long

  For nucleotide coding, nucleotides are assigned to the nominal alleles
  in alphabetic order. Thus, for a SNP with either  "T" and "A"
  nucleotides in the variant position,
  the nominal genotypes AA, AB and BB will refer to A/A,
  A/T and T/T.

provided this convention is observed in the VCF translation, you could use
string substitutions
to transform the A/B notation to nucleotide notation.  oftentimes this is
not really needed.


> I noticed that people have been creating their Snp matrix from a txt file.
> I am importing from a vcf file and I can’t figure out how to get the
> desired format.
>
> Thanks a lot for your kind help,
>
> Tereza
>         [[alternative HTML version deleted]]
>
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor@r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives:
> http://news.gmane.org/gmane.science.biology.informatics.conductor
>

	[[alternative HTML version deleted]]

