how to write for getting set of gene in one line having each sample name
1
0
Entering edit mode
7.3 years ago
raya.girish ▴ 40

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

CNV R • 1.7k views
ADD COMMENT
0
Entering edit mode

I see you tagged R, so you prefer to use R? Any experience with it?

ADD REPLY
0
Entering edit mode

nothing like that I am ostly working on R so

ADD REPLY
2
Entering edit mode
7.3 years ago
 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
ADD COMMENT
0
Entering edit mode

hi pierre This code is not giving me gene at one line only one gene is getting printed

ADD REPLY
0
Entering edit mode

I have gene number in more than 20 gene seperated by ,

ADD REPLY

Login before adding your answer.

Traffic: 1679 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6