public void SetCytobands(Cytoband[] cytobands) { if (cytobands.Length == 0) { return; } gameObject = new GameObject(cytobands[0].chr + " Cytoband"); this.Cytobands = cytobands; // Calculate length and centromere coordinates for (int i = 0; i < cytobands.Length; i++) { if (cytobands[i].end > this.Length) { this.Length = cytobands[i].end; } if (cytobands[i].pos == "acen") { if (cytobands[i].arm == 'p') { pCentromere = cytobands[i]; } else { qCentromere = cytobands[i]; } } } }
Cytoband[] LoadCytobandsFromAsset(string file) { TextAsset cytoText = (TextAsset)Resources.Load(file); string[] cytobandLines = cytoText.ToString().Split('\n'); // Length - 1 here because we want to avoid the last line after a return Cytoband[] cytobands = new Cytoband[cytobandLines.Length - 1]; for (int i = 0; i < cytobandLines.Length - 1; i++) { string[] line = cytobandLines[i].Split('\t'); cytobands[i] = new Cytoband(line[0], line[1], line[2], line[3], line[4]); } return(cytobands); }