In MATLAB ChIP-seq is used to identify genomic segments bound by transcription f
ID: 3847195 • Letter: I
Question
In MATLAB
ChIP-seq is used to identify genomic segments bound by transcription factors. In a ChIP-seq experiment, you obtain the chromosome regions that the transcription factor FoxA is binding. Write a Matlab function locationtogenes(chr,start,finish,genefile) that takes a chromosome name, the start and finish of the chromosome region in base pairs, and a gene-location file; and determines which genes are located in that region. The gene-location file is a tab-delimited text file where each line contains chromosome-start-finish-genename. Find the genes whose position overlaps with the input range (the gene doesn't have to be completely enclosed in the input range to be considered overlapping; at least one nucleotide overlap is sufficient). Return these genes as a cell array. If no genes are found in an input range, return an empty cell array.
You may follow the pseudocode below or design & implement your own approach.
Explanation / Answer
%# read the whole file to a temporary cell array fid = fopen(filename,'rt'); tmp = textscan(fid,'%s','Delimiter',' '); fclose(fid); %# remove the lines starting with headerline tmp = tmp{1}; idx = cellfun(@(x) strcmp(x(1:10),'headerline'), tmp); tmp(idx) = []; %# split and concatenate the rest result = regexp(tmp,' ','split'); result = cat(1,result{:}); %# delete temporary array (if you want) clear tmp
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.