Skip to content

Repository files navigation

Copyright © 2023, Shenghao Cao, Mengtian Li & Lei M. Li. Academy of Mathematics and Systems Science, Chinese Academy of Sciences, Beijing 100190, China

RegCloser

1. Introduction

The novel robust regression framework proposed in RegCloser is a general approach to DNA sequence assembly. It is applicable to both NGS and TGS data. In combination with any scaffolding methods, it can be used as a genome gap-closing tool. In the OLC paradigm of de novo assembly, the existing methods find a layout of reads by greedy search. In contrast, the robust regression approach generates a globally optimal layout, which is the minimizer of a convex loss function.

RegCloser can currently be used or tested in the following scenarios:

  • Improve genome N50 by NGS libraries (a small genome example is in test/S.aureus_data), and is scalable to large genomes.
  • Reconstruct complete and accurate microbial genomes by low-cost and accurate NGS data (an example is in test/E.coli_simulation).
  • Generate a globally optimal layout in the de novo assembly of TGS data (an example is in test/E.coli_long_reads).

P.S. We tested the applicability of the robust regression approach to layout generation on TGS long reads in denovo assembly. A further complication than the gap-filling problem is that, from which strand each read comes from the target genomic DNA is unknown. Therefore, we first use a heuristic algorithm to orientate all reads in the connected graph, and then estimate their positions via robust regression.

2. Installation

You can download the software package by the command:

git clone https://github.com/csh3/RegCloser.git

or click the Download Zip button and decompress the software package.

3. Dependencies

The current version requires:

  1. Python3 with the following modules: os, sys, re, argparse, biopython, numpy, math, networkx, scipy, collections, datetime, multiprocessing

  2. BWA (version 0.7.17)

  3. MultiAlignment_func_python.so

The firt two can be installed through the Bioconda channel. The third one has been included in the software package or you can compile the source code MultiAlignment_func_python.cpp on your machine using the following command.

g++ -fPIC MultiAlignment_func_python.cpp -o MultiAlignment_func_python.so -shared -I/home/miniconda3/include/python3.6m # Here /home/miniconda3/include/python3.6m is a directory storing the head file Python.h

4. Usage

4.1. Pipeline

The main program is RunPipeline.py, and the pipeline consists of the following 7 modules. You can start or end with any one module by the option -s or -e. The core innovation of our method lies in the module LocalAssembly that uses the robust regression model and algorithm to assemble short reads into contigs.

1. InitialContig Break the draft genome into contigs
2. Mapping Map sequence reads to the draft genome using BWA and identify anchored reads
3. HighDepth (optional) Identify high depth regions in the contig ends
4. CollectReads Collect reads in the gap regions for local assembly and make tab files of linking information between contigs 5. Re-Scaffold (optional) Generate new scaffolds from initial contigs using SSPACE_Standard_v3.0
6. ReEstimateGapSize Re-estimate gap sizes between contigs
7. LocalAssembly Assemble the collected reads into contigs for gap closing via the robust regression approach

We recommend to use RegCloser in an iterative way that you can take the output genome as the input of the next iteration, and perform several times until no more gaps to be filled.

4.2. Prerequisite file

A prerequisite file is needed to specify the directory storing the sequence reads and the information of different libraries. An example is illustrated below.

Reads_directory: /home/E.coli/reads
frag frag_1.fastq frag_2.fastq 300 20 FR 1
shortjump	shortjump_1.fastq	shortjump_2.fastq	3600 298 RF 2

The first line specifies the code path, and the second line specifies the reads directory. From the third line, each line describes one reads library and contains 7 columns, separated by spaces or tabs. Each column is explained in more detail below.

Column 1: Name of the library
Each library should be designated a different name. Column 2 & 3: Fastq files for both ends
For each paired reads, one of the reads should be in the first file, and the other one in the second file. The paired reads are required to be on the same line.
Column 4:	Average insert size between paired reads
Column 5: Standard deviation of insert size between paired reads
Column 6: Orientation of paired reads, FR or RF
F stands for --> orientation, and R for <-- orientation. Paired-end libraries are FR, and mate-pair libraries are RF.
Column 7: Whether the libary is used for local assembly or making tab files, 1, 2, or 3
1 stands for only local assembly, 2 stands for only making tab files, and 3 for both.

4.3. Basic usage

Run with 40 threads

python RunPipeline.py -p prerequisite -g draft_genome.fasta -d iter-1 -t 40

Re-run the LocalAssembly module

python RunPipeline.py -p prerequisite -g draft_genome.fasta -d iter-1 -t 40 -s LocalAssembly

Iterate over the result of RegCloser

python RunPipeline.py -p prerequisite -g iter-1/output_genome.fasta -d iter-2 -t 40

4.4. Output files

The intermediate and output files are saved under the directory specified by the option -d. RegCloser outputs 4 result files. They are described in details below.

output_genome.fasta saves the output genome sequence with gaps closed by RegCloser. You can specify the filename using option -o according to your preference.

gapSequence.fastq saves the assembled sequences in the gap regions and their Phred quality scores (ASCII_BASE 33). The identifier of each sequence records the gap it comes from. For example, @contig1_contig2_filled means the sequence filled the gap between contig1 and contig2; @contig2_contig3_left means the sequence extended from the left boundary of the gap between contig2 and contig3; @contig3_contig4_right means the sequence extended from the right boundary of the gap between contig3 and contig4.

evidence.fill records the information of the gaps in the output genome. Each line describes one gap and contains 6 columns.

Column 1: Left contig of a gap
Column 2: Right contig of a gap
Column 3 & 4:	Length of sequences extending from the left and right boundaries of a gap
If the gap was filled, column 4 is 0, and column 3 is the length of the filling sequence.
If column 3 is a negative value, it means the two adjacent contigs flanking the gap were merged, and column 3 tells the overlap length.
Column 5: Status of a gap, 0 or 1
If the gap was filled, the flag was set to 1, otherwise 0.
Column 6: Current gap size If the gap was filled, the value is 0.

statistics.txt records the statistics of the genome sequence after gap closing. It includes closed gap number, classified into merged gap number and filled gap number. It also includes total contig length, contig N50, and scaffold N50.

4.5. Command line options

OptionTypeDescription
-pSTRA formatted file specifying the code path, reads directory, and library information. [Prerequisite]
-gSTRDraft genome, required.
-dSTRWorking directory saving intermediate and output files, required.
-oSTROutput file saving gap-closed genome. [output_genome.fasta]
-tINTNumber of threads. [1]
-sSTRStarting module. [Start]
-eSTREnding module. [End]
-rsRe-scaffold using SSPACE. [null]
-fINTContigs shorter than this value will be removed from the draft genome before gap closing. [0]
-mlINTContig end with insert size + ml * std bases were cut out for mapping anchored reads. [3]
-mkINTMinimum seed length in BWA mapping. [19]
-mTINTMinimum score to output in BWA mapping. [30]
-cINTMaximum number of soft-clipped bases on either end of a mapped read. [5]
-mqINTMapped Reads with mapping quality greater than this value will be identified as anchored reads. [60]
-nrNot re-map anchored reads to the whole draft genome to exclude multi-mapped reads. [null]
-hfFilter out anchored reads falling in the high coverage regions. [null]
-raFLOATConsecutive bases with coverage higher then ra * mode coverage will be marked as high coverage regions. [1.8]
-kINTMinimum number of links to compute scaffold in SSPACE. [5]
-aFLOATMaximum link ratio between two best contig pairs in SSPACE. [0.7]
-sdINTDefault standard deviation of gap size. [100]
-qcFLOATMaximum expected erroneous bases in the read used for local assembly. [100]
-lINTLength of the contig end sequence cut out for local assembly. [100]
-rcINTCoverage of reads used for local assembly. [100]
-SFLOATThreshold for selective pairwise alignment. [0.3]
-maINTMatching score in reads pairwise alignment. [1]
-mmINTMismatch penalty in reads pairwise alignment. [20]
-gcINTGap cost in reads pairwise alignment. [30]
-msINTMinimum score to output in reads pairwise alignment. [20]
-hoINTMaximum admissible hanging-out length in reads pairwise alignment. [0]
-wAssign initial weights for detected overlaps. [null]
-r1 FLOATTuning constant of weight function in IRLS algorithm. [2]
-r2 FLOATExcluding samples with residuals greater than this value after IRLS algorithm. [10]
-mTINTMaximum truncated length for alignment merging adjacent contigs. [1000]
-mAINTMatching score in alignment merging adjacent contigs. [1]
-mMINTMismatch penalty in alignment merging adjacent contigs. [2]
-mGINTGap cost in alignment merging adjacent contigs. [3]
-mSINTMinimum alignment score to merge adjacent contigs. [20]
-HOINTMaximum admissible hanging-out length in alignment merging adjacent contigs. [5]

5. Current version

The version of the current release is v1.0.

6. Contact

Please contact cao.shenghao@foxmail.com for any questions.

7. License

GNU General Public License v3.0 only

For details, please read RegCloser/license.txt.

8. Citation

Cao S, Li M, Li LM. RegCloser: a robust regression approach to closing genome gaps. BMC Bioinformatics. 2023;24(1):249. Published 2023 Jun 13. https://doi.org/10.1186/s12859-023-05367-0

About

RegCloser is a genome gap-closing tool based on the robust regression approach, which is conceptually applicable to de novo assembly of NGS and TGS data.

Resources

Stars

16 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
GitHub - csh3/RegCloser: RegCloser is a genome gap-closing tool based on the robust regression approach, which is conceptually applicable to de novo assembly of NGS and TGS data. · GitHub
Skip to content

Repository files navigation

Copyright © 2023, Shenghao Cao, Mengtian Li & Lei M. Li. Academy of Mathematics and Systems Science, Chinese Academy of Sciences, Beijing 100190, China

RegCloser

1. Introduction

The novel robust regression framework proposed in RegCloser is a general approach to DNA sequence assembly. It is applicable to both NGS and TGS data. In combination with any scaffolding methods, it can be used as a genome gap-closing tool. In the OLC paradigm of de novo assembly, the existing methods find a layout of reads by greedy search. In contrast, the robust regression approach generates a globally optimal layout, which is the minimizer of a convex loss function.

RegCloser can currently be used or tested in the following scenarios:

  • Improve genome N50 by NGS libraries (a small genome example is in test/S.aureus_data), and is scalable to large genomes.
  • Reconstruct complete and accurate microbial genomes by low-cost and accurate NGS data (an example is in test/E.coli_simulation).
  • Generate a globally optimal layout in the de novo assembly of TGS data (an example is in test/E.coli_long_reads).

P.S. We tested the applicability of the robust regression approach to layout generation on TGS long reads in denovo assembly. A further complication than the gap-filling problem is that, from which strand each read comes from the target genomic DNA is unknown. Therefore, we first use a heuristic algorithm to orientate all reads in the connected graph, and then estimate their positions via robust regression.

2. Installation

You can download the software package by the command:

git clone https://github.com/csh3/RegCloser.git

or click the Download Zip button and decompress the software package.

3. Dependencies

The current version requires:

  1. Python3 with the following modules: os, sys, re, argparse, biopython, numpy, math, networkx, scipy, collections, datetime, multiprocessing

  2. BWA (version 0.7.17)

  3. MultiAlignment_func_python.so

The firt two can be installed through the Bioconda channel. The third one has been included in the software package or you can compile the source code MultiAlignment_func_python.cpp on your machine using the following command.

g++ -fPIC MultiAlignment_func_python.cpp -o MultiAlignment_func_python.so -shared -I/home/miniconda3/include/python3.6m # Here /home/miniconda3/include/python3.6m is a directory storing the head file Python.h

4. Usage

4.1. Pipeline

The main program is RunPipeline.py, and the pipeline consists of the following 7 modules. You can start or end with any one module by the option -s or -e. The core innovation of our method lies in the module LocalAssembly that uses the robust regression model and algorithm to assemble short reads into contigs.

1. InitialContig Break the draft genome into contigs
2. Mapping Map sequence reads to the draft genome using BWA and identify anchored reads
3. HighDepth (optional) Identify high depth regions in the contig ends
4. CollectReads Collect reads in the gap regions for local assembly and make tab files of linking information between contigs 5. Re-Scaffold (optional) Generate new scaffolds from initial contigs using SSPACE_Standard_v3.0
6. ReEstimateGapSize Re-estimate gap sizes between contigs
7. LocalAssembly Assemble the collected reads into contigs for gap closing via the robust regression approach

We recommend to use RegCloser in an iterative way that you can take the output genome as the input of the next iteration, and perform several times until no more gaps to be filled.

4.2. Prerequisite file

A prerequisite file is needed to specify the directory storing the sequence reads and the information of different libraries. An example is illustrated below.

Reads_directory: /home/E.coli/reads
frag frag_1.fastq frag_2.fastq 300 20 FR 1
shortjump	shortjump_1.fastq	shortjump_2.fastq	3600 298 RF 2

The first line specifies the code path, and the second line specifies the reads directory. From the third line, each line describes one reads library and contains 7 columns, separated by spaces or tabs. Each column is explained in more detail below.

Column 1: Name of the library
Each library should be designated a different name. Column 2 & 3: Fastq files for both ends
For each paired reads, one of the reads should be in the first file, and the other one in the second file. The paired reads are required to be on the same line.
Column 4:	Average insert size between paired reads
Column 5: Standard deviation of insert size between paired reads
Column 6: Orientation of paired reads, FR or RF
F stands for --> orientation, and R for <-- orientation. Paired-end libraries are FR, and mate-pair libraries are RF.
Column 7: Whether the libary is used for local assembly or making tab files, 1, 2, or 3
1 stands for only local assembly, 2 stands for only making tab files, and 3 for both.

4.3. Basic usage

Run with 40 threads

python RunPipeline.py -p prerequisite -g draft_genome.fasta -d iter-1 -t 40

Re-run the LocalAssembly module

python RunPipeline.py -p prerequisite -g draft_genome.fasta -d iter-1 -t 40 -s LocalAssembly

Iterate over the result of RegCloser

python RunPipeline.py -p prerequisite -g iter-1/output_genome.fasta -d iter-2 -t 40

4.4. Output files

The intermediate and output files are saved under the directory specified by the option -d. RegCloser outputs 4 result files. They are described in details below.

output_genome.fasta saves the output genome sequence with gaps closed by RegCloser. You can specify the filename using option -o according to your preference.

gapSequence.fastq saves the assembled sequences in the gap regions and their Phred quality scores (ASCII_BASE 33). The identifier of each sequence records the gap it comes from. For example, @contig1_contig2_filled means the sequence filled the gap between contig1 and contig2; @contig2_contig3_left means the sequence extended from the left boundary of the gap between contig2 and contig3; @contig3_contig4_right means the sequence extended from the right boundary of the gap between contig3 and contig4.

evidence.fill records the information of the gaps in the output genome. Each line describes one gap and contains 6 columns.

Column 1: Left contig of a gap
Column 2: Right contig of a gap
Column 3 & 4:	Length of sequences extending from the left and right boundaries of a gap
If the gap was filled, column 4 is 0, and column 3 is the length of the filling sequence.
If column 3 is a negative value, it means the two adjacent contigs flanking the gap were merged, and column 3 tells the overlap length.
Column 5: Status of a gap, 0 or 1
If the gap was filled, the flag was set to 1, otherwise 0.
Column 6: Current gap size If the gap was filled, the value is 0.

statistics.txt records the statistics of the genome sequence after gap closing. It includes closed gap number, classified into merged gap number and filled gap number. It also includes total contig length, contig N50, and scaffold N50.

4.5. Command line options

OptionTypeDescription
-pSTRA formatted file specifying the code path, reads directory, and library information. [Prerequisite]
-gSTRDraft genome, required.
-dSTRWorking directory saving intermediate and output files, required.
-oSTROutput file saving gap-closed genome. [output_genome.fasta]
-tINTNumber of threads. [1]
-sSTRStarting module. [Start]
-eSTREnding module. [End]
-rsRe-scaffold using SSPACE. [null]
-fINTContigs shorter than this value will be removed from the draft genome before gap closing. [0]
-mlINTContig end with insert size + ml * std bases were cut out for mapping anchored reads. [3]
-mkINTMinimum seed length in BWA mapping. [19]
-mTINTMinimum score to output in BWA mapping. [30]
-cINTMaximum number of soft-clipped bases on either end of a mapped read. [5]
-mqINTMapped Reads with mapping quality greater than this value will be identified as anchored reads. [60]
-nrNot re-map anchored reads to the whole draft genome to exclude multi-mapped reads. [null]
-hfFilter out anchored reads falling in the high coverage regions. [null]
-raFLOATConsecutive bases with coverage higher then ra * mode coverage will be marked as high coverage regions. [1.8]
-kINTMinimum number of links to compute scaffold in SSPACE. [5]
-aFLOATMaximum link ratio between two best contig pairs in SSPACE. [0.7]
-sdINTDefault standard deviation of gap size. [100]
-qcFLOATMaximum expected erroneous bases in the read used for local assembly. [100]
-lINTLength of the contig end sequence cut out for local assembly. [100]
-rcINTCoverage of reads used for local assembly. [100]
-SFLOATThreshold for selective pairwise alignment. [0.3]
-maINTMatching score in reads pairwise alignment. [1]
-mmINTMismatch penalty in reads pairwise alignment. [20]
-gcINTGap cost in reads pairwise alignment. [30]
-msINTMinimum score to output in reads pairwise alignment. [20]
-hoINTMaximum admissible hanging-out length in reads pairwise alignment. [0]
-wAssign initial weights for detected overlaps. [null]
-r1 FLOATTuning constant of weight function in IRLS algorithm. [2]
-r2 FLOATExcluding samples with residuals greater than this value after IRLS algorithm. [10]
-mTINTMaximum truncated length for alignment merging adjacent contigs. [1000]
-mAINTMatching score in alignment merging adjacent contigs. [1]
-mMINTMismatch penalty in alignment merging adjacent contigs. [2]
-mGINTGap cost in alignment merging adjacent contigs. [3]
-mSINTMinimum alignment score to merge adjacent contigs. [20]
-HOINTMaximum admissible hanging-out length in alignment merging adjacent contigs. [5]

5. Current version

The version of the current release is v1.0.

6. Contact

Please contact cao.shenghao@foxmail.com for any questions.

7. License

GNU General Public License v3.0 only

For details, please read RegCloser/license.txt.

8. Citation

Cao S, Li M, Li LM. RegCloser: a robust regression approach to closing genome gaps. BMC Bioinformatics. 2023;24(1):249. Published 2023 Jun 13. https://doi.org/10.1186/s12859-023-05367-0

About

RegCloser is a genome gap-closing tool based on the robust regression approach, which is conceptually applicable to de novo assembly of NGS and TGS data.

Resources

Stars

16 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - csh3/RegCloser: RegCloser is a genome gap-closing tool based on the robust regression approach, which is conceptually applicable to de novo assembly of NGS and TGS data. · GitHub
Skip to content

Repository files navigation

Copyright © 2023, Shenghao Cao, Mengtian Li & Lei M. Li. Academy of Mathematics and Systems Science, Chinese Academy of Sciences, Beijing 100190, China

RegCloser

1. Introduction

The novel robust regression framework proposed in RegCloser is a general approach to DNA sequence assembly. It is applicable to both NGS and TGS data. In combination with any scaffolding methods, it can be used as a genome gap-closing tool. In the OLC paradigm of de novo assembly, the existing methods find a layout of reads by greedy search. In contrast, the robust regression approach generates a globally optimal layout, which is the minimizer of a convex loss function.

RegCloser can currently be used or tested in the following scenarios:

  • Improve genome N50 by NGS libraries (a small genome example is in test/S.aureus_data), and is scalable to large genomes.
  • Reconstruct complete and accurate microbial genomes by low-cost and accurate NGS data (an example is in test/E.coli_simulation).
  • Generate a globally optimal layout in the de novo assembly of TGS data (an example is in test/E.coli_long_reads).

P.S. We tested the applicability of the robust regression approach to layout generation on TGS long reads in denovo assembly. A further complication than the gap-filling problem is that, from which strand each read comes from the target genomic DNA is unknown. Therefore, we first use a heuristic algorithm to orientate all reads in the connected graph, and then estimate their positions via robust regression.

2. Installation

You can download the software package by the command:

git clone https://github.com/csh3/RegCloser.git

or click the Download Zip button and decompress the software package.

3. Dependencies

The current version requires:

  1. Python3 with the following modules: os, sys, re, argparse, biopython, numpy, math, networkx, scipy, collections, datetime, multiprocessing

  2. BWA (version 0.7.17)

  3. MultiAlignment_func_python.so

The firt two can be installed through the Bioconda channel. The third one has been included in the software package or you can compile the source code MultiAlignment_func_python.cpp on your machine using the following command.

g++ -fPIC MultiAlignment_func_python.cpp -o MultiAlignment_func_python.so -shared -I/home/miniconda3/include/python3.6m # Here /home/miniconda3/include/python3.6m is a directory storing the head file Python.h

4. Usage

4.1. Pipeline

The main program is RunPipeline.py, and the pipeline consists of the following 7 modules. You can start or end with any one module by the option -s or -e. The core innovation of our method lies in the module LocalAssembly that uses the robust regression model and algorithm to assemble short reads into contigs.

1. InitialContig Break the draft genome into contigs
2. Mapping Map sequence reads to the draft genome using BWA and identify anchored reads
3. HighDepth (optional) Identify high depth regions in the contig ends
4. CollectReads Collect reads in the gap regions for local assembly and make tab files of linking information between contigs 5. Re-Scaffold (optional) Generate new scaffolds from initial contigs using SSPACE_Standard_v3.0
6. ReEstimateGapSize Re-estimate gap sizes between contigs
7. LocalAssembly Assemble the collected reads into contigs for gap closing via the robust regression approach

We recommend to use RegCloser in an iterative way that you can take the output genome as the input of the next iteration, and perform several times until no more gaps to be filled.

4.2. Prerequisite file

A prerequisite file is needed to specify the directory storing the sequence reads and the information of different libraries. An example is illustrated below.

Reads_directory: /home/E.coli/reads
frag frag_1.fastq frag_2.fastq 300 20 FR 1
shortjump	shortjump_1.fastq	shortjump_2.fastq	3600 298 RF 2

The first line specifies the code path, and the second line specifies the reads directory. From the third line, each line describes one reads library and contains 7 columns, separated by spaces or tabs. Each column is explained in more detail below.

Column 1: Name of the library
Each library should be designated a different name. Column 2 & 3: Fastq files for both ends
For each paired reads, one of the reads should be in the first file, and the other one in the second file. The paired reads are required to be on the same line.
Column 4:	Average insert size between paired reads
Column 5: Standard deviation of insert size between paired reads
Column 6: Orientation of paired reads, FR or RF
F stands for --> orientation, and R for <-- orientation. Paired-end libraries are FR, and mate-pair libraries are RF.
Column 7: Whether the libary is used for local assembly or making tab files, 1, 2, or 3
1 stands for only local assembly, 2 stands for only making tab files, and 3 for both.

4.3. Basic usage

Run with 40 threads

python RunPipeline.py -p prerequisite -g draft_genome.fasta -d iter-1 -t 40

Re-run the LocalAssembly module

python RunPipeline.py -p prerequisite -g draft_genome.fasta -d iter-1 -t 40 -s LocalAssembly

Iterate over the result of RegCloser

python RunPipeline.py -p prerequisite -g iter-1/output_genome.fasta -d iter-2 -t 40

4.4. Output files

The intermediate and output files are saved under the directory specified by the option -d. RegCloser outputs 4 result files. They are described in details below.

output_genome.fasta saves the output genome sequence with gaps closed by RegCloser. You can specify the filename using option -o according to your preference.

gapSequence.fastq saves the assembled sequences in the gap regions and their Phred quality scores (ASCII_BASE 33). The identifier of each sequence records the gap it comes from. For example, @contig1_contig2_filled means the sequence filled the gap between contig1 and contig2; @contig2_contig3_left means the sequence extended from the left boundary of the gap between contig2 and contig3; @contig3_contig4_right means the sequence extended from the right boundary of the gap between contig3 and contig4.

evidence.fill records the information of the gaps in the output genome. Each line describes one gap and contains 6 columns.

Column 1: Left contig of a gap
Column 2: Right contig of a gap
Column 3 & 4:	Length of sequences extending from the left and right boundaries of a gap
If the gap was filled, column 4 is 0, and column 3 is the length of the filling sequence.
If column 3 is a negative value, it means the two adjacent contigs flanking the gap were merged, and column 3 tells the overlap length.
Column 5: Status of a gap, 0 or 1
If the gap was filled, the flag was set to 1, otherwise 0.
Column 6: Current gap size If the gap was filled, the value is 0.

statistics.txt records the statistics of the genome sequence after gap closing. It includes closed gap number, classified into merged gap number and filled gap number. It also includes total contig length, contig N50, and scaffold N50.

4.5. Command line options

OptionTypeDescription
-pSTRA formatted file specifying the code path, reads directory, and library information. [Prerequisite]
-gSTRDraft genome, required.
-dSTRWorking directory saving intermediate and output files, required.
-oSTROutput file saving gap-closed genome. [output_genome.fasta]
-tINTNumber of threads. [1]
-sSTRStarting module. [Start]
-eSTREnding module. [End]
-rsRe-scaffold using SSPACE. [null]
-fINTContigs shorter than this value will be removed from the draft genome before gap closing. [0]
-mlINTContig end with insert size + ml * std bases were cut out for mapping anchored reads. [3]
-mkINTMinimum seed length in BWA mapping. [19]
-mTINTMinimum score to output in BWA mapping. [30]
-cINTMaximum number of soft-clipped bases on either end of a mapped read. [5]
-mqINTMapped Reads with mapping quality greater than this value will be identified as anchored reads. [60]
-nrNot re-map anchored reads to the whole draft genome to exclude multi-mapped reads. [null]
-hfFilter out anchored reads falling in the high coverage regions. [null]
-raFLOATConsecutive bases with coverage higher then ra * mode coverage will be marked as high coverage regions. [1.8]
-kINTMinimum number of links to compute scaffold in SSPACE. [5]
-aFLOATMaximum link ratio between two best contig pairs in SSPACE. [0.7]
-sdINTDefault standard deviation of gap size. [100]
-qcFLOATMaximum expected erroneous bases in the read used for local assembly. [100]
-lINTLength of the contig end sequence cut out for local assembly. [100]
-rcINTCoverage of reads used for local assembly. [100]
-SFLOATThreshold for selective pairwise alignment. [0.3]
-maINTMatching score in reads pairwise alignment. [1]
-mmINTMismatch penalty in reads pairwise alignment. [20]
-gcINTGap cost in reads pairwise alignment. [30]
-msINTMinimum score to output in reads pairwise alignment. [20]
-hoINTMaximum admissible hanging-out length in reads pairwise alignment. [0]
-wAssign initial weights for detected overlaps. [null]
-r1 FLOATTuning constant of weight function in IRLS algorithm. [2]
-r2 FLOATExcluding samples with residuals greater than this value after IRLS algorithm. [10]
-mTINTMaximum truncated length for alignment merging adjacent contigs. [1000]
-mAINTMatching score in alignment merging adjacent contigs. [1]
-mMINTMismatch penalty in alignment merging adjacent contigs. [2]
-mGINTGap cost in alignment merging adjacent contigs. [3]
-mSINTMinimum alignment score to merge adjacent contigs. [20]
-HOINTMaximum admissible hanging-out length in alignment merging adjacent contigs. [5]

5. Current version

The version of the current release is v1.0.

6. Contact

Please contact cao.shenghao@foxmail.com for any questions.

7. License

GNU General Public License v3.0 only

For details, please read RegCloser/license.txt.

8. Citation

Cao S, Li M, Li LM. RegCloser: a robust regression approach to closing genome gaps. BMC Bioinformatics. 2023;24(1):249. Published 2023 Jun 13. https://doi.org/10.1186/s12859-023-05367-0

About

RegCloser is a genome gap-closing tool based on the robust regression approach, which is conceptually applicable to de novo assembly of NGS and TGS data.

Resources

Stars

16 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - csh3/RegCloser: RegCloser is a genome gap-closing tool based on the robust regression approach, which is conceptually applicable to de novo assembly of NGS and TGS data. · GitHub
Skip to content

Repository files navigation

Copyright © 2023, Shenghao Cao, Mengtian Li & Lei M. Li. Academy of Mathematics and Systems Science, Chinese Academy of Sciences, Beijing 100190, China

RegCloser

1. Introduction

The novel robust regression framework proposed in RegCloser is a general approach to DNA sequence assembly. It is applicable to both NGS and TGS data. In combination with any scaffolding methods, it can be used as a genome gap-closing tool. In the OLC paradigm of de novo assembly, the existing methods find a layout of reads by greedy search. In contrast, the robust regression approach generates a globally optimal layout, which is the minimizer of a convex loss function.

RegCloser can currently be used or tested in the following scenarios:

  • Improve genome N50 by NGS libraries (a small genome example is in test/S.aureus_data), and is scalable to large genomes.
  • Reconstruct complete and accurate microbial genomes by low-cost and accurate NGS data (an example is in test/E.coli_simulation).
  • Generate a globally optimal layout in the de novo assembly of TGS data (an example is in test/E.coli_long_reads).

P.S. We tested the applicability of the robust regression approach to layout generation on TGS long reads in denovo assembly. A further complication than the gap-filling problem is that, from which strand each read comes from the target genomic DNA is unknown. Therefore, we first use a heuristic algorithm to orientate all reads in the connected graph, and then estimate their positions via robust regression.

2. Installation

You can download the software package by the command:

git clone https://github.com/csh3/RegCloser.git

or click the Download Zip button and decompress the software package.

3. Dependencies

The current version requires:

  1. Python3 with the following modules: os, sys, re, argparse, biopython, numpy, math, networkx, scipy, collections, datetime, multiprocessing

  2. BWA (version 0.7.17)

  3. MultiAlignment_func_python.so

The firt two can be installed through the Bioconda channel. The third one has been included in the software package or you can compile the source code MultiAlignment_func_python.cpp on your machine using the following command.

g++ -fPIC MultiAlignment_func_python.cpp -o MultiAlignment_func_python.so -shared -I/home/miniconda3/include/python3.6m # Here /home/miniconda3/include/python3.6m is a directory storing the head file Python.h

4. Usage

4.1. Pipeline

The main program is RunPipeline.py, and the pipeline consists of the following 7 modules. You can start or end with any one module by the option -s or -e. The core innovation of our method lies in the module LocalAssembly that uses the robust regression model and algorithm to assemble short reads into contigs.

1. InitialContig Break the draft genome into contigs
2. Mapping Map sequence reads to the draft genome using BWA and identify anchored reads
3. HighDepth (optional) Identify high depth regions in the contig ends
4. CollectReads Collect reads in the gap regions for local assembly and make tab files of linking information between contigs 5. Re-Scaffold (optional) Generate new scaffolds from initial contigs using SSPACE_Standard_v3.0
6. ReEstimateGapSize Re-estimate gap sizes between contigs
7. LocalAssembly Assemble the collected reads into contigs for gap closing via the robust regression approach

We recommend to use RegCloser in an iterative way that you can take the output genome as the input of the next iteration, and perform several times until no more gaps to be filled.

4.2. Prerequisite file

A prerequisite file is needed to specify the directory storing the sequence reads and the information of different libraries. An example is illustrated below.

Reads_directory: /home/E.coli/reads
frag frag_1.fastq frag_2.fastq 300 20 FR 1
shortjump	shortjump_1.fastq	shortjump_2.fastq	3600 298 RF 2

The first line specifies the code path, and the second line specifies the reads directory. From the third line, each line describes one reads library and contains 7 columns, separated by spaces or tabs. Each column is explained in more detail below.

Column 1: Name of the library
Each library should be designated a different name. Column 2 & 3: Fastq files for both ends
For each paired reads, one of the reads should be in the first file, and the other one in the second file. The paired reads are required to be on the same line.
Column 4:	Average insert size between paired reads
Column 5: Standard deviation of insert size between paired reads
Column 6: Orientation of paired reads, FR or RF
F stands for --> orientation, and R for <-- orientation. Paired-end libraries are FR, and mate-pair libraries are RF.
Column 7: Whether the libary is used for local assembly or making tab files, 1, 2, or 3
1 stands for only local assembly, 2 stands for only making tab files, and 3 for both.

4.3. Basic usage

Run with 40 threads

python RunPipeline.py -p prerequisite -g draft_genome.fasta -d iter-1 -t 40

Re-run the LocalAssembly module

python RunPipeline.py -p prerequisite -g draft_genome.fasta -d iter-1 -t 40 -s LocalAssembly

Iterate over the result of RegCloser

python RunPipeline.py -p prerequisite -g iter-1/output_genome.fasta -d iter-2 -t 40

4.4. Output files

The intermediate and output files are saved under the directory specified by the option -d. RegCloser outputs 4 result files. They are described in details below.

output_genome.fasta saves the output genome sequence with gaps closed by RegCloser. You can specify the filename using option -o according to your preference.

gapSequence.fastq saves the assembled sequences in the gap regions and their Phred quality scores (ASCII_BASE 33). The identifier of each sequence records the gap it comes from. For example, @contig1_contig2_filled means the sequence filled the gap between contig1 and contig2; @contig2_contig3_left means the sequence extended from the left boundary of the gap between contig2 and contig3; @contig3_contig4_right means the sequence extended from the right boundary of the gap between contig3 and contig4.

evidence.fill records the information of the gaps in the output genome. Each line describes one gap and contains 6 columns.

Column 1: Left contig of a gap
Column 2: Right contig of a gap
Column 3 & 4:	Length of sequences extending from the left and right boundaries of a gap
If the gap was filled, column 4 is 0, and column 3 is the length of the filling sequence.
If column 3 is a negative value, it means the two adjacent contigs flanking the gap were merged, and column 3 tells the overlap length.
Column 5: Status of a gap, 0 or 1
If the gap was filled, the flag was set to 1, otherwise 0.
Column 6: Current gap size If the gap was filled, the value is 0.

statistics.txt records the statistics of the genome sequence after gap closing. It includes closed gap number, classified into merged gap number and filled gap number. It also includes total contig length, contig N50, and scaffold N50.

4.5. Command line options

OptionTypeDescription
-pSTRA formatted file specifying the code path, reads directory, and library information. [Prerequisite]
-gSTRDraft genome, required.
-dSTRWorking directory saving intermediate and output files, required.
-oSTROutput file saving gap-closed genome. [output_genome.fasta]
-tINTNumber of threads. [1]
-sSTRStarting module. [Start]
-eSTREnding module. [End]
-rsRe-scaffold using SSPACE. [null]
-fINTContigs shorter than this value will be removed from the draft genome before gap closing. [0]
-mlINTContig end with insert size + ml * std bases were cut out for mapping anchored reads. [3]
-mkINTMinimum seed length in BWA mapping. [19]
-mTINTMinimum score to output in BWA mapping. [30]
-cINTMaximum number of soft-clipped bases on either end of a mapped read. [5]
-mqINTMapped Reads with mapping quality greater than this value will be identified as anchored reads. [60]
-nrNot re-map anchored reads to the whole draft genome to exclude multi-mapped reads. [null]
-hfFilter out anchored reads falling in the high coverage regions. [null]
-raFLOATConsecutive bases with coverage higher then ra * mode coverage will be marked as high coverage regions. [1.8]
-kINTMinimum number of links to compute scaffold in SSPACE. [5]
-aFLOATMaximum link ratio between two best contig pairs in SSPACE. [0.7]
-sdINTDefault standard deviation of gap size. [100]
-qcFLOATMaximum expected erroneous bases in the read used for local assembly. [100]
-lINTLength of the contig end sequence cut out for local assembly. [100]
-rcINTCoverage of reads used for local assembly. [100]
-SFLOATThreshold for selective pairwise alignment. [0.3]
-maINTMatching score in reads pairwise alignment. [1]
-mmINTMismatch penalty in reads pairwise alignment. [20]
-gcINTGap cost in reads pairwise alignment. [30]
-msINTMinimum score to output in reads pairwise alignment. [20]
-hoINTMaximum admissible hanging-out length in reads pairwise alignment. [0]
-wAssign initial weights for detected overlaps. [null]
-r1 FLOATTuning constant of weight function in IRLS algorithm. [2]
-r2 FLOATExcluding samples with residuals greater than this value after IRLS algorithm. [10]
-mTINTMaximum truncated length for alignment merging adjacent contigs. [1000]
-mAINTMatching score in alignment merging adjacent contigs. [1]
-mMINTMismatch penalty in alignment merging adjacent contigs. [2]
-mGINTGap cost in alignment merging adjacent contigs. [3]
-mSINTMinimum alignment score to merge adjacent contigs. [20]
-HOINTMaximum admissible hanging-out length in alignment merging adjacent contigs. [5]

5. Current version

The version of the current release is v1.0.

6. Contact

Please contact cao.shenghao@foxmail.com for any questions.

7. License

GNU General Public License v3.0 only

For details, please read RegCloser/license.txt.

8. Citation

Cao S, Li M, Li LM. RegCloser: a robust regression approach to closing genome gaps. BMC Bioinformatics. 2023;24(1):249. Published 2023 Jun 13. https://doi.org/10.1186/s12859-023-05367-0

About

RegCloser is a genome gap-closing tool based on the robust regression approach, which is conceptually applicable to de novo assembly of NGS and TGS data.

Resources

Stars

16 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' GitHub - csh3/RegCloser: RegCloser is a genome gap-closing tool based on the robust regression approach, which is conceptually applicable to de novo assembly of NGS and TGS data. · GitHub
Skip to content

Repository files navigation

Copyright © 2023, Shenghao Cao, Mengtian Li & Lei M. Li. Academy of Mathematics and Systems Science, Chinese Academy of Sciences, Beijing 100190, China

RegCloser

1. Introduction

The novel robust regression framework proposed in RegCloser is a general approach to DNA sequence assembly. It is applicable to both NGS and TGS data. In combination with any scaffolding methods, it can be used as a genome gap-closing tool. In the OLC paradigm of de novo assembly, the existing methods find a layout of reads by greedy search. In contrast, the robust regression approach generates a globally optimal layout, which is the minimizer of a convex loss function.

RegCloser can currently be used or tested in the following scenarios:

  • Improve genome N50 by NGS libraries (a small genome example is in test/S.aureus_data), and is scalable to large genomes.
  • Reconstruct complete and accurate microbial genomes by low-cost and accurate NGS data (an example is in test/E.coli_simulation).
  • Generate a globally optimal layout in the de novo assembly of TGS data (an example is in test/E.coli_long_reads).

P.S. We tested the applicability of the robust regression approach to layout generation on TGS long reads in denovo assembly. A further complication than the gap-filling problem is that, from which strand each read comes from the target genomic DNA is unknown. Therefore, we first use a heuristic algorithm to orientate all reads in the connected graph, and then estimate their positions via robust regression.

2. Installation

You can download the software package by the command:

git clone https://github.com/csh3/RegCloser.git

or click the Download Zip button and decompress the software package.

3. Dependencies

The current version requires:

  1. Python3 with the following modules: os, sys, re, argparse, biopython, numpy, math, networkx, scipy, collections, datetime, multiprocessing

  2. BWA (version 0.7.17)

  3. MultiAlignment_func_python.so

The firt two can be installed through the Bioconda channel. The third one has been included in the software package or you can compile the source code MultiAlignment_func_python.cpp on your machine using the following command.

g++ -fPIC MultiAlignment_func_python.cpp -o MultiAlignment_func_python.so -shared -I/home/miniconda3/include/python3.6m # Here /home/miniconda3/include/python3.6m is a directory storing the head file Python.h

4. Usage

4.1. Pipeline

The main program is RunPipeline.py, and the pipeline consists of the following 7 modules. You can start or end with any one module by the option -s or -e. The core innovation of our method lies in the module LocalAssembly that uses the robust regression model and algorithm to assemble short reads into contigs.

1. InitialContig Break the draft genome into contigs
2. Mapping Map sequence reads to the draft genome using BWA and identify anchored reads
3. HighDepth (optional) Identify high depth regions in the contig ends
4. CollectReads Collect reads in the gap regions for local assembly and make tab files of linking information between contigs 5. Re-Scaffold (optional) Generate new scaffolds from initial contigs using SSPACE_Standard_v3.0
6. ReEstimateGapSize Re-estimate gap sizes between contigs
7. LocalAssembly Assemble the collected reads into contigs for gap closing via the robust regression approach

We recommend to use RegCloser in an iterative way that you can take the output genome as the input of the next iteration, and perform several times until no more gaps to be filled.

4.2. Prerequisite file

A prerequisite file is needed to specify the directory storing the sequence reads and the information of different libraries. An example is illustrated below.

Reads_directory: /home/E.coli/reads
frag frag_1.fastq frag_2.fastq 300 20 FR 1
shortjump	shortjump_1.fastq	shortjump_2.fastq	3600 298 RF 2

The first line specifies the code path, and the second line specifies the reads directory. From the third line, each line describes one reads library and contains 7 columns, separated by spaces or tabs. Each column is explained in more detail below.

Column 1: Name of the library
Each library should be designated a different name. Column 2 & 3: Fastq files for both ends
For each paired reads, one of the reads should be in the first file, and the other one in the second file. The paired reads are required to be on the same line.
Column 4:	Average insert size between paired reads
Column 5: Standard deviation of insert size between paired reads
Column 6: Orientation of paired reads, FR or RF
F stands for --> orientation, and R for <-- orientation. Paired-end libraries are FR, and mate-pair libraries are RF.
Column 7: Whether the libary is used for local assembly or making tab files, 1, 2, or 3
1 stands for only local assembly, 2 stands for only making tab files, and 3 for both.

4.3. Basic usage

Run with 40 threads

python RunPipeline.py -p prerequisite -g draft_genome.fasta -d iter-1 -t 40

Re-run the LocalAssembly module

python RunPipeline.py -p prerequisite -g draft_genome.fasta -d iter-1 -t 40 -s LocalAssembly

Iterate over the result of RegCloser

python RunPipeline.py -p prerequisite -g iter-1/output_genome.fasta -d iter-2 -t 40

4.4. Output files

The intermediate and output files are saved under the directory specified by the option -d. RegCloser outputs 4 result files. They are described in details below.

output_genome.fasta saves the output genome sequence with gaps closed by RegCloser. You can specify the filename using option -o according to your preference.

gapSequence.fastq saves the assembled sequences in the gap regions and their Phred quality scores (ASCII_BASE 33). The identifier of each sequence records the gap it comes from. For example, @contig1_contig2_filled means the sequence filled the gap between contig1 and contig2; @contig2_contig3_left means the sequence extended from the left boundary of the gap between contig2 and contig3; @contig3_contig4_right means the sequence extended from the right boundary of the gap between contig3 and contig4.

evidence.fill records the information of the gaps in the output genome. Each line describes one gap and contains 6 columns.

Column 1: Left contig of a gap
Column 2: Right contig of a gap
Column 3 & 4:	Length of sequences extending from the left and right boundaries of a gap
If the gap was filled, column 4 is 0, and column 3 is the length of the filling sequence.
If column 3 is a negative value, it means the two adjacent contigs flanking the gap were merged, and column 3 tells the overlap length.
Column 5: Status of a gap, 0 or 1
If the gap was filled, the flag was set to 1, otherwise 0.
Column 6: Current gap size If the gap was filled, the value is 0.

statistics.txt records the statistics of the genome sequence after gap closing. It includes closed gap number, classified into merged gap number and filled gap number. It also includes total contig length, contig N50, and scaffold N50.

4.5. Command line options

OptionTypeDescription
-pSTRA formatted file specifying the code path, reads directory, and library information. [Prerequisite]
-gSTRDraft genome, required.
-dSTRWorking directory saving intermediate and output files, required.
-oSTROutput file saving gap-closed genome. [output_genome.fasta]
-tINTNumber of threads. [1]
-sSTRStarting module. [Start]
-eSTREnding module. [End]
-rsRe-scaffold using SSPACE. [null]
-fINTContigs shorter than this value will be removed from the draft genome before gap closing. [0]
-mlINTContig end with insert size + ml * std bases were cut out for mapping anchored reads. [3]
-mkINTMinimum seed length in BWA mapping. [19]
-mTINTMinimum score to output in BWA mapping. [30]
-cINTMaximum number of soft-clipped bases on either end of a mapped read. [5]
-mqINTMapped Reads with mapping quality greater than this value will be identified as anchored reads. [60]
-nrNot re-map anchored reads to the whole draft genome to exclude multi-mapped reads. [null]
-hfFilter out anchored reads falling in the high coverage regions. [null]
-raFLOATConsecutive bases with coverage higher then ra * mode coverage will be marked as high coverage regions. [1.8]
-kINTMinimum number of links to compute scaffold in SSPACE. [5]
-aFLOATMaximum link ratio between two best contig pairs in SSPACE. [0.7]
-sdINTDefault standard deviation of gap size. [100]
-qcFLOATMaximum expected erroneous bases in the read used for local assembly. [100]
-lINTLength of the contig end sequence cut out for local assembly. [100]
-rcINTCoverage of reads used for local assembly. [100]
-SFLOATThreshold for selective pairwise alignment. [0.3]
-maINTMatching score in reads pairwise alignment. [1]
-mmINTMismatch penalty in reads pairwise alignment. [20]
-gcINTGap cost in reads pairwise alignment. [30]
-msINTMinimum score to output in reads pairwise alignment. [20]
-hoINTMaximum admissible hanging-out length in reads pairwise alignment. [0]
-wAssign initial weights for detected overlaps. [null]
-r1 FLOATTuning constant of weight function in IRLS algorithm. [2]
-r2 FLOATExcluding samples with residuals greater than this value after IRLS algorithm. [10]
-mTINTMaximum truncated length for alignment merging adjacent contigs. [1000]
-mAINTMatching score in alignment merging adjacent contigs. [1]
-mMINTMismatch penalty in alignment merging adjacent contigs. [2]
-mGINTGap cost in alignment merging adjacent contigs. [3]
-mSINTMinimum alignment score to merge adjacent contigs. [20]
-HOINTMaximum admissible hanging-out length in alignment merging adjacent contigs. [5]

5. Current version

The version of the current release is v1.0.

6. Contact

Please contact cao.shenghao@foxmail.com for any questions.

7. License

GNU General Public License v3.0 only

For details, please read RegCloser/license.txt.

8. Citation

Cao S, Li M, Li LM. RegCloser: a robust regression approach to closing genome gaps. BMC Bioinformatics. 2023;24(1):249. Published 2023 Jun 13. https://doi.org/10.1186/s12859-023-05367-0

About

RegCloser is a genome gap-closing tool based on the robust regression approach, which is conceptually applicable to de novo assembly of NGS and TGS data.

Resources

Stars

16 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - csh3/RegCloser: RegCloser is a genome gap-closing tool based on the robust regression approach, which is conceptually applicable to de novo assembly of NGS and TGS data. · GitHub
Skip to content

Repository files navigation

Copyright © 2023, Shenghao Cao, Mengtian Li & Lei M. Li. Academy of Mathematics and Systems Science, Chinese Academy of Sciences, Beijing 100190, China

RegCloser

1. Introduction

The novel robust regression framework proposed in RegCloser is a general approach to DNA sequence assembly. It is applicable to both NGS and TGS data. In combination with any scaffolding methods, it can be used as a genome gap-closing tool. In the OLC paradigm of de novo assembly, the existing methods find a layout of reads by greedy search. In contrast, the robust regression approach generates a globally optimal layout, which is the minimizer of a convex loss function.

RegCloser can currently be used or tested in the following scenarios:

  • Improve genome N50 by NGS libraries (a small genome example is in test/S.aureus_data), and is scalable to large genomes.
  • Reconstruct complete and accurate microbial genomes by low-cost and accurate NGS data (an example is in test/E.coli_simulation).
  • Generate a globally optimal layout in the de novo assembly of TGS data (an example is in test/E.coli_long_reads).

P.S. We tested the applicability of the robust regression approach to layout generation on TGS long reads in denovo assembly. A further complication than the gap-filling problem is that, from which strand each read comes from the target genomic DNA is unknown. Therefore, we first use a heuristic algorithm to orientate all reads in the connected graph, and then estimate their positions via robust regression.

2. Installation

You can download the software package by the command:

git clone https://github.com/csh3/RegCloser.git

or click the Download Zip button and decompress the software package.

3. Dependencies

The current version requires:

  1. Python3 with the following modules: os, sys, re, argparse, biopython, numpy, math, networkx, scipy, collections, datetime, multiprocessing

  2. BWA (version 0.7.17)

  3. MultiAlignment_func_python.so

The firt two can be installed through the Bioconda channel. The third one has been included in the software package or you can compile the source code MultiAlignment_func_python.cpp on your machine using the following command.

g++ -fPIC MultiAlignment_func_python.cpp -o MultiAlignment_func_python.so -shared -I/home/miniconda3/include/python3.6m # Here /home/miniconda3/include/python3.6m is a directory storing the head file Python.h

4. Usage

4.1. Pipeline

The main program is RunPipeline.py, and the pipeline consists of the following 7 modules. You can start or end with any one module by the option -s or -e. The core innovation of our method lies in the module LocalAssembly that uses the robust regression model and algorithm to assemble short reads into contigs.

1. InitialContig Break the draft genome into contigs
2. Mapping Map sequence reads to the draft genome using BWA and identify anchored reads
3. HighDepth (optional) Identify high depth regions in the contig ends
4. CollectReads Collect reads in the gap regions for local assembly and make tab files of linking information between contigs 5. Re-Scaffold (optional) Generate new scaffolds from initial contigs using SSPACE_Standard_v3.0
6. ReEstimateGapSize Re-estimate gap sizes between contigs
7. LocalAssembly Assemble the collected reads into contigs for gap closing via the robust regression approach

We recommend to use RegCloser in an iterative way that you can take the output genome as the input of the next iteration, and perform several times until no more gaps to be filled.

4.2. Prerequisite file

A prerequisite file is needed to specify the directory storing the sequence reads and the information of different libraries. An example is illustrated below.

Reads_directory: /home/E.coli/reads
frag frag_1.fastq frag_2.fastq 300 20 FR 1
shortjump	shortjump_1.fastq	shortjump_2.fastq	3600 298 RF 2

The first line specifies the code path, and the second line specifies the reads directory. From the third line, each line describes one reads library and contains 7 columns, separated by spaces or tabs. Each column is explained in more detail below.

Column 1: Name of the library
Each library should be designated a different name. Column 2 & 3: Fastq files for both ends
For each paired reads, one of the reads should be in the first file, and the other one in the second file. The paired reads are required to be on the same line.
Column 4:	Average insert size between paired reads
Column 5: Standard deviation of insert size between paired reads
Column 6: Orientation of paired reads, FR or RF
F stands for --> orientation, and R for <-- orientation. Paired-end libraries are FR, and mate-pair libraries are RF.
Column 7: Whether the libary is used for local assembly or making tab files, 1, 2, or 3
1 stands for only local assembly, 2 stands for only making tab files, and 3 for both.

4.3. Basic usage

Run with 40 threads

python RunPipeline.py -p prerequisite -g draft_genome.fasta -d iter-1 -t 40

Re-run the LocalAssembly module

python RunPipeline.py -p prerequisite -g draft_genome.fasta -d iter-1 -t 40 -s LocalAssembly

Iterate over the result of RegCloser

python RunPipeline.py -p prerequisite -g iter-1/output_genome.fasta -d iter-2 -t 40

4.4. Output files

The intermediate and output files are saved under the directory specified by the option -d. RegCloser outputs 4 result files. They are described in details below.

output_genome.fasta saves the output genome sequence with gaps closed by RegCloser. You can specify the filename using option -o according to your preference.

gapSequence.fastq saves the assembled sequences in the gap regions and their Phred quality scores (ASCII_BASE 33). The identifier of each sequence records the gap it comes from. For example, @contig1_contig2_filled means the sequence filled the gap between contig1 and contig2; @contig2_contig3_left means the sequence extended from the left boundary of the gap between contig2 and contig3; @contig3_contig4_right means the sequence extended from the right boundary of the gap between contig3 and contig4.

evidence.fill records the information of the gaps in the output genome. Each line describes one gap and contains 6 columns.

Column 1: Left contig of a gap
Column 2: Right contig of a gap
Column 3 & 4:	Length of sequences extending from the left and right boundaries of a gap
If the gap was filled, column 4 is 0, and column 3 is the length of the filling sequence.
If column 3 is a negative value, it means the two adjacent contigs flanking the gap were merged, and column 3 tells the overlap length.
Column 5: Status of a gap, 0 or 1
If the gap was filled, the flag was set to 1, otherwise 0.
Column 6: Current gap size If the gap was filled, the value is 0.

statistics.txt records the statistics of the genome sequence after gap closing. It includes closed gap number, classified into merged gap number and filled gap number. It also includes total contig length, contig N50, and scaffold N50.

4.5. Command line options

OptionTypeDescription
-pSTRA formatted file specifying the code path, reads directory, and library information. [Prerequisite]
-gSTRDraft genome, required.
-dSTRWorking directory saving intermediate and output files, required.
-oSTROutput file saving gap-closed genome. [output_genome.fasta]
-tINTNumber of threads. [1]
-sSTRStarting module. [Start]
-eSTREnding module. [End]
-rsRe-scaffold using SSPACE. [null]
-fINTContigs shorter than this value will be removed from the draft genome before gap closing. [0]
-mlINTContig end with insert size + ml * std bases were cut out for mapping anchored reads. [3]
-mkINTMinimum seed length in BWA mapping. [19]
-mTINTMinimum score to output in BWA mapping. [30]
-cINTMaximum number of soft-clipped bases on either end of a mapped read. [5]
-mqINTMapped Reads with mapping quality greater than this value will be identified as anchored reads. [60]
-nrNot re-map anchored reads to the whole draft genome to exclude multi-mapped reads. [null]
-hfFilter out anchored reads falling in the high coverage regions. [null]
-raFLOATConsecutive bases with coverage higher then ra * mode coverage will be marked as high coverage regions. [1.8]
-kINTMinimum number of links to compute scaffold in SSPACE. [5]
-aFLOATMaximum link ratio between two best contig pairs in SSPACE. [0.7]
-sdINTDefault standard deviation of gap size. [100]
-qcFLOATMaximum expected erroneous bases in the read used for local assembly. [100]
-lINTLength of the contig end sequence cut out for local assembly. [100]
-rcINTCoverage of reads used for local assembly. [100]
-SFLOATThreshold for selective pairwise alignment. [0.3]
-maINTMatching score in reads pairwise alignment. [1]
-mmINTMismatch penalty in reads pairwise alignment. [20]
-gcINTGap cost in reads pairwise alignment. [30]
-msINTMinimum score to output in reads pairwise alignment. [20]
-hoINTMaximum admissible hanging-out length in reads pairwise alignment. [0]
-wAssign initial weights for detected overlaps. [null]
-r1 FLOATTuning constant of weight function in IRLS algorithm. [2]
-r2 FLOATExcluding samples with residuals greater than this value after IRLS algorithm. [10]
-mTINTMaximum truncated length for alignment merging adjacent contigs. [1000]
-mAINTMatching score in alignment merging adjacent contigs. [1]
-mMINTMismatch penalty in alignment merging adjacent contigs. [2]
-mGINTGap cost in alignment merging adjacent contigs. [3]
-mSINTMinimum alignment score to merge adjacent contigs. [20]
-HOINTMaximum admissible hanging-out length in alignment merging adjacent contigs. [5]

5. Current version

The version of the current release is v1.0.

6. Contact

Please contact cao.shenghao@foxmail.com for any questions.

7. License

GNU General Public License v3.0 only

For details, please read RegCloser/license.txt.

8. Citation

Cao S, Li M, Li LM. RegCloser: a robust regression approach to closing genome gaps. BMC Bioinformatics. 2023;24(1):249. Published 2023 Jun 13. https://doi.org/10.1186/s12859-023-05367-0

About

RegCloser is a genome gap-closing tool based on the robust regression approach, which is conceptually applicable to de novo assembly of NGS and TGS data.

Resources

Stars

16 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - csh3/RegCloser: RegCloser is a genome gap-closing tool based on the robust regression approach, which is conceptually applicable to de novo assembly of NGS and TGS data. · GitHub
Skip to content

Repository files navigation

Copyright © 2023, Shenghao Cao, Mengtian Li & Lei M. Li. Academy of Mathematics and Systems Science, Chinese Academy of Sciences, Beijing 100190, China

RegCloser

1. Introduction

The novel robust regression framework proposed in RegCloser is a general approach to DNA sequence assembly. It is applicable to both NGS and TGS data. In combination with any scaffolding methods, it can be used as a genome gap-closing tool. In the OLC paradigm of de novo assembly, the existing methods find a layout of reads by greedy search. In contrast, the robust regression approach generates a globally optimal layout, which is the minimizer of a convex loss function.

RegCloser can currently be used or tested in the following scenarios:

  • Improve genome N50 by NGS libraries (a small genome example is in test/S.aureus_data), and is scalable to large genomes.
  • Reconstruct complete and accurate microbial genomes by low-cost and accurate NGS data (an example is in test/E.coli_simulation).
  • Generate a globally optimal layout in the de novo assembly of TGS data (an example is in test/E.coli_long_reads).

P.S. We tested the applicability of the robust regression approach to layout generation on TGS long reads in denovo assembly. A further complication than the gap-filling problem is that, from which strand each read comes from the target genomic DNA is unknown. Therefore, we first use a heuristic algorithm to orientate all reads in the connected graph, and then estimate their positions via robust regression.

2. Installation

You can download the software package by the command:

git clone https://github.com/csh3/RegCloser.git

or click the Download Zip button and decompress the software package.

3. Dependencies

The current version requires:

  1. Python3 with the following modules: os, sys, re, argparse, biopython, numpy, math, networkx, scipy, collections, datetime, multiprocessing

  2. BWA (version 0.7.17)

  3. MultiAlignment_func_python.so

The firt two can be installed through the Bioconda channel. The third one has been included in the software package or you can compile the source code MultiAlignment_func_python.cpp on your machine using the following command.

g++ -fPIC MultiAlignment_func_python.cpp -o MultiAlignment_func_python.so -shared -I/home/miniconda3/include/python3.6m # Here /home/miniconda3/include/python3.6m is a directory storing the head file Python.h

4. Usage

4.1. Pipeline

The main program is RunPipeline.py, and the pipeline consists of the following 7 modules. You can start or end with any one module by the option -s or -e. The core innovation of our method lies in the module LocalAssembly that uses the robust regression model and algorithm to assemble short reads into contigs.

1. InitialContig Break the draft genome into contigs
2. Mapping Map sequence reads to the draft genome using BWA and identify anchored reads
3. HighDepth (optional) Identify high depth regions in the contig ends
4. CollectReads Collect reads in the gap regions for local assembly and make tab files of linking information between contigs 5. Re-Scaffold (optional) Generate new scaffolds from initial contigs using SSPACE_Standard_v3.0
6. ReEstimateGapSize Re-estimate gap sizes between contigs
7. LocalAssembly Assemble the collected reads into contigs for gap closing via the robust regression approach

We recommend to use RegCloser in an iterative way that you can take the output genome as the input of the next iteration, and perform several times until no more gaps to be filled.

4.2. Prerequisite file

A prerequisite file is needed to specify the directory storing the sequence reads and the information of different libraries. An example is illustrated below.

Reads_directory: /home/E.coli/reads
frag frag_1.fastq frag_2.fastq 300 20 FR 1
shortjump	shortjump_1.fastq	shortjump_2.fastq	3600 298 RF 2

The first line specifies the code path, and the second line specifies the reads directory. From the third line, each line describes one reads library and contains 7 columns, separated by spaces or tabs. Each column is explained in more detail below.

Column 1: Name of the library
Each library should be designated a different name. Column 2 & 3: Fastq files for both ends
For each paired reads, one of the reads should be in the first file, and the other one in the second file. The paired reads are required to be on the same line.
Column 4:	Average insert size between paired reads
Column 5: Standard deviation of insert size between paired reads
Column 6: Orientation of paired reads, FR or RF
F stands for --> orientation, and R for <-- orientation. Paired-end libraries are FR, and mate-pair libraries are RF.
Column 7: Whether the libary is used for local assembly or making tab files, 1, 2, or 3
1 stands for only local assembly, 2 stands for only making tab files, and 3 for both.

4.3. Basic usage

Run with 40 threads

python RunPipeline.py -p prerequisite -g draft_genome.fasta -d iter-1 -t 40

Re-run the LocalAssembly module

python RunPipeline.py -p prerequisite -g draft_genome.fasta -d iter-1 -t 40 -s LocalAssembly

Iterate over the result of RegCloser

python RunPipeline.py -p prerequisite -g iter-1/output_genome.fasta -d iter-2 -t 40

4.4. Output files

The intermediate and output files are saved under the directory specified by the option -d. RegCloser outputs 4 result files. They are described in details below.

output_genome.fasta saves the output genome sequence with gaps closed by RegCloser. You can specify the filename using option -o according to your preference.

gapSequence.fastq saves the assembled sequences in the gap regions and their Phred quality scores (ASCII_BASE 33). The identifier of each sequence records the gap it comes from. For example, @contig1_contig2_filled means the sequence filled the gap between contig1 and contig2; @contig2_contig3_left means the sequence extended from the left boundary of the gap between contig2 and contig3; @contig3_contig4_right means the sequence extended from the right boundary of the gap between contig3 and contig4.

evidence.fill records the information of the gaps in the output genome. Each line describes one gap and contains 6 columns.

Column 1: Left contig of a gap
Column 2: Right contig of a gap
Column 3 & 4:	Length of sequences extending from the left and right boundaries of a gap
If the gap was filled, column 4 is 0, and column 3 is the length of the filling sequence.
If column 3 is a negative value, it means the two adjacent contigs flanking the gap were merged, and column 3 tells the overlap length.
Column 5: Status of a gap, 0 or 1
If the gap was filled, the flag was set to 1, otherwise 0.
Column 6: Current gap size If the gap was filled, the value is 0.

statistics.txt records the statistics of the genome sequence after gap closing. It includes closed gap number, classified into merged gap number and filled gap number. It also includes total contig length, contig N50, and scaffold N50.

4.5. Command line options

OptionTypeDescription
-pSTRA formatted file specifying the code path, reads directory, and library information. [Prerequisite]
-gSTRDraft genome, required.
-dSTRWorking directory saving intermediate and output files, required.
-oSTROutput file saving gap-closed genome. [output_genome.fasta]
-tINTNumber of threads. [1]
-sSTRStarting module. [Start]
-eSTREnding module. [End]
-rsRe-scaffold using SSPACE. [null]
-fINTContigs shorter than this value will be removed from the draft genome before gap closing. [0]
-mlINTContig end with insert size + ml * std bases were cut out for mapping anchored reads. [3]
-mkINTMinimum seed length in BWA mapping. [19]
-mTINTMinimum score to output in BWA mapping. [30]
-cINTMaximum number of soft-clipped bases on either end of a mapped read. [5]
-mqINTMapped Reads with mapping quality greater than this value will be identified as anchored reads. [60]
-nrNot re-map anchored reads to the whole draft genome to exclude multi-mapped reads. [null]
-hfFilter out anchored reads falling in the high coverage regions. [null]
-raFLOATConsecutive bases with coverage higher then ra * mode coverage will be marked as high coverage regions. [1.8]
-kINTMinimum number of links to compute scaffold in SSPACE. [5]
-aFLOATMaximum link ratio between two best contig pairs in SSPACE. [0.7]
-sdINTDefault standard deviation of gap size. [100]
-qcFLOATMaximum expected erroneous bases in the read used for local assembly. [100]
-lINTLength of the contig end sequence cut out for local assembly. [100]
-rcINTCoverage of reads used for local assembly. [100]
-SFLOATThreshold for selective pairwise alignment. [0.3]
-maINTMatching score in reads pairwise alignment. [1]
-mmINTMismatch penalty in reads pairwise alignment. [20]
-gcINTGap cost in reads pairwise alignment. [30]
-msINTMinimum score to output in reads pairwise alignment. [20]
-hoINTMaximum admissible hanging-out length in reads pairwise alignment. [0]
-wAssign initial weights for detected overlaps. [null]
-r1 FLOATTuning constant of weight function in IRLS algorithm. [2]
-r2 FLOATExcluding samples with residuals greater than this value after IRLS algorithm. [10]
-mTINTMaximum truncated length for alignment merging adjacent contigs. [1000]
-mAINTMatching score in alignment merging adjacent contigs. [1]
-mMINTMismatch penalty in alignment merging adjacent contigs. [2]
-mGINTGap cost in alignment merging adjacent contigs. [3]
-mSINTMinimum alignment score to merge adjacent contigs. [20]
-HOINTMaximum admissible hanging-out length in alignment merging adjacent contigs. [5]

5. Current version

The version of the current release is v1.0.

6. Contact

Please contact cao.shenghao@foxmail.com for any questions.

7. License

GNU General Public License v3.0 only

For details, please read RegCloser/license.txt.

8. Citation

Cao S, Li M, Li LM. RegCloser: a robust regression approach to closing genome gaps. BMC Bioinformatics. 2023;24(1):249. Published 2023 Jun 13. https://doi.org/10.1186/s12859-023-05367-0

About

RegCloser is a genome gap-closing tool based on the robust regression approach, which is conceptually applicable to de novo assembly of NGS and TGS data.

Resources

Stars

16 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); GitHub - csh3/RegCloser: RegCloser is a genome gap-closing tool based on the robust regression approach, which is conceptually applicable to de novo assembly of NGS and TGS data. · GitHub
Skip to content

Repository files navigation

Copyright © 2023, Shenghao Cao, Mengtian Li & Lei M. Li. Academy of Mathematics and Systems Science, Chinese Academy of Sciences, Beijing 100190, China

RegCloser

1. Introduction

The novel robust regression framework proposed in RegCloser is a general approach to DNA sequence assembly. It is applicable to both NGS and TGS data. In combination with any scaffolding methods, it can be used as a genome gap-closing tool. In the OLC paradigm of de novo assembly, the existing methods find a layout of reads by greedy search. In contrast, the robust regression approach generates a globally optimal layout, which is the minimizer of a convex loss function.

RegCloser can currently be used or tested in the following scenarios:

  • Improve genome N50 by NGS libraries (a small genome example is in test/S.aureus_data), and is scalable to large genomes.
  • Reconstruct complete and accurate microbial genomes by low-cost and accurate NGS data (an example is in test/E.coli_simulation).
  • Generate a globally optimal layout in the de novo assembly of TGS data (an example is in test/E.coli_long_reads).

P.S. We tested the applicability of the robust regression approach to layout generation on TGS long reads in denovo assembly. A further complication than the gap-filling problem is that, from which strand each read comes from the target genomic DNA is unknown. Therefore, we first use a heuristic algorithm to orientate all reads in the connected graph, and then estimate their positions via robust regression.

2. Installation

You can download the software package by the command:

git clone https://github.com/csh3/RegCloser.git

or click the Download Zip button and decompress the software package.

3. Dependencies

The current version requires:

  1. Python3 with the following modules: os, sys, re, argparse, biopython, numpy, math, networkx, scipy, collections, datetime, multiprocessing

  2. BWA (version 0.7.17)

  3. MultiAlignment_func_python.so

The firt two can be installed through the Bioconda channel. The third one has been included in the software package or you can compile the source code MultiAlignment_func_python.cpp on your machine using the following command.

g++ -fPIC MultiAlignment_func_python.cpp -o MultiAlignment_func_python.so -shared -I/home/miniconda3/include/python3.6m # Here /home/miniconda3/include/python3.6m is a directory storing the head file Python.h

4. Usage

4.1. Pipeline

The main program is RunPipeline.py, and the pipeline consists of the following 7 modules. You can start or end with any one module by the option -s or -e. The core innovation of our method lies in the module LocalAssembly that uses the robust regression model and algorithm to assemble short reads into contigs.

1. InitialContig Break the draft genome into contigs
2. Mapping Map sequence reads to the draft genome using BWA and identify anchored reads
3. HighDepth (optional) Identify high depth regions in the contig ends
4. CollectReads Collect reads in the gap regions for local assembly and make tab files of linking information between contigs 5. Re-Scaffold (optional) Generate new scaffolds from initial contigs using SSPACE_Standard_v3.0
6. ReEstimateGapSize Re-estimate gap sizes between contigs
7. LocalAssembly Assemble the collected reads into contigs for gap closing via the robust regression approach

We recommend to use RegCloser in an iterative way that you can take the output genome as the input of the next iteration, and perform several times until no more gaps to be filled.

4.2. Prerequisite file

A prerequisite file is needed to specify the directory storing the sequence reads and the information of different libraries. An example is illustrated below.

Reads_directory: /home/E.coli/reads
frag frag_1.fastq frag_2.fastq 300 20 FR 1
shortjump	shortjump_1.fastq	shortjump_2.fastq	3600 298 RF 2

The first line specifies the code path, and the second line specifies the reads directory. From the third line, each line describes one reads library and contains 7 columns, separated by spaces or tabs. Each column is explained in more detail below.

Column 1: Name of the library
Each library should be designated a different name. Column 2 & 3: Fastq files for both ends
For each paired reads, one of the reads should be in the first file, and the other one in the second file. The paired reads are required to be on the same line.
Column 4:	Average insert size between paired reads
Column 5: Standard deviation of insert size between paired reads
Column 6: Orientation of paired reads, FR or RF
F stands for --> orientation, and R for <-- orientation. Paired-end libraries are FR, and mate-pair libraries are RF.
Column 7: Whether the libary is used for local assembly or making tab files, 1, 2, or 3
1 stands for only local assembly, 2 stands for only making tab files, and 3 for both.

4.3. Basic usage

Run with 40 threads

python RunPipeline.py -p prerequisite -g draft_genome.fasta -d iter-1 -t 40

Re-run the LocalAssembly module

python RunPipeline.py -p prerequisite -g draft_genome.fasta -d iter-1 -t 40 -s LocalAssembly

Iterate over the result of RegCloser

python RunPipeline.py -p prerequisite -g iter-1/output_genome.fasta -d iter-2 -t 40

4.4. Output files

The intermediate and output files are saved under the directory specified by the option -d. RegCloser outputs 4 result files. They are described in details below.

output_genome.fasta saves the output genome sequence with gaps closed by RegCloser. You can specify the filename using option -o according to your preference.

gapSequence.fastq saves the assembled sequences in the gap regions and their Phred quality scores (ASCII_BASE 33). The identifier of each sequence records the gap it comes from. For example, @contig1_contig2_filled means the sequence filled the gap between contig1 and contig2; @contig2_contig3_left means the sequence extended from the left boundary of the gap between contig2 and contig3; @contig3_contig4_right means the sequence extended from the right boundary of the gap between contig3 and contig4.

evidence.fill records the information of the gaps in the output genome. Each line describes one gap and contains 6 columns.

Column 1: Left contig of a gap
Column 2: Right contig of a gap
Column 3 & 4:	Length of sequences extending from the left and right boundaries of a gap
If the gap was filled, column 4 is 0, and column 3 is the length of the filling sequence.
If column 3 is a negative value, it means the two adjacent contigs flanking the gap were merged, and column 3 tells the overlap length.
Column 5: Status of a gap, 0 or 1
If the gap was filled, the flag was set to 1, otherwise 0.
Column 6: Current gap size If the gap was filled, the value is 0.

statistics.txt records the statistics of the genome sequence after gap closing. It includes closed gap number, classified into merged gap number and filled gap number. It also includes total contig length, contig N50, and scaffold N50.

4.5. Command line options

OptionTypeDescription
-pSTRA formatted file specifying the code path, reads directory, and library information. [Prerequisite]
-gSTRDraft genome, required.
-dSTRWorking directory saving intermediate and output files, required.
-oSTROutput file saving gap-closed genome. [output_genome.fasta]
-tINTNumber of threads. [1]
-sSTRStarting module. [Start]
-eSTREnding module. [End]
-rsRe-scaffold using SSPACE. [null]
-fINTContigs shorter than this value will be removed from the draft genome before gap closing. [0]
-mlINTContig end with insert size + ml * std bases were cut out for mapping anchored reads. [3]
-mkINTMinimum seed length in BWA mapping. [19]
-mTINTMinimum score to output in BWA mapping. [30]
-cINTMaximum number of soft-clipped bases on either end of a mapped read. [5]
-mqINTMapped Reads with mapping quality greater than this value will be identified as anchored reads. [60]
-nrNot re-map anchored reads to the whole draft genome to exclude multi-mapped reads. [null]
-hfFilter out anchored reads falling in the high coverage regions. [null]
-raFLOATConsecutive bases with coverage higher then ra * mode coverage will be marked as high coverage regions. [1.8]
-kINTMinimum number of links to compute scaffold in SSPACE. [5]
-aFLOATMaximum link ratio between two best contig pairs in SSPACE. [0.7]
-sdINTDefault standard deviation of gap size. [100]
-qcFLOATMaximum expected erroneous bases in the read used for local assembly. [100]
-lINTLength of the contig end sequence cut out for local assembly. [100]
-rcINTCoverage of reads used for local assembly. [100]
-SFLOATThreshold for selective pairwise alignment. [0.3]
-maINTMatching score in reads pairwise alignment. [1]
-mmINTMismatch penalty in reads pairwise alignment. [20]
-gcINTGap cost in reads pairwise alignment. [30]
-msINTMinimum score to output in reads pairwise alignment. [20]
-hoINTMaximum admissible hanging-out length in reads pairwise alignment. [0]
-wAssign initial weights for detected overlaps. [null]
-r1 FLOATTuning constant of weight function in IRLS algorithm. [2]
-r2 FLOATExcluding samples with residuals greater than this value after IRLS algorithm. [10]
-mTINTMaximum truncated length for alignment merging adjacent contigs. [1000]
-mAINTMatching score in alignment merging adjacent contigs. [1]
-mMINTMismatch penalty in alignment merging adjacent contigs. [2]
-mGINTGap cost in alignment merging adjacent contigs. [3]
-mSINTMinimum alignment score to merge adjacent contigs. [20]
-HOINTMaximum admissible hanging-out length in alignment merging adjacent contigs. [5]

5. Current version

The version of the current release is v1.0.

6. Contact

Please contact cao.shenghao@foxmail.com for any questions.

7. License

GNU General Public License v3.0 only

For details, please read RegCloser/license.txt.

8. Citation

Cao S, Li M, Li LM. RegCloser: a robust regression approach to closing genome gaps. BMC Bioinformatics. 2023;24(1):249. Published 2023 Jun 13. https://doi.org/10.1186/s12859-023-05367-0

About

RegCloser is a genome gap-closing tool based on the robust regression approach, which is conceptually applicable to de novo assembly of NGS and TGS data.

Resources

Stars

16 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages