hi pierre This code is not giving me gene at one line only one gene is getting printed
• 0 views
•
link
Dear All It may be useless question I have data sheet having CNV information
File CN State Genes Microarray Nomenclature
s1 1,33 a,b,c Xq28(154,337,224-154,929,412)x1-2
s1 1.33 a,f,h Xp22.33(177,941-2,699,968)x2
s2 3.0 r,h,s 12p12.3p12.1(19,251,491-23,210,281)x2-3
s3 2.1 a,t,c,a,r 12p11.22p11.21(28,433,320-32,514,115)x2-3
I am looking for code
Which will give me excel sheet contain
File CN State Genes Microarray Nomenclature
s1 1.33 a Xq28(154,337,224-154,929,412)x1-2
s1 1.33 b Xq28(154,337,224-154,929,412)x1-2
s1 1.33 c Xq28(154,337,224-154,929,412)x1-2
Similar for other samples . This means that the set of gene will be split in new line but sample name , cnv status and nomenclature should also repeat once the gene set is split in new line
awk '{n=split($3,a,/,/);for(i=1;i<=n;++i) {printf("%s\t%s\t%s\t%s\n",$1,$2,a[i],$4);}}' input.txt
File CN State Genes Microarray Nomenclature
s1 1,33 a Xq28(154,337,224-154,929,412)x1-2
s1 1,33 b Xq28(154,337,224-154,929,412)x1-2
s1 1,33 c Xq28(154,337,224-154,929,412)x1-2
s1 1.33 a Xp22.33(177,941-2,699,968)x2
s1 1.33 f Xp22.33(177,941-2,699,968)x2
s1 1.33 h Xp22.33(177,941-2,699,968)x2
s2 3.0 r 12p12.3p12.1(19,251,491-23,210,281)x2-3
s2 3.0 h 12p12.3p12.1(19,251,491-23,210,281)x2-3
s2 3.0 s 12p12.3p12.1(19,251,491-23,210,281)x2-3
s3 2.1 a 12p11.22p11.21(28,433,320-32,514,115)x2-3
s3 2.1 t 12p11.22p11.21(28,433,320-32,514,115)x2-3
s3 2.1 c 12p11.22p11.21(28,433,320-32,514,115)x2-3
s3 2.1 a 12p11.22p11.21(28,433,320-32,514,115)x2-3
s3 2.1 r 12p11.22p11.21(28,433,320-32,514,115)x2-3
Log in to answer this question.
I see you tagged R, so you prefer to use R? Any experience with it?
nothing like that I am ostly working on R so