/** * LoadFile 1 * * Loads a text file that contains two numbers separated by a tab ('\t'). * A new pair of numbers is loaded each frame and used to draw a point on the screen. */ String[] lines; int index = 0; float trans = .0000029; void setup() { size(770, 540); //background(200, 220, 220, 34); background(0); smooth(); translate(10,0); //noStroke(); //frameRate(12); PFont font; // The font must be located in the sketch's // "data" directory to load successfully //chromosomelabels font = loadFont("Futura-Bold.vlw"); textFont(font); textSize(18); //text("The Distribution of Intellectual Property Claims on the Human Genome", 20, 520); textSize(10); // text("Source Data: Jensen and Murray. 2005. Intellectual Property Landscape of the Human Genome. Science 310:239.", 90, 530); textSize(14); /* text("1", 6, 40); //text("2", 6, 60); //text("3", 6, 80); //text("4", 6, 100); text("5", 100, 12); text("6", 120, 12); text("7", 140, 12); text("8", 160, 12); text("9", 180, 12); text("10", 200, 12); text("11", 220, 12); text("12", 240, 12); text("13", 260, 12); text("14", 280, 12); text("15", 300, 12); text("16", 320, 12); text("17", 340, 12); text("18", 360, 12); text("19", 380, 12); text("20", 400, 12); text("21", 420, 12); text("22", 440, 12); text("X", 540, 12); text("Y", 560, 12); text("mt", 580, 12); */ // fill(230, 34, 145); lines = loadStrings("allChrsPatents.txt"); int[] chrlength = new int[25]; chrlength[1] = 247249719; chrlength[2] = 242951149; chrlength[3] = 199501827; chrlength[4] = 191273063; chrlength[5] = 180857866; chrlength[6] = 170899992; chrlength[7] = 158821424; chrlength[8] = 146274826; chrlength[9] = 140273252; chrlength[10] = 135374737; chrlength[11] = 134452384; chrlength[12] = 132349534; chrlength[13] = 114142980; chrlength[14] = 106368585; chrlength[15] = 100338915; chrlength[16] = 88827254; chrlength[17] = 78774742; chrlength[18] = 76117153; chrlength[19] = 63811651; chrlength[20] = 62435964; chrlength[21] = 46944323; chrlength[22] = 49691432; chrlength[23] = 154913754; chrlength[24] = 57772954; chrlength[0] = 16571; //color and draw chromosomes for (int i = 0; i < 24; i++){ stroke((i*2)*10, 150, (i+1)*10, 50); strokeWeight(18); line(20,(i*20)+29, (chrlength[i+1] * trans)+20, (i*20)+29); } for (int i = 0; i < 22; i++) { text(i+1, -8, (i*20)+35); } text("X", -8, 475); text("Y", -8, 495); //XY stroke(0, 150, 255, 50); line(20, 469, (chrlength[23]* trans)+20, 469); line(20, 489, (chrlength[24] * trans)+20, 489); //mt // stroke(255, 0, 0, 50); // line(589, 20, 589, chrlength[0]* .01); } void draw() { noStroke(); translate(10,0); if (index < lines.length) { String[] pieces = split(lines[index], '\t'); if (pieces.length == 10) { float pat = int(pieces[0]); float chr = int(pieces[2]); float x = int(pieces[3]) * trans; float y = int(pieces[4]) * trans; float num = int(pieces[5]) * 10; //textSize(5); //text((pieces[9]), chr*20, x+20); //fill(100, 100, 200, num); fill(255, 255, 255, 200); rect(x+20, chr*20, y-x, 20); println(x); } // Go to the next line for the next run through draw() index = index + 1; } }