Difference between revisions of "2018 Hakyung August Lab note"
From Crop Genomics Lab.
(→svg 만드는 코드) |
(→svg 만드는 코드) |
||
Line 1: | Line 1: | ||
== svg 만드는 코드== | == svg 만드는 코드== | ||
* format을 써봤음 ㅎㅎ | * format을 써봤음 ㅎㅎ | ||
− | print ("<svg width = "" | + | print ("<svg width = ""4000"" height = ""50000"">") '''#도화지? 사이즈''' |
− | + | x = 100 | |
− | + | f = open ("chromosomesize.txt", "r").readlines() '''# chr01 /n size 로 정렬되어 있음''' | |
− | x | + | i = 2 |
− | + | while i < 41 : '''# chromosome size 에 대하여''' | |
− | + | height = float(f[i].strip())/25000 '''# 25000 비율로 줄이기''' | |
− | f = open ("chromosomesize.txt", "r").readlines() | + | rec = ' <rect x = \"{0}\" y =\"100\" rx= \"50\" ry = \"20\" width = \"25\" height= \"{1}\" |
− | i = 2 | + | style="fill:white;stroke:black;stroke-width:5"/>'.format(x, height) '''# 0 자리에 x 변수, 1 자리에 height 변수에 해당하는 값 넣기. (100,100)에서 시작하여 넓이 25에, chr size에 맞는 height 가짐''' |
− | while i < 41 : | + | |
− | height = f[i] | + | |
− | rec = '<rect x = \"{0}\" y =\" | + | |
print (rec) | print (rec) | ||
− | x += | + | x += 190 '''#figure? 사이의 거리 = 190-25 ''' |
− | + | i += 2 | |
− | + | ||
− | i | + | x = 105 '''#이건 그때그때 알아서''' |
+ | k = 1 | ||
+ | while k <21 : | ||
+ | text = ' <text x = \"{0}\" y = \"80\" fill=\"black\" font-size=\"28\">Chr'.format(x) '''chromosome 이름 넣어주기''' | ||
+ | text2 = k | ||
+ | text3 = '</text>' | ||
+ | print text, | ||
+ | print text2, | ||
+ | print text3 | ||
+ | k = k +1 | ||
+ | x +=190 '''#figure 간격대로''' | ||
+ | file = open("/data2/haggui/SNPpos.txt",'r').readlines() | ||
+ | i = 1 | ||
+ | x1 = 80 | ||
+ | x2 = 145 | ||
+ | while i < 21 : | ||
+ | for SNP in file : | ||
+ | if int(SNP.split()[0].split('Chr')[1])== i : | ||
+ | y = 100 + int(SNP.split()[1])/25000 |
Revision as of 02:14, 30 August 2018
svg 만드는 코드
- format을 써봤음 ㅎㅎ
print ("<svg width = ""4000"" height = ""50000"">") #도화지? 사이즈 x = 100 f = open ("chromosomesize.txt", "r").readlines() # chr01 /n size 로 정렬되어 있음 i = 2 while i < 41 : # chromosome size 에 대하여 height = float(f[i].strip())/25000 # 25000 비율로 줄이기 rec = ' <rect x = \"{0}\" y =\"100\" rx= \"50\" ry = \"20\" width = \"25\" height= \"{1}\" style="fill:white;stroke:black;stroke-width:5"/>'.format(x, height) # 0 자리에 x 변수, 1 자리에 height 변수에 해당하는 값 넣기. (100,100)에서 시작하여 넓이 25에, chr size에 맞는 height 가짐 print (rec) x += 190 #figure? 사이의 거리 = 190-25 i += 2
x = 105 #이건 그때그때 알아서 k = 1 while k <21 :
text = ' <text x = \"{0}\" y = \"80\" fill=\"black\" font-size=\"28\">Chr'.format(x) chromosome 이름 넣어주기 text2 = k text3 = '</text>' print text, print text2, print text3 k = k +1 x +=190 #figure 간격대로
file = open("/data2/haggui/SNPpos.txt",'r').readlines() i = 1 x1 = 80 x2 = 145 while i < 21 :
for SNP in file : if int(SNP.split()[0].split('Chr')[1])== i : y = 100 + int(SNP.split()[1])/25000