Skip to content

Commit

Permalink
Fix a minor bug when mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
“chhylp123” committed Jun 28, 2019
1 parent 42db672 commit 795355a
Show file tree
Hide file tree
Showing 66 changed files with 2,152 additions and 2,733 deletions.
Binary file added .vscode/ipch/144a995ae038b012/BAM_PRASE.ipch
Binary file not shown.
Binary file added .vscode/ipch/144a995ae038b012/mmap_address.bin
Binary file not shown.
Binary file added .vscode/ipch/165b1d035bc72256/RANS_STATIC.ipch
Binary file not shown.
Binary file added .vscode/ipch/165b1d035bc72256/mmap_address.bin
Binary file not shown.
Binary file added .vscode/ipch/171daa2d02a92d09/mmap_address.bin
Binary file not shown.
Binary file added .vscode/ipch/18227b364e1fbf8c/BGZIP.ipch
Binary file not shown.
Binary file added .vscode/ipch/18227b364e1fbf8c/mmap_address.bin
Binary file not shown.
Binary file added .vscode/ipch/26dc1095207da97d/mmap_address.bin
Binary file not shown.
Binary file added .vscode/ipch/371c6bbe8f06196e/KNETFILE.ipch
Binary file not shown.
Binary file added .vscode/ipch/371c6bbe8f06196e/mmap_address.bin
Binary file not shown.
Binary file added .vscode/ipch/3995a2bb251acfb7/mmap_address.bin
Binary file not shown.
Binary file added .vscode/ipch/3de40bdcaa7b23db/CRAM_IO.ipch
Binary file not shown.
Binary file added .vscode/ipch/3de40bdcaa7b23db/mmap_address.bin
Binary file not shown.
Binary file added .vscode/ipch/41e5df5458883911/VCF.ipch
Binary file not shown.
Binary file added .vscode/ipch/41e5df5458883911/mmap_address.bin
Binary file not shown.
Binary file added .vscode/ipch/4becd36db04ed922/POOLED_ALLOC.ipch
Binary file not shown.
Binary file added .vscode/ipch/4becd36db04ed922/mmap_address.bin
Binary file not shown.
Binary file added .vscode/ipch/4eb80996a4e967df/BGZF.ipch
Binary file not shown.
Binary file added .vscode/ipch/4eb80996a4e967df/mmap_address.bin
Binary file not shown.
Binary file added .vscode/ipch/52f6359e9796ce69/mmap_address.bin
Binary file not shown.
Binary file added .vscode/ipch/5d1f140968934b68/mmap_address.bin
Binary file not shown.
Binary file added .vscode/ipch/62112866c52ccf5f/PILEUP.ipch
Binary file not shown.
Binary file added .vscode/ipch/62112866c52ccf5f/mmap_address.bin
Binary file not shown.
Binary file added .vscode/ipch/63c17bedfbf9775/mmap_address.bin
Binary file not shown.
Binary file added .vscode/ipch/6d6bd9b2e0d4be08/mmap_address.bin
Binary file not shown.
Binary file added .vscode/ipch/7092faf19e0c0172/SAM_HEADER.ipch
Binary file not shown.
Binary file added .vscode/ipch/7092faf19e0c0172/mmap_address.bin
Binary file not shown.
Binary file added .vscode/ipch/74b01c0a80371994/mmap_address.bin
Binary file not shown.
Binary file added .vscode/ipch/769a76f7f6d02dc4/TEST_VIEW.ipch
Binary file not shown.
Binary file added .vscode/ipch/769a76f7f6d02dc4/mmap_address.bin
Binary file not shown.
Binary file added .vscode/ipch/7a0f156c8b7301e5/mmap_address.bin
Binary file not shown.
Binary file added .vscode/ipch/8cfea4f366cd8238/HFILE.ipch
Binary file not shown.
Binary file added .vscode/ipch/8cfea4f366cd8238/mmap_address.bin
Binary file not shown.
Binary file added .vscode/ipch/a6c5c256b8ff69bc/mmap_address.bin
Binary file not shown.
Binary file added .vscode/ipch/b250c2538a9b31a3/CRAM_INDEX.ipch
Binary file not shown.
Binary file added .vscode/ipch/b250c2538a9b31a3/mmap_address.bin
Binary file not shown.
Binary file modified .vscode/ipch/c36513258c097d28/PROCESS_COMMANDLINES.ipch
Binary file not shown.
Binary file added .vscode/ipch/d2b149d53895c62e/MFILE.ipch
Binary file not shown.
Binary file added .vscode/ipch/d2b149d53895c62e/mmap_address.bin
Binary file not shown.
Binary file added .vscode/ipch/d799abfe910fdee5/mmap_address.bin
Binary file not shown.
Binary file not shown.
Binary file added .vscode/ipch/df1232426ddfae37/mmap_address.bin
Binary file not shown.
Binary file not shown.
Binary file added .vscode/ipch/e7ae134272bc1cd8/mmap_address.bin
Binary file not shown.
Binary file added .vscode/ipch/f1e671c56381c473/mmap_address.bin
Binary file not shown.
Binary file added .vscode/ipch/f20caea17dca228d/SAM.ipch
Binary file not shown.
Binary file added .vscode/ipch/f20caea17dca228d/mmap_address.bin
Binary file not shown.
Binary file modified .vscode/ipch/f5ff61a3b43a76f4/INDEX.ipch
Binary file not shown.
Binary file added .vscode/ipch/f62e192692a94745/mmap_address.bin
Binary file not shown.
Binary file added .vscode/ipch/f96ad9adea1d4fae/mmap_address.bin
Binary file not shown.
Binary file not shown.
Binary file added .vscode/ipch/f9b1c5427d22454e/mmap_address.bin
Binary file not shown.
Binary file added .vscode/ipch/fee4593fb6187249/mmap_address.bin
Binary file not shown.
Binary file added .vscode/ipch/ff4f2d8fcadee50c/mmap_address.bin
Binary file not shown.
97 changes: 41 additions & 56 deletions Bitmapper_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ int main(int argc, char *argv[])

if (!CommandLine_process(argc, argv))
return 1;



fprintf(stdout, "bam_output:%d\n", bam_output);


if(is_index)
Expand All @@ -57,7 +53,7 @@ int main(int argc, char *argv[])
double loadingTime;
double mappingTime;
char outputFileName[NAME_LENGTH];
char bam_outputFileName[NAME_LENGTH];
char bam_outputFileName[NAME_LENGTH];



Expand All @@ -69,52 +65,43 @@ int main(int argc, char *argv[])
///这就是打开read文件
if (!initiReadAllReads(Read_File1, Read_File2, is_pairedEnd, &read_format))
{
fprintf(stdout, "Cannot open read files. \n");
fprintf(stderr, "Cannot open read files. \n");
return 1;
}


sprintf(outputFileName, "%s%s",Mapped_FilePath , Mapped_File);
sprintf(bam_outputFileName, "%s.tmp", outputFileName);


sprintf(outputFileName, "%s%s",Mapped_FilePath , Mapped_File);
sprintf(bam_outputFileName, "%s.tmp", outputFileName);


if (output_methy == 0)
{


Output_gene(outputFileName);

Output_gene(outputFileName);
}



if (!is_pairedEnd)
{

if (!Start_Load_Index(fileName[1]))
{
fprintf(stderr, "Load hash table index failed!\n");
return 1;
}
if (!Start_Load_Index(fileName[1]))
{
fprintf(stderr, "Load hash table index failed!\n");
return 1;
}


mappingTime = 0;
loadingTime = 0;
//loadHashTable = &Load_Index;
fprintf(stdout,"Start load hash table!\n");


///fprintf(stdout, "%d\n", READS_QUENUE_MAX_LENGTH);

fprintf(stderr, "%s\n", fileName[1]);

// loadHashTable = &Load_Index;
fprintf(stderr,"Start load hash table!\n");

Load_Index(thread_e, &chhy_ih_refGenName, &refChromeCont, fileName[1]);


totalLoadingTime += Get_T()-startTime;
fprintf(stdout, "Start alignment!\n");
fprintf(stderr, "Start alignment!\n");

if (output_methy == 0)
{
Expand Down Expand Up @@ -162,17 +149,16 @@ int main(int argc, char *argv[])
}
}



totalMappingTime += Get_T()-startTime;
fprintf(stdout, "sucess!\n");

}
else
{
if (output_methy == 1 && methylation_size % 2 != 0)
{
fprintf(stdout, "The variable 'methylation_size' must be an even! Please change it to be even!\n");
exit(1);
if (output_methy == 1 && methylation_size % 2 != 0)
{
fprintf(stderr, "The variable 'methylation_size' must be an even! Please change it to be even!\n");
exit(1);
}

///_r_fp1
Expand All @@ -195,7 +181,7 @@ int main(int argc, char *argv[])
mappingTime = 0;
loadingTime = 0;
//loadHashTable = &Load_Index;
fprintf(stdout,"Start load hash table!\n");
fprintf(stderr,"Start load hash table!\n");
// loadHashTable = &Load_Index;
Load_Index(thread_e, &chhy_ih_refGenName, &refChromeCont, fileName[1]);

Expand All @@ -207,11 +193,11 @@ int main(int argc, char *argv[])

if (is_local == 1)
{
fprintf(stdout, "Start alignment in default fast mode.\n");
fprintf(stderr, "Start alignment in default fast mode.\n");
}
else
{
fprintf(stdout, "Start alignment in sensitive mode.\n");
fprintf(stderr, "Start alignment in sensitive mode.\n");
}


Expand Down Expand Up @@ -241,8 +227,8 @@ int main(int argc, char *argv[])
Map_Pair_Seq(0);
}
else
{
Map_Pair_Seq_muti_thread(0);
{
Map_Pair_Seq_muti_thread(0);

}

Expand All @@ -255,25 +241,24 @@ int main(int argc, char *argv[])


totalMappingTime += Get_T()-startTime;
fprintf(stdout, "sucess!\n");

}


if (bam_output == 1)
{
///close_bam_file();
close_bam_file_rename(bam_outputFileName, outputFileName);
close_bam_file_rename(bam_outputFileName, outputFileName);

}

///这个一打开速度就奇慢,不知道为什么
///finalizeOutput();

fprintf(stdout, "-----------------------------------------------------------------------------------------------------------\n");
fprintf(stdout, "%19s%16.2f%18.2f\n\n", "Total:",totalLoadingTime, totalMappingTime);
fprintf(stderr, "-----------------------------------------------------------------------------------------------------------\n");
fprintf(stderr, "%19s%16.2f%18.2f\n\n", "Total:",totalLoadingTime, totalMappingTime);

fprintf(stdout, "%-42s%10.2f\n","Total Time:", totalMappingTime+totalLoadingTime);
fprintf(stderr, "%-42s%10.2f\n","Total Time:", totalMappingTime+totalLoadingTime);

long long number_of_read;
long long number_of_unique_mapped_read;
Expand All @@ -284,15 +269,15 @@ int main(int argc, char *argv[])
get_mapping_informations(&number_of_read, &number_of_unique_mapped_read, &number_of_ambiguous_mapped_read,
&number_of_unmapped_read, &number_of_mapped_bases, &number_of_mapped_errors);

fprintf(stdout, "%-48s%lld\n", "No. of Reads:", number_of_read);
fprintf(stdout, "%-48s%lld (%0.2f\%)\n", "No. of Unique Mapped Reads:",
fprintf(stderr, "%-48s%lld\n", "No. of Reads:", number_of_read);
fprintf(stderr, "%-48s%lld (%0.2f\%)\n", "No. of Unique Mapped Reads:",
number_of_unique_mapped_read, ((double)number_of_unique_mapped_read / (double)number_of_read)*100);
fprintf(stdout, "%-48s%lld (%0.2f\%)\n", "No. of Ambiguous Mapped Reads:",
fprintf(stderr, "%-48s%lld (%0.2f\%)\n", "No. of Ambiguous Mapped Reads:",
number_of_ambiguous_mapped_read, ((double)number_of_ambiguous_mapped_read / (double)number_of_read) * 100);
fprintf(stdout, "%-48s%lld (%0.2f\%)\n", "No. of Unmapped Reads:",
fprintf(stderr, "%-48s%lld (%0.2f\%)\n", "No. of Unmapped Reads:",
number_of_unmapped_read, ((double)number_of_unmapped_read / (double)number_of_read) * 100);

fprintf(stdout, "%-47s %0.2f\%\n", "Mismatch and Indel Rate:",
fprintf(stderr, "%-47s %0.2f\%\n", "Mismatch and Indel Rate:",
((double)number_of_mapped_errors / (double)number_of_mapped_bases) * 100);

if (mapstats == 1)
Expand Down Expand Up @@ -327,8 +312,8 @@ int main(int argc, char *argv[])
double total_time = 0;
double startTime = Get_T();

fprintf(stdout, "minVariantDepth: %d\n", minVariantDepth);
fprintf(stdout, "maxVariantFrac: %f\n", maxVariantFrac);
fprintf(stderr, "minVariantDepth: %d\n", minVariantDepth);
fprintf(stderr, "maxVariantFrac: %f\n", maxVariantFrac);

sprintf(fileName[1], "%s.methy", fileName[1]);

Expand All @@ -349,8 +334,8 @@ int main(int argc, char *argv[])

get_genome_cuts(Read_File1);

fprintf(stdout, "genome_cuts: %d\n", genome_cuts);
fprintf(stdout, "PE_distance: %d\n", maxDistance_pair);
fprintf(stderr, "genome_cuts: %d\n", genome_cuts);
fprintf(stderr, "PE_distance: %d\n", maxDistance_pair);

init_output_methy(Read_File1, need_context);

Expand All @@ -364,7 +349,7 @@ int main(int argc, char *argv[])
if (!is_pairedEnd)
{

fprintf(stdout, "Extract from single-end alignment ...\n");
fprintf(stderr, "Extract from single-end alignment ...\n");

if (THREAD_COUNT == 1)
{
Expand All @@ -377,7 +362,7 @@ int main(int argc, char *argv[])
}
else
{
fprintf(stdout, "Extract from paired-end alignment ...\n");
fprintf(stderr, "Extract from paired-end alignment ...\n");

if (THREAD_COUNT == 1)
{
Expand All @@ -393,8 +378,8 @@ int main(int argc, char *argv[])

total_time += Get_T() - startTime;

fprintf(stdout, "-----------------------------------------------------------------------------------------------------------\n");
fprintf(stdout, "%19s%16.2f\n\n", "Total:", total_time);
fprintf(stderr, "-----------------------------------------------------------------------------------------------------------\n");
fprintf(stderr, "%19s%16.2f\n\n", "Total:", total_time);
}


Expand Down
Loading

0 comments on commit 795355a

Please sign in to comment.