Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rioro2000 committed May 8, 2019
1 parent e0328b3 commit b5a3973
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 4 deletions.
Empty file added .Rhistory
Empty file.
Binary file modified man/manual.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion src/bs/bs_aligner.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ void run_bs_aligner(genome_t *genome2, genome_t *genome1, genome_t *genome,

// Aquí es donde se lanza el workflow, comenzando la creación del fichero alignments.bam
start_timer(time_start_alig);
workflow_run_with(options->num_cpu_threads, wf_input, wf);
workflow_run_with(options->num_cpu_threads, wf_input, wf);
stop_timer(time_start_alig, time_end_alig, time_alig);

// Log elapsed time
Expand Down
33 changes: 30 additions & 3 deletions src/bs/methylation.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,18 +281,31 @@ char *obtain_seq(alignment_t *alig, fastq_read_t * orig) {
if (car == 'D' || car == 'N') {
pos_read += num - 1;
} else {
if (car == 'I' || car == 'H' || car == 'S') {
if (car == 'I') {
for (cont = 0; cont < num; cont++, pos++) {
if (pos < seq_len) {
seq[pos] = '-';
}
}
}
else{
if (car == 'H' || car == 'S') {
for (cont = 0; cont < num; cont++, pos++, pos_read++) {
if (pos < seq_len) {
seq[pos] = '-';
}
}
}
}
}

}
}

seq[seq_len - 1] = '\0';
//Ricardo, sobreescribe elemento del read, con inserciones se pierde el final del genoma original, con delecciones tamaño más pequeño
if (pos < seq_len)
seq[pos] = '\0';
// seq[seq_len - 1] = '\0';

free(cigar);
return seq;
Expand Down Expand Up @@ -483,7 +496,9 @@ int methylation_status_report(sw_server_input_t* input, batch_t *batch, methylat
}

// Inicializar listas para guardar datos de c's metiladas/no metiladas
//bs_context_t *bs_context = bs_context_new(num_reads, genome->num_chromosomes);
bs_context_t *bs_context = bs_context_new(10000, genome->num_chromosomes);

mapping_batch->bs_context = bs_context;

remove_duplicates(num_reads, mapping_batch->mapping_lists, mapping_batch->mapping_lists2);
Expand Down Expand Up @@ -540,7 +555,15 @@ void add_metilation_status(array_list_t *array_list, bs_context_t *bs_context,
if (workspace->add_status_seq_dup == NULL) {
workspace->add_status_seq_dup = strdup(seq);
} else {
strcpy(workspace->add_status_seq_dup, seq);
if (strlen(workspace->add_status_seq_dup)== strlen(seq))
{
strcpy(workspace->add_status_seq_dup, seq);
}
else
{
free(workspace->add_status_seq_dup);
workspace->add_status_seq_dup = strdup(seq);
}
}

char *seq_dup = workspace->add_status_seq_dup;
Expand All @@ -553,6 +576,10 @@ void add_metilation_status(array_list_t *array_list, bs_context_t *bs_context,
if (workspace->add_status_gen == NULL) {
workspace->add_status_gen = calloc(len + 6, sizeof(char));
}
else if (strlen(workspace->add_status_gen) != (len + 6)) {
free(workspace->add_status_gen);
workspace->add_status_gen = calloc(len + 6, sizeof(char));
}

gen = workspace->add_status_gen;

Expand Down
4 changes: 4 additions & 0 deletions src/hpg-aligner.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ int main(int argc, char* argv[]) {
validate_options(options, command);
LOG_DEBUG_F("Command Mode: %s\n", command);



if (!strcmp(command, "build-index")) {
if (options->bs_index == 0) { // Regular index generation
run_index_builder(options->genome_filename, options->bwt_dirname, options->index_ratio, options->max_num_chromosomes);
Expand Down Expand Up @@ -288,6 +290,7 @@ int main(int argc, char* argv[]) {




// BWT index
LOG_DEBUG("Loading AGT index...");
bwt_index1 = bwt_index_new(bs_dir1,options->max_num_chromosomes);
Expand Down Expand Up @@ -359,6 +362,7 @@ int main(int argc, char* argv[]) {
}

basic_statistics_display(basic_st, 0, time_alig / 1000000, time_genome / 1000000);
basic_statistics_file("basicStatistics.txt",basic_st, 0, time_alig / 1000000, time_genome / 1000000);
free(basic_st);
options_free(options);

Expand Down
40 changes: 40 additions & 0 deletions src/statistics.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,46 @@ void basic_statistics_display(basic_statistics_t *statistics, int rna_mode, floa

}


void basic_statistics_file(char* filename, basic_statistics_t *statistics, int rna_mode, float alig_time, float load_time) {

FILE *stats_file = fopen(filename, "w");


size_t total_reads = statistics->total_reads;
size_t num_mapped_reads = statistics->num_mapped_reads;
size_t total_mappings = statistics->total_mappings;

size_t total_sp = statistics->total_sp;
size_t uniq_sp = statistics->uniq_sp;

fprintf(stats_file,"+--------------------------------------------------------------------------------------+\n");
fprintf(stats_file,"| GLOBAL STATISTICS |\n");
fprintf(stats_file,"+--------------------------------------------------------------------------------------+\n");
fprintf(stats_file,"| Loading Time (s) : %-65.2f", load_time);
fprintf(stats_file,"|\n");
fprintf(stats_file,"| Alignment Time (s): %-65.2f", alig_time);
fprintf(stats_file,"|\n");
fprintf(stats_file,"| Total Time (s) : %-65.2f", load_time + alig_time);
fprintf(stats_file,"|\n");
fprintf(stats_file,"========================================================================================\n");
fprintf(stats_file,"| Total Reads Processed: %-62llu", total_reads);
fprintf(stats_file,"|\n");
fprintf(stats_file,"+-------------------------------------------+------------------------------------------+\n");
fprintf(stats_file,"| Reads Mapped: %-18llu %6.2f", num_mapped_reads, num_mapped_reads * 100.0 / total_reads);
fprintf(stats_file,"% | ");
fprintf(stats_file," Reads Unmapped: %-14llu %6.2f", total_reads - num_mapped_reads, (total_reads - num_mapped_reads) * 100.0 / total_reads);
fprintf(stats_file,"% |\n");
if (rna_mode) {
fprintf(stats_file,"+-------------------------------------------+------------------------------------------+\n");
} else {
fprintf(stats_file,"+-------------------------------------------+------------------------------------------+\n");
}

fclose(stats_file);

}

//------------------------------------------------------------------------------------------

basic_statistics_t *basic_statistics_new() {
Expand Down
1 change: 1 addition & 0 deletions src/statistics.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ extern statistics_t *statistics_p;
extern basic_statistics_t *basic_st;

void basic_statistics_display(basic_statistics_t *statistics, int rna_mode, float alig_time, float load_time);
void basic_statistics_file(char* filename, basic_statistics_t *statistics, int rna_mode, float alig_time, float load_time);

void basic_statistics_add(size_t total_reads, size_t num_mapped_reads, size_t total_mappings, basic_statistics_t *basic);

Expand Down

0 comments on commit b5a3973

Please sign in to comment.