[R] spacing problems

From: mohamed nur anisah <nuranisah_mohamed_at_yahoo.com>
Date: Sun, 20 Jan 2008 06:13:56 -0800 (PST)


Dear all,    

  I try to do a matrix with this data but the warning massage had occur:   In matrix(x5, ncol = 6, byrow = T) :
  data length [116] is not a sub-multiple or multiple of the number of rows [20]    

  I think the spacing problem cause this where double spacing and tabs are everywhere!!    

  Secondly, I have a raw data (which i downloaded from the AutoGraph server) where it has 2 data in one text file. How am i going to split it to two?? I also need to make a command function so that i can do it for the other 38 similar types of data. Below show my command function and attach with is my data. Kindly help me to solve these problems and thanks in advance.    

  fun<-function(filename)
{
 x<-scan(file=filename,sep="\n",skip=12,what=character(0))

 x1<-gsub("[][)(:\\,|\\-]","",x)
 x2<-gsub("Telomere","NA",x1)
 x3<-gsub("Decreasing order|Increasing order","",x2)
 x4<-strsplit(x3,"\t")
 x5<-unlist(x4)

 y<-matrix(x5,ncol=6,byrow=T)
 tc<-textConnection(apply(y,1,paste,collapse=" "))  w<-read.table(tc)
 t<-as.data.frame(w)
 attr(t,"names")=c("CS(O)","id","no.anchor","ref","loc.start","loc.end","CS(O).size","CS(O)ref.density","tested","loc.start","loc.end","breakp.start","breakp.end","den of anchor")  return(t)
 }        

  Cheers,
  Anisah        


AutoGRAPH analysis in a flat-file format ( CS(O) locations, size, breakpoints...):


Reference Chromosome vs Dataset 3


CS(O) id (number of marker/anchor) Location(s) on reference CS(O) size CS(O) density on reference chromosome Location(s) on tested Breakpoints CS(O) locations (denstiy of marker/anchor)

CS 1 (27): 	 cfa1: [ 3251712 - 12398289 ] 	  9146577 	 3 	 mmu18: [ 24330828 - 90644456 ] 	] 12398289, 13347136 [(2 ) 
CS 2 (19): 	 cfa1: [ 13347136 - 18193820 ] 	  4846684 	 4 	 mmu1: [ 113688560 - 106596368 ] 	] 18193820, 19140840 [(3 ) 
CSO 3.1 (18): 	 cfa1: [ 19140840 - 22178912 ] 	 3038072 	 6  	  mmu18: [ 66984412 - 63788168 ]- Decreasing order - 	] 22178912, 23188292 [ 	 (2 )
CSO 3.2 (4): 	 cfa1: [ 23188292 - 24126920 ] 	 938628 	 4  	  mmu18: [ 69469888 - 70578512 ]- Increasing order -  	] 24126920, 24190392 [(8 ) 
CS 4 (2): 	 cfa1: [ 24190392 - 24265894 ] 	  75502 	 26 	 mmu18: [ 70634048 - 70693560 ] 	] 24265894, 24823786 [(7 ) 
CSO 5.1 (6): 	 cfa1: [ 24823786 - 27113036 ] 	 2289250 	 3  	  mmu18: [ 71384360 - 73984760 ]- Increasing order -  	] 27113036, 27418228 [ 	 (13 )
CSO 5.2 (4): 	 cfa1: [ 27418228 - 27578150 ] 	 159922 	 25  	  mmu18: [ 68532272 - 68058624 ]- Decreasing order - 	] 27578150, 28055666 [(9 ) 
CS 6 (77): 	 cfa1: [ 28055666 - 47327576 ] 	  19271910 	 4 	 mmu10: [ 24284924 - 3134304 ] 	] 47327576, 47940412 [(5 ) 
CSO 7.1 (15): 	 cfa1: [ 47940412 - 51570228 ] 	 3629816 	 4  	  mmu17: [ 3283055 - 7577392 ]- Increasing order -  	] 51570228, 51988448 [ 	 (11 )
CSO 7.2 (16): 	 cfa1: [ 51988448 - 57900888 ] 	 5912440 	 3  	  mmu17: [ 12850771 - 8003706 ]- Decreasing order - 	] 57900888, 58482632 [ 	 (11 )
CSO 7.3 (5): 	 cfa1: [ 58482632 - 59714992 ] 	 1232360 	 4  	  mmu17: [ 13497139 - 14565909 ]- Increasing order -  	] 59714992, 59864308 [(15 ) 
CSO 8.1 (8): 	 cfa1: [ 59864308 - 60129744 ] 	 265436 	 30  	  mmu10: [ 33840808 - 33608556 ]- Decreasing order - 	] 60129744, 60211840 [ 	 (17 )
CSO 8.2 (21): 	 cfa1: [ 60211840 - 65147456 ] 	 4935616 	 4  	  mmu10: [ 51273836 - 57483016 ]- Increasing order -  	] 65147456, 65273344 [ 	 (7 )
CSO 8.3 (21): 	 cfa1: [ 65273344 - 72417520 ] 	 7144176 	 3  	  mmu10: [ 33201750 - 24858506 ]- Decreasing order - 	] 72417520, 73256040 [(7 ) 
CS 9 (24): 	 cfa1: [ 73256040 - 78879792 ] 	  5623752 	 4 	 mmu13: [ 64301608 - 58167304 ] 	] 78879792, 79088752 [(10 ) 
CS 10 (3): 	 cfa1: [ 79088752 - 80616144 ] 	  1527392 	 2 	 mmu4: [ 73484664 - 71603504 ] 	] 80616144, 82195232 [(2 ) 
CS 11 (58): 	 cfa1: [ 82195232 - 96913624 ] 	  14718392 	 4 	 mmu19: [ 14515091 - 29676192 ] 	] 96913624, 97163832 [(8 ) 
CS 12 (10): 	 cfa1: [ 97163832 - 99948816 ] 	  2784984 	 4 	 mmu13: [ 53424904 - 51664268 ] 	] 99948816, 100087840 [(9 ) 
CSO 13.1 (4): 	 cfa1: [ 100087840 - 100423328 ] 	 335488 	 12  	  mmu13: [ 51443540 - 51113392 ]- Decreasing order - 	] 100423328, 101013264 [ 	 (11 )
CSO 13.2 (17): 	 cfa1: [ 101013264 - 102120080 ] 	 1106816 	 15  	  mmu13: [ 48589808 - 49694080 ]- Increasing order -  	] 102271920, 102458192 [(25 ) 
CSO 14.1 (10): 	 cfa1: [ 102458192 - 104863664 ] 	 2405472 	 4  	  mmu7: [ 11943329 - 5734576 ]- Decreasing order - 	] 104863664, 105135376 [ 	 (35 )
CSO 14.2 (37): 	 cfa1: [ 105135376 - 106177648 ] 	 1042272 	 35  	  mmu7: [ 4683380 - 3212900 ]- Decreasing order - 	] 106177648, 108473048 [(12 ) 
CSO 15.1 (89): 	 cfa1: [ 108473048 - 110798176 ] 	 2325128 	 38  	  mmu7: [ 43298008 - 45792284 ]- Increasing order -  	] 110798176, 110969024 [ 	 (37 )
CSO 15.2 (94): 	 cfa1: [ 110969024 - 114574736 ] 	 3605712 	 26  	  mmu7: [ 12159146 - 24376768 ]- Increasing order -  	] 114574736, 114862176 [ 	 (35 )
CSO 15.3 (18): 	 cfa1: [ 114862176 - 115343008 ] 	 480832 	 37  	  mmu7: [ 25108812 - 24578816 ]- Decreasing order - 	] 115343008, 115476528 [ 	 (36 )
CSO 15.4 (137): 	 cfa1: [ 115476528 - 124798800 ] 	 9322272 	 15  	  mmu7: [ 25328194 - 40672432 ]- Increasing order -  	] 124798800, Telomere [(-NA-) 

Reference Chromosome vs Dataset 2


CS(O) id (number of marker/anchor) Location(s) on reference CS(O) size CS(O) density on reference chromosome Location(s) on tested Breakpoints CS(O) locations (denstiy of marker/anchor)

CS 1 (71): 	 cfa1: [ 3251712 - 24265894 ] 	  21014182 	 3 	 hsa18: [ 132170848 - 49934572 ] 	] 24265894, 24823786 [(7 ) 
CSO 2.1 (6): 	 cfa1: [ 24823786 - 27113036 ] 	 2289250 	 3  	  hsa18: [ 48121156 - 46579500 ]- Decreasing order - 	] 27113036, 27418228 [ 	 (13 )
CSO 2.2 (4): 	 cfa1: [ 27418228 - 27578150 ] 	 159922 	 25  	  hsa18: [ 13872043 - 13208795 ]- Decreasing order - 	] 27578150, 28055666 [(9 ) 
CSO 3.1 (113): 	 cfa1: [ 28055666 - 59714992 ] 	 31659326 	 4  	  hsa6: [ 132311008 - 169714432 ]- Increasing order -  	] 59714992, 59864308 [ 	 (15 )
CSO 3.2 (50): 	 cfa1: [ 59864308 - 72417520 ] 	 12553212 	 4  	  hsa6: [ 116707976 - 131508152 ]- Increasing order -  	] 72417520, 73256040 [(7 ) 
CSO 4.1 (12): 	 cfa1: [ 73256040 - 75192808 ] 	 1936768 	 6  	  hsa9: [ 98441680 - 96360824 ]- Decreasing order - 	] 75192808, 75336136 [ 	 (6 )
CSO 4.2 (51): 	 cfa1: [ 75336136 - 91881664 ] 	 16545528 	 3  	  hsa9: [ 89301960 - 70341312 ]- Decreasing order - 	] 91881664, 92281272 [ 	 (5 )
CSO 4.3 (22): 	 cfa1: [ 92281272 - 96913624 ] 	 4632352 	 5  	  hsa9: [ 261625 - 5755076 ]- Increasing order -  	] 96913624, 98067040 [ 	 (5 )
CSO 4.4 (15): 	 cfa1: [ 98067040 - 100692560 ] 	 2625520 	 6  	  hsa9: [ 93833248 - 89771184 ]- Decreasing order - 	] 100692560, 101013264 [ 	 (13 )
CSO 4.5 (17): 	 cfa1: [ 101013264 - 102120080 ] 	 1106816 	 15  	  hsa9: [ 95832896 - 94012312 ]- Decreasing order - 	] 102271920, 102458192 [(25 ) 
CS 5 (40): 	 cfa1: [ 102458192 - 105936824 ] 	  3478632 	 11 	 hsa19: [ 63765096 - 59618416 ] 	] 105936824, 106097392 [(35 ) 
CSO 6.1 (7): 	 cfa1: [ 106097392 - 106177648 ] 	 80256 	 87  	  hsa19: [ 59386008 - 59289816 ]- Decreasing order - 	] 106177648, 108260368 [ 	 (11 )
CSO 6.2 (60): 	 cfa1: [ 108260368 - 110263696 ] 	 2003328 	 30  	  hsa19: [ 56908176 - 54256216 ]- Decreasing order - 	] 110263696, 110288752 [ 	 (60 )
CSO 6.3 (71): 	 cfa1: [ 110288752 - 112727048 ] 	 2438296 	 29  	  hsa19: [ 54163196 - 50959884 ]- Decreasing order - 	] 112727048, 112775144 [(40 ) 
CS 7 (185): 	 cfa1: [ 112775144 - 121690672 ] 	  8915528 	 21 	 hsa19: [ 50887772 - 38556448 ] 	] 121690672, 121820640 [(16 ) 
CS 8 (20): 	 cfa1: [ 121820640 - 124798800 ] 	  2978160 	 7 	 hsa19: [ 38391408 - 34709332 ] 	] 124798800, Telomere [(-NA-) 

______________________________________________

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sun 20 Jan 2008 - 14:19:58 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 20 Jan 2008 - 16:30:07 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive