/** * 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(760, 760); background(200, 220, 220, 34); smooth(); //noStroke(); //frameRate(12); PFont font; // The font must be located in the sketch's // "data" directory to load successfully //chromosomelabels font = loadFont("TheSans-Plain-12.vlw"); textFont(font); //textSize(18); text("1", 20, 12); text("2", 40, 12); text("3", 60, 12); text("4", 80, 12); 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 < 22; i++){ stroke((i*2)*10, 150, (i+1)*10, 50); strokeWeight(18); line((i*20)+29, 20, (i*20)+29, (chrlength[i+1] * trans)+20); } //XY stroke(100, 150, 255, 50); line(549, 20, 549, (chrlength[23]* trans)+20); line(569, 20, 569, (chrlength[24] * trans)+20); //mt // stroke(255, 0, 0, 50); // line(589, 20, 589, chrlength[0]* .01); } void draw() { noStroke(); 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; text((pieces[9]), chr*20, x+20); textSize(5); //fill(100, 100, 200, num); //rect(chr*20, x+20, 20, y-x); println(x); } // Go to the next line for the next run through draw() index = index + 1; } }