Hakyung January Lab note

From Crop Genomics Lab.
Jump to: navigation, search

import sys print ('<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events" version="1.1" baseProfile="full" width="400mm" height="500000mm">') file = open("chromosomesize.txt",'r').readlines() whichchr = sys.argv[2].split(',') x = 100 for chrnum in whichchr :

       k = str((float(file[(int(chrnum))*2].strip()))/500000)
       print ( '<rect x = "{0}" y ="100" rx= "15" ry = "15" width = "{1}" height= "25" style="fill:white;stroke:black;stroke-width:5"/>'.format(x,k))
       file2 = open(sys.argv[1], 'r').readlines()
       for line in file2 :
               chromosome = line[3:5]
               try :
                       if float(chromosome) == float(chrnum) :
                               markerposition = str(x + (int(line.split(':')[1])/500000))
                               print ('<line x1= "{0}" y1 = "90" x2 = "{0}" y2 = "135" stroke="green" stroke-width= "1" />'.format(markerposition))
               except ValueError : pass
       x += float(k) 

print ('</svg>')