homework1

homework1 - , that reads in the large scale genotype data...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Bios 735: Statistical Computing Homework #1: part 1 due: Tuesday, September 22, 2011 1. Given a list (call it x ) of vectors, each with the same mode and the same length, write a function listToVector(x) that converts the list to a matrix. 2. Write a function repMatrix(A, b, vertical) that takes as arguments a matrix A , a number b , and a logical vertical . The function should return a matrix that consists of A “repeated” b times. The vertical logical should determine whether the matrices are stacked or places side by side. Specifically, repMatrix(A, 2, T) should return the matrix: [ A 0 , A 0 ] 0 , i.e. the matrix stacked one on top of the other, and repMatrix(A, 2, F) should return a matrix: [ A , A ] which is the A matrix placed side by side. 3. Write a function revMatrix(A) that reverses the columns of A , if A = 1 5 9 2 6 10 3 7 11 4 8 12 then revMatrix(A) would return 9 5 1 10 6 2 11 7 3 12 8 4 4. Write a function, recodeSNP(infile, outfile)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: , that reads in the large scale genotype data set located at infile , recodes the SNPs in 0, 1, or 2 based on the number of minor alleles for each SNP, and outputs the recoded data as a tab delimitted le in outfile (keeping all headers and row names). The minor allele is the allele that appears less for the particular SNP under consideration. For instance, your code should be able to to run by typing: recodeSNP("http://www.bios.unc.edu/~mwu/bios735/data/SNPdata.txt", "newdata.txt") (note that the in the url above may have gotten screwed up in L A T E Xagain). Be careful that some SNPs may be nonpolymorphic (i.e. everybody has the same genotype) in which case the minor allele is not observed and everyone has no copies of the minor allele for the SNP and should be scored as 0s. 1...
View Full Document

This note was uploaded on 11/18/2011 for the course BIOS 735 taught by Professor Staff during the Spring '10 term at UNC.

Ask a homework question - tutors are online