CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: [SOLVED] Merge data in columns B that have same entry in column A : Edit Log



Thalakos
Novice

Apr 4, 2013, 11:22 AM


Views: 582
[SOLVED] Merge data in columns B that have same entry in column A

Hi all,

I have this text file with two columns A (ID) and B (Gene):


Code
ID             Gene 

hsa-let-7a KRAS
hsa-let-7a HMGA2
hsa-let-7a integrin beta(3)
hsa-let-7a caspase-3
hsa-let-7a PRDM1/Blimp-1
hsa-let-7a HMGA2
hsa-let-7a IGF-II
hsa-let-7a HMGA2
hsa-let-7a HMGA2
hsa-let-7a RAS
hsa-let-7a BCL2
hsa-let-7a RAS
hsa-let-7a MYC
hsa-let-7a CDC25A
hsa-let-7a CDK6
hsa-let-7a NF2
hsa-let-7a c-myc
hsa-let-7a RAS
hsa-let-7a RAS
hsa-let-7a NIRF
hsa-let-7b Cdc34
hsa-let-7b Dicer
hsa-let-7b KRAS
hsa-let-7b CCND1
hsa-let-7b CDC25A
hsa-let-7b CDK6
hsa-let-7b HMGA2
hsa-let-7c HMGA2
hsa-let-7c HMGA2
hsa-let-7c HMGA2
hsa-let-7c BCL2
hsa-let-7c RAS
hsa-let-7c CDC25A
hsa-let-7c CDK6
hsa-let-7c RAS
hsa-let-7d KRAS
hsa-let-7d HMGA2
hsa-let-7d BCL2
hsa-let-7d RAS
hsa-let-7d CDC25A
hsa-let-7d CDK6
hsa-let-7d BDNF
hsa-let-7d D3R
hsa-let-7e HMGA2
hsa-let-7g KRAS
hsa-let-7g HMGA2
hsa-let-7g Ras
hsa-let-7g HMGA2
hsa-let-7g CDC25A
hsa-let-7g CDK6
hsa-miR-1 c-Met
hsa-miR-1 calmodulin
hsa-miR-1 Gata4
hsa-miR-1 Mef2a
hsa-miR-1 BCL2
hsa-miR-1 Gata4
hsa-miR-1 calmodulin
hsa-miR-1 Mef2a
hsa-miR-1 C/EBPa
hsa-miR-1 FoxP1
hsa-miR-1 HDAC4
hsa-miR-1 MET
hsa-miR-1 HCN4
hsa-miR-1 FoxP1
hsa-miR-1 HDAC4
hsa-miR-1 MET
hsa-miR-1 Cdk9
hsa-miR-1 fibronectin
hsa-miR-1 RasGAP
hsa-miR-1 Rheb
hsa-miR-1 MEF-2
hsa-miR-1 nAChR
hsa-miR-1 GAJ1
hsa-miR-1 KCNJ2
hsa-miR-1 HSP60
hsa-miR-1 HSP70
hsa-miR-1 Hand2
hsa-miR-1 Kir2.1
hsa-miR-100 Plk1
......
(line cut)


I would like to have for column A a single entry and in column B the respective associated name comma separated, like that:

Code
ID                     Gene 

hsa-let-7a KRAS,HMGA2,integrin beta(3),caspase-3,PRDM1/Blimp-1,HMGA2,IGF-II,HMGA2,HMGA2,RAS,BCL2,RAS,MYC,CDC25A,CDK6,NF2,c-myc,RAS,RAS,NIRF
hsa-let-7b Cdc34,Dicer,KRAS,CCND1,CDC25A,CDK6,HMGA2
hsa-let-7c HMGA2,HMGA2,HMGA2,BCL2,RAS,CDC25A,CDK6,RAS
.........


Do you know any way to do that automatically?

Thanks in advance,
Giorgio


(This post was edited by Thalakos on Apr 5, 2013, 9:42 AM)


Edit Log:
Post edited by Thalakos (Novice) on Apr 5, 2013, 9:42 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives