Skip to content

xzyschumacher/CSV-Filter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CSV-Filter: A Comprehensive Structural Variation Filtering Tool for Single Molecule Real-Time Sequencing

Introduction

Structure Variations (SVs) play an important role in genetic research and precision medicine. However, existing SV detection methods usually contain a substantial number of false positive calls. It is necessary to develop effective filtering approaches. We developed a novel deep learning-based SV filtering tool, CSV-Filter, for both second and third generation sequencing data. In CSV-Filter, we proposed a novel multi-level grayscale image encoding method based on CIGAR strings of the alignment results and employed image augmentation techniques to improve the extraction of SV features. We also utilized self-supervised learning networks for transfer as classification models, and employed mixed-precision operations to accelerate the training process. The experimental results show that the integration of CSV-Filter with popular second-generation and third-generation SV detection tools could considerably reduce false positive SVs, while maintaining true positive SVs almost unchanged. Compared with DeepSVFilter, a SV filtering tool for second-generation sequencing, CSV-Filter can recognize more false positive SVs and supports third-generation sequencing data as an additional feature.

Installation

conda env create -f environment.yml
conda activate csv-filter

Dependence

CSV-Filter is tested to work under:

  • Python 3.6
  • pysam 0.15.4
  • pytorch 1.10.2
  • pytorch-lightning 1.5.10
  • hyperopt 0.2.7
  • matplotlib 3.3.4
  • numpy 1.19.2
  • pudb 2022.1.3
  • redis 4.3.6
  • samtools 1.5
  • scikit-learn 0.24.2
  • torchvision 1.10.2
  • tensroboard 2.11.2

Datasets

Reference

HG002

NA12878

Model that have been trained

Download trained models from Releases · xzyschumacher/CSV-Filter (github.com)

Usage

Train

In the src file

vcf data preprocess:

python vcf_data_process.py

BAM data preprocess:

python bam2depth.py

parallel generate images:

python parallel_process_file.py --thread_num thread_num  
(python parallel_process_file.py --thread_num 16)

check generated images:

python process_file_check.py

rearrange generated images:

python data_spread.py

train:

python train.py

Predict & Filter

predict:

python predict.py selected_model
(e.g. python predict.py resnet50)

filter:

python filter.py selected_model
(e.g. python filter.py resnet50)

Switch model to train

In train.py file, modify the data dirction and name of the model.

data_dir = "../data/"
bs = 128
my_label = "resnet50"

In net.py file, modify models need to be trianed.

# load local models
self.resnet_model = torch.load("../models/init_resnet50.pt")
self.resnet_model.eval()

# load models from websites
self.resnet_model = torchvision.models.mobilenet_v2(pretrained=True)
self.resnet_model = torchvision.models.resnet34(pretrained=True)
self.resnet_model = torchvision.models.resnet50(pretrained=True)

# load VICReg: Variance-Invariance-Covariance Regularization For Self-Supervised Learning
self.resnet_model = torch.hub.load('facebookresearch/vicreg:main', 'resnet50')
self.resnet_model = torch.hub.load('facebookresearch/vicreg:main', 'resnet50x2')
self.resnet_model = torch.hub.load('facebookresearch/vicreg:main', 'resnet200x2')

PS: sometimes the output dimension is different, so we need to modify the softmax void:

self.softmax = nn.Sequential(
    # nn.Linear(full_dim[-1], 3),
    # nn.Linear(4096, 3),
    # nn.Linear(2048, 3),
    nn.Linear(1000, 3),
    nn.Softmax(1)
)

Citation

Xia, Zeyu, et al. CSV-Filter: a deep learning-based comprehensive structural variant filtering method for both short and long reads. Bioinformatics 40.9 (2024): btae539. https://academic.oup.com/bioinformatics/article/40/9/btae539/7750355.

Contact

For advising, bug reporting and requiring help, please contact [email protected].

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published