comparison genome_diversity/src/dist_mat.c @ 24:248b06e86022

Added gd_genotype datatype. Modified tools to support new datatype.
author Richard Burhans <burhans@bx.psu.edu>
date Tue, 28 May 2013 16:24:19 -0400
parents 2c498d40ecde
children
comparison
equal deleted inserted replaced
23:66a183c44dd5 24:248b06e86022
19 19
20 #include "lib.h" 20 #include "lib.h"
21 21
22 // bounds line length for a line of the Galaxy table 22 // bounds line length for a line of the Galaxy table
23 23
24 #define MOST 5000 24 #define MOST 50000
25 #define MIN_SNPS 3 25 #define MIN_SNPS 3
26 26
27 struct argument { 27 struct argument {
28 int column; 28 int column;
29 char *name; 29 char *name;
30 } A[MOST]; 30 } A[MOST];
31 int nA; // number of individuals or groups + 1 (for the reference species) 31 int nA; // number of individuals or groups + 1 (for the reference species)
32 32
33 #define MOST_INDIVIDUALS 100 33 #define MOST_INDIVIDUALS 1000
34 #define SIZ 1+MOST_INDIVIDUALS // includes the reference 34 #define SIZ 1+MOST_INDIVIDUALS // includes the reference
35 35
36 double tot_diff[SIZ][SIZ]; 36 double tot_diff[SIZ][SIZ];
37 int ndiff[SIZ][SIZ], X[MOST]; 37 int ndiff[SIZ][SIZ], X[MOST];
38 38
46 46
47 if (argc < 8) 47 if (argc < 8)
48 fatal("args: Galaxy-table min-cov min-qual min-snp ref-name genotype dist-out mega-out 13:fred 16:mary ..."); 48 fatal("args: Galaxy-table min-cov min-qual min-snp ref-name genotype dist-out mega-out 13:fred 16:mary ...");
49 min_coverage = atoi(argv[2]); 49 min_coverage = atoi(argv[2]);
50 min_quality = atoi(argv[3]); 50 min_quality = atoi(argv[3]);
51 if (min_coverage <= 0 && min_quality <= 0) 51 genotype = atoi(argv[5]);
52 if (!genotype && min_coverage <= 0 && min_quality <= 0)
52 fatal("coverage and/or quality of SNPs should be constrained"); 53 fatal("coverage and/or quality of SNPs should be constrained");
53 54
54 if (same_string(argv[4], "none")) 55 if (same_string(argv[4], "none"))
55 has_ref = 0; 56 has_ref = 0;
56 else { 57 else {
57 has_ref = 1; 58 has_ref = 1;
58 A[0].name = copy_string(argv[4]); 59 A[0].name = copy_string(argv[4]);
59 } 60 }
60 genotype = atoi(argv[5]);
61 gp = ckopen(argv[6], "w"); 61 gp = ckopen(argv[6], "w");
62 mega = ckopen(argv[7], "w"); 62 mega = ckopen(argv[7], "w");
63 fprintf(mega, "#mega\n!Title: Galaxy;\n"); 63 fprintf(mega, "#mega\n!Title: Galaxy;\n");
64 64
65 for (nA = has_ref, i = 8; i < argc; ++i, ++nA) { 65 for (nA = has_ref, i = 8; i < argc; ++i, ++nA) {