int main() { int rows; int cols; int c; //scanf("%d %d\n", &rows, &cols); scanf("%d", &rows); scanf("%d", &cols); while ((c = getchar()) != '\n'); if(rows < 0 || cols < 0) //error check for senseless lengths of rows or columns { fprintf(stderr,"Error: Invalid number of columns or rows."); exit(2); } else { rows = rows + 2; //rows and cols incremented to add border around cols = cols + 2; int **table = makeTable(rows, cols); int tableFilled = fillTable(table, rows, cols); if(tableFilled == 0) { int **workTable = makeWorkTable(table, rows, cols); int temp = 1; if(findStartPos(table, workTable, rows, cols)) { fillTableWithPaths(workTable, rows, cols); temp = findEndPos(table, workTable, rows, cols); } if(temp == 0 || temp == 1) { int i, j; for(i = 1; i < rows - 1; i++) //print the maze with the path and without the border { for(j = 1; j < cols - 1; j++) { printf("%c", table[i][j]); } printf("%s", "\n"); } } freeSpace(table, workTable, rows); } else { fprintf(stderr,"Error: Invalid input with the specified rows and columns."); exit(2); } } return 0; }
void doPrintGenes(char *chromName, struct dnaSeq *seq) { struct genePred *genes = NULL; struct genePred *gene = NULL; struct snp *snps = NULL; struct snp *snp = NULL; int startPos = 0; int endPos = 0; int exonPos = 0; genes = readGenes(chromName); for (gene = genes; gene != NULL; gene = gene->next) { // printf("gene = %s %s:%d-%d\n", gene->name, chromName, gene->txStart, gene->txEnd); snps = readSnpsFromGene(gene, chromName); for (snp = snps; snp != NULL; snp = snp->next) { // for each SNP, figure out flanking start and stop // first figure out which exon contains the snp exonPos = findExonPos(gene, snp->chromStart); // exonPos will return -1 if the position isn't in any exon if (exonPos == -1) continue; // exonPos should also never be 0 if (exonPos == 0) continue; // printf(" snp %s at %d\n", snp->name, snp->chromStart); // printf(" exonPos = %d\n", exonPos); startPos = findStartPos(FLANKSIZE, snp->chromStart, gene, exonPos); endPos = findEndPos(FLANKSIZE, snp->chromStart, gene, exonPos); // printf("flank start = %d, flank end = %d\n", startPos, endPos); printExons(snp->name, gene, chromName, startPos, endPos, seq); } snpFreeList(&snps); } geneFreeList(&genes); }