一文搞定基因型数据清洗

news2024/7/4 5:59:13

文章目录

    • 数据
    • 1 二进制文件
    • 2. plink二进制文件变为文本文件(ped和map)
    • 3. plink将vcf转化为plink文件
    • 4. 提取样本和SNP
      • 4.1 提取样本
      • 4.2 提取SNP
    • 5. plink和表型数据合并
    • 6. 数据汇总
      • 6.1 次等位基因频率(maf)
      • 6.2 缺失
      • 6.3 哈温检测
      • 6.4 杂合率检测
    • 7. 数据质控qc
      • 7.1 样本质控--mind
      • 7.2 位点质控--geno
      • 7.3 maf质控--maf
      • 7.4 哈温质控 --hwe

很多分析之前,都要做基因型数据清洗,包括:

  • GWAS分析
  • GS分析
  • ……

这里介绍一下常用的基因型数据清洗方法。

数据

《统计遗传学》中的章节介绍,有关代码实操部分,单独列出来,进行展示。

我已经下载整理好了,下载本书的电子版pdf+数据+代码,链接:书籍及配套代码领取–统计遗传分析导论

1 二进制文件

文件中包括二进制的三个文件:

2. plink二进制文件变为文本文件(ped和map)

命令

 plink --bfile hapmap-ceu --recode --out hapmap-ceu
  • --bfile 是指定二进制plink的前缀名称
  • --recode是生成文本ped和map的二进制文件
  • --out是指定输出的结果文件前缀名称

日志

PLINK v1.90b5.3 64-bit (21 Feb 2018)           www.cog-genomics.org/plink/1.9/
(C) 2005-2018 Shaun Purcell, Christopher Chang   GNU General Public License v3
Logging to hapmap-ceu.log.
Options in effect:
  --bfile hapmap-ceu
  --out hapmap-ceu
  --recode

1031523 MB RAM detected; reserving 515761 MB for main workspace.
2239392 variants loaded from .bim file.
60 people (30 males, 30 females) loaded from .fam.
Using 1 thread (no multithreaded calculations invoked).
Before main variant filters, 60 founders and 0 nonfounders present.
Calculating allele frequencies... done.
Warning: 59 het. haploid genotypes present (see hapmap-ceu.hh ); many commands
treat these as missing.
Total genotyping rate is 0.992022.
2239392 variants and 60 people pass filters and QC.
Note: No phenotypes present.
--recode ped to hapmap-ceu.ped + hapmap-ceu.map ... done.

上面的信息有:

  • 共有2239392个SNP位点
  • 共有60个个体,其中30个males,30个female
  • 结果生成hapmap-ceu.pedhapmap-ceu.map文件

3. plink将vcf转化为plink文件

文件:
ALL.chr21.vcf.gz

plink将vcf文件变为plink的二进制文件(bed和bim和fam)。

命令:

plink --vcf ALL.chr21.vcf.gz --make-bed --out test_vcf

日志:

PLINK v1.90b5.3 64-bit (21 Feb 2018)           www.cog-genomics.org/plink/1.9/
(C) 2005-2018 Shaun Purcell, Christopher Chang   GNU General Public License v3
Logging to test_vcf.log.
Options in effect:
  --make-bed
  --out test_vcf
  --vcf ALL.chr21.vcf.gz

1031523 MB RAM detected; reserving 515761 MB for main workspace.
--vcf: test_vcf-temporary.bed + test_vcf-temporary.bim + test_vcf-temporary.fam
written.
1105538 variants loaded from .bim file.
2504 people (0 males, 0 females, 2504 ambiguous) loaded from .fam.
Ambiguous sex IDs written to test_vcf.nosex .
Using 1 thread (no multithreaded calculations invoked).
Before main variant filters, 2504 founders and 0 nonfounders present.
Calculating allele frequencies... done.
Total genotyping rate is 0.999787.
1105538 variants and 2504 people pass filters and QC.
Note: No phenotypes present.
--make-bed to test_vcf.bed + test_vcf.bim + test_vcf.fam ... done.

4. 提取样本和SNP

  • 可以使用–keep 和 --remove 进行样本ID的提取或者删除
  • 可以使用–extract和 --exclude进行SNP的提取或者删除

样本ID的示例:两列FID和IID,没有行头:

SNP的ID的示例:一列SNP名称,没有行头:

4.1 提取样本

代码:

 plink --bfile hapmap-ceu --keep list.txt --make-bed --out selectedIndividuals

日志:

PLINK v1.90b5.3 64-bit (21 Feb 2018)           www.cog-genomics.org/plink/1.9/
(C) 2005-2018 Shaun Purcell, Christopher Chang   GNU General Public License v3
Logging to selectedIndividuals.log.
Options in effect:
  --bfile hapmap-ceu
  --keep list.txt
  --make-bed
  --out selectedIndividuals

1031523 MB RAM detected; reserving 515761 MB for main workspace.
2239392 variants loaded from .bim file.
60 people (30 males, 30 females) loaded from .fam.
--keep: 60 people remaining.
Using 1 thread (no multithreaded calculations invoked).
Before main variant filters, 60 founders and 0 nonfounders present.
Calculating allele frequencies... done.
Warning: 59 het. haploid genotypes present (see selectedIndividuals.hh ); many
commands treat these as missing.
Total genotyping rate is 0.992022.
2239392 variants and 60 people pass filters and QC.
Note: No phenotypes present.
--make-bed to selectedIndividuals.bed + selectedIndividuals.bim +
selectedIndividuals.fam ... done.

4.2 提取SNP

代码:

plink --bfile hapmap-ceu --extract snp_name.txt --make-bed --out selectedSNP

日志:

PLINK v1.90b5.3 64-bit (21 Feb 2018)           www.cog-genomics.org/plink/1.9/
(C) 2005-2018 Shaun Purcell, Christopher Chang   GNU General Public License v3
Logging to selectedSNP.log.
Options in effect:
  --bfile hapmap-ceu
  --extract snp_name.txt
  --make-bed
  --out selectedSNP

1031523 MB RAM detected; reserving 515761 MB for main workspace.
2239392 variants loaded from .bim file.
60 people (30 males, 30 females) loaded from .fam.
--extract: 20 variants remaining.
Using 1 thread (no multithreaded calculations invoked).
Before main variant filters, 60 founders and 0 nonfounders present.
Calculating allele frequencies... done.
Total genotyping rate is 0.995833.
20 variants and 60 people pass filters and QC.
Note: No phenotypes present.
--make-bed to selectedSNP.bed + selectedSNP.bim + selectedSNP.fam ... done.

也可以提取单个SNP:

 plink --file hapmap-ceu --snps rs9930506 --make-bed --out rs9930506sample

结果:

 rs9930506sample.bed + rs9930506sample.bim + rs9930506sample.fam

5. plink和表型数据合并

如果想要把表型数据和基因型数据合并,需要整理的表型格式:FID,IID,y三列。

FID	IID	BMI
0	HG00096	25.022827
0	HG00097	24.853638
0	HG00099	23.689295
0	HG00100	27.016203
0	HG00101	21.461624
0	HG00102	20.673635
0	HG00103	25.71508
0	HG00104	25.252243
0	HG00106	22.765049

看一下原始的fam文件:

0 HG00096 0 0 1 -9
0 HG00097 0 0 2 -9
0 HG00099 0 0 2 -9
0 HG00100 0 0 2 -9
0 HG00101 0 0 1 -9
0 HG00102 0 0 2 -9
0 HG00103 0 0 1 -9
0 HG00104 0 0 2 -9
0 HG00106 0 0 2 -9
0 HG00108 0 0 1 -9

合并命令:

 plink --bfile 1kg_EU_qc --pheno BMI_pheno.txt --make-bed --out 1kg_EU_BMI

生成文件:

1kg_EU_BMI.bed + 1kg_EU_BMI.bim + 1kg_EU_BMI.fam

看一下新的fam文件:

0 HG00096 0 0 1 25.0228
0 HG00097 0 0 2 24.8536
0 HG00099 0 0 2 23.6893
0 HG00100 0 0 2 27.0162
0 HG00101 0 0 1 21.4616
0 HG00102 0 0 2 20.6736
0 HG00103 0 0 1 25.7151
0 HG00104 0 0 2 25.2522
0 HG00106 0 0 2 22.765
0 HG00108 0 0 1 23.069

可以看到,已经合并成功了。

6. 数据汇总

6.1 次等位基因频率(maf)

查看基因频率的统计结果,用–freq

命令:

plink --bfile hapmap-ceu --freq --out Allele_Frequency

日志:

PLINK v1.90b6.21 64-bit (19 Oct 2020)          www.cog-genomics.org/plink/1.9/
(C) 2005-2020 Shaun Purcell, Christopher Chang   GNU General Public License v3
Logging to Allele_Frequency.log.
Options in effect:
  --bfile hapmap-ceu
  --freq
  --out Allele_Frequency

15236 MB RAM detected; reserving 7618 MB for main workspace.
2239392 variants loaded from .bim file.
60 people (30 males, 30 females) loaded from .fam.
Using 1 thread (no multithreaded calculations invoked).
Before main variant filters, 60 founders and 0 nonfounders present.
Calculating allele frequencies... done.
Total genotyping rate is 0.992022.
--freq: Allele frequencies (founders only) written to Allele_Frequency.frq .
Warning: 59 het. haploid genotypes present (see Allele_Frequency.hh ); many
commands treat these as missing.

查看结果,结果文件是Allele_Frequency.frq

$ head Allele_Frequency.frq
 CHR          SNP   A1   A2          MAF  NCHROBS
   1   rs12565286    C    G       0.0678      118
   1   rs12138618    A    G      0.05833      120
   1    rs3094315    G    A       0.1552      116
   1    rs3131968    A    G        0.125      120
   1   rs12562034    A    G      0.09167      120
   1    rs2905035    A    G        0.125      120
   1   rs12124819    G    A       0.3417      120
   1    rs2980319    A    T        0.125      120
   1    rs4040617    G    A        0.125      120

如果对其进行质控,用–maf 0.01,会去掉maf小于0.01的位点。

6.2 缺失

缺失包括样本缺失率统计和位点缺失率统计。

命令:

plink --bfile hapmap-ceu --missing --out missing_data

日志:

$ plink --bfile hapmap-ceu --missing --out missing_data
PLINK v1.90b6.21 64-bit (19 Oct 2020)          www.cog-genomics.org/plink/1.9/
(C) 2005-2020 Shaun Purcell, Christopher Chang   GNU General Public License v3
Logging to missing_data.log.
Options in effect:
  --bfile hapmap-ceu
  --missing
  --out missing_data

15236 MB RAM detected; reserving 7618 MB for main workspace.
2239392 variants loaded from .bim file.
60 people (30 males, 30 females) loaded from .fam.
Using 1 thread (no multithreaded calculations invoked).
Before main variant filters, 60 founders and 0 nonfounders present.
Calculating allele frequencies... done.
Total genotyping rate is 0.992022.
--missing: Sample missing data report written to missing_data.imiss, and
variant-based missing data report written to missing_data.lmiss.
Warning: 59 het. haploid genotypes present (see missing_data.hh ); many
commands treat these as missing.

查看样本缺失的文件:

$ head missing_data.imiss
 FID       IID MISS_PHENO   N_MISS   N_GENO   F_MISS
1334   NA12144          Y    15077  2239392 0.006733
1334   NA12145          Y    19791  2239392 0.008838
1334   NA12146          Y    13981  2239392 0.006243
1334   NA12239          Y    14072  2239392 0.006284
1340   NA06994          Y    16080  2239392 0.007181
1340   NA07000          Y    26113  2239392  0.01166
1340   NA07022          Y    17467  2239392   0.0078
1340   NA07056          Y    12133  2239392 0.005418
1341   NA07034          Y    20425  2239392 0.009121

查看位点缺失的文件:

$ head missing_data.lmiss
 CHR          SNP   N_MISS   N_GENO   F_MISS
   1   rs12565286        1       60  0.01667
   1   rs12138618        0       60        0
   1    rs3094315        2       60  0.03333
   1    rs3131968        0       60        0
   1   rs12562034        0       60        0
   1    rs2905035        0       60        0
   1   rs12124819        0       60        0
   1    rs2980319        0       60        0
   1    rs4040617        0       60        0

6.3 哈温检测

–hardy

代码:

plink --bfile 1kg_EU_qc --hardy

日志:

PLINK v1.90b5.3 64-bit (21 Feb 2018)           www.cog-genomics.org/plink/1.9/
(C) 2005-2018 Shaun Purcell, Christopher Chang   GNU General Public License v3
Logging to plink.log.
Options in effect:
  --bfile 1kg_EU_qc
  --hardy

1031523 MB RAM detected; reserving 515761 MB for main workspace.
851065 variants loaded from .bim file.
379 people (178 males, 201 females) loaded from .fam.
Using 1 thread (no multithreaded calculations invoked).
Before main variant filters, 379 founders and 0 nonfounders present.
Calculating allele frequencies... done.
--hardy: Writing Hardy-Weinberg report (founders only) to plink.hwe ... done.

结果:

[dengfei@localhost 08_chapter]$ head plink.hwe
 CHR         SNP     TEST   A1   A2                 GENO   O(HET)   E(HET)            P
   1   rs1048488  ALL(NP)    C    T            9/136/234   0.3588   0.3238      0.03894
   1   rs3115850  ALL(NP)    T    C            8/135/236   0.3562    0.319      0.02412
   1   rs2519031  ALL(NP)    G    A             0/11/368  0.02902   0.0286            1
   1   rs4970383  ALL(NP)    A    C           22/149/208   0.3931   0.3796       0.5881
   1   rs4475691  ALL(NP)    T    C           13/118/248   0.3113   0.3078            1
   1   rs1806509  ALL(NP)    C    A           67/171/141   0.4512   0.4809       0.2402
   1   rs7537756  ALL(NP)    G    A           14/124/241   0.3272   0.3206       0.8725
   1  rs28576697  ALL(NP)    C    T           37/161/181   0.4248   0.4278       0.9045
   1   rs7523549  ALL(NP)    T    C             0/28/351  0.07388  0.07115            1
[dengfei@localhost 08_chapter]$ wc -l plink.hwe
851066 plink.hwe

6.4 杂合率检测

–het

代码:

plink --bfile 1kg_EU_qc --het

日志:

PLINK v1.90b5.3 64-bit (21 Feb 2018)           www.cog-genomics.org/plink/1.9/
(C) 2005-2018 Shaun Purcell, Christopher Chang   GNU General Public License v3
Logging to plink.log.
Options in effect:
  --bfile 1kg_EU_qc
  --het

1031523 MB RAM detected; reserving 515761 MB for main workspace.
851065 variants loaded from .bim file.
379 people (178 males, 201 females) loaded from .fam.
Using 1 thread (no multithreaded calculations invoked).
Before main variant filters, 379 founders and 0 nonfounders present.
Calculating allele frequencies... done.
851065 variants and 379 people pass filters and QC.
Note: No phenotypes present.
--het: 851065 variants scanned, report written to plink.het .


结果:

[dengfei@localhost 08_chapter]$ head plink.het
 FID       IID       O(HOM)       E(HOM)        N(NM)            F
   0   HG00096       582990    5.838e+05       851065    -0.003127
   0   HG00097       582246    5.838e+05       851065    -0.005911
   0   HG00099       582456    5.838e+05       851065    -0.005125
   0   HG00100       582700    5.838e+05       851065    -0.004212
   0   HG00101       581527    5.838e+05       851065    -0.008602
   0   HG00102       585010    5.838e+05       851065     0.004432
   0   HG00103       583984    5.838e+05       851065    0.0005925
   0   HG00104       586189    5.838e+05       851065     0.008844
   0   HG00106       583868    5.838e+05       851065    0.0001584
[dengfei@localhost 08_chapter]$ wc -l plink.het
380 plink.het


7. 数据质控qc

7.1 样本质控–mind

代码:

 plink --bfile 1kg_EU_qc --mind 0.1 --recode --out re1

日志:


PLINK v1.90b5.3 64-bit (21 Feb 2018)           www.cog-genomics.org/plink/1.9/
(C) 2005-2018 Shaun Purcell, Christopher Chang   GNU General Public License v3
Logging to re1.log.
Options in effect:
  --bfile 1kg_EU_qc
  --mind 0.1
  --out re1
  --recode

1031523 MB RAM detected; reserving 515761 MB for main workspace.
851065 variants loaded from .bim file.
379 people (178 males, 201 females) loaded from .fam.
0 people removed due to missing genotype data (--mind).
Using 1 thread (no multithreaded calculations invoked).
Before main variant filters, 379 founders and 0 nonfounders present.
Calculating allele frequencies... done.
851065 variants and 379 people pass filters and QC.
Note: No phenotypes present.
--recode ped to re1.ped + re1.map ... done.


结果:


[dengfei@localhost 08_chapter]$ wc -l re1.*
        24 re1.log
    851065 re1.map
       379 re1.ped
    851468 总用量

7.2 位点质控–geno

代码:

plink --bfile 1kg_EU_qc --geno 0.1 --recode --out re1

日志:

PLINK v1.90b5.3 64-bit (21 Feb 2018)           www.cog-genomics.org/plink/1.9/
(C) 2005-2018 Shaun Purcell, Christopher Chang   GNU General Public License v3
Logging to re1.log.
Options in effect:
  --bfile 1kg_EU_qc
  --geno 0.1
  --out re1
  --recode

1031523 MB RAM detected; reserving 515761 MB for main workspace.
851065 variants loaded from .bim file.
379 people (178 males, 201 females) loaded from .fam.
Using 1 thread (no multithreaded calculations invoked).
Before main variant filters, 379 founders and 0 nonfounders present.
Calculating allele frequencies... done.
0 variants removed due to missing genotype data (--geno).
851065 variants and 379 people pass filters and QC.
Note: No phenotypes present.
--recode ped to re1.ped + re1.map ... done.



结果:

[dengfei@localhost 08_chapter]$ wc -l re1*
        24 re1.log
    851065 re1.map
       379 re1.ped
    851468 总用量

7.3 maf质控–maf

代码:

plink --bfile 1kg_EU_qc --maf 0.01 --recode --out re1

日志:

PLINK v1.90b5.3 64-bit (21 Feb 2018)           www.cog-genomics.org/plink/1.9/
(C) 2005-2018 Shaun Purcell, Christopher Chang   GNU General Public License v3
Logging to re1.log.
Options in effect:
  --bfile 1kg_EU_qc
  --maf 0.01
  --out re1
  --recode

1031523 MB RAM detected; reserving 515761 MB for main workspace.
851065 variants loaded from .bim file.
379 people (178 males, 201 females) loaded from .fam.
Using 1 thread (no multithreaded calculations invoked).
Before main variant filters, 379 founders and 0 nonfounders present.
Calculating allele frequencies... done.
17767 variants removed due to minor allele threshold(s)
(--maf/--max-maf/--mac/--max-mac).
833298 variants and 379 people pass filters and QC.
Note: No phenotypes present.
--recode ped to re1.ped + re1.map ... done.



结果:

[dengfei@localhost 08_chapter]$ wc -l re1*
        25 re1.log
    833298 re1.map
       379 re1.ped
    833702 总用量


7.4 哈温质控 --hwe

代码:

plink --bfile 1kg_EU_qc --hwe 1e-5 --recode --out re1

日志:

PLINK v1.90b5.3 64-bit (21 Feb 2018)           www.cog-genomics.org/plink/1.9/
(C) 2005-2018 Shaun Purcell, Christopher Chang   GNU General Public License v3
Logging to re1.log.
Options in effect:
  --bfile 1kg_EU_qc
  --hwe 1e-5
  --out re1
  --recode

1031523 MB RAM detected; reserving 515761 MB for main workspace.
851065 variants loaded from .bim file.
379 people (178 males, 201 females) loaded from .fam.
Using 1 thread (no multithreaded calculations invoked).
Before main variant filters, 379 founders and 0 nonfounders present.
Calculating allele frequencies... done.
--hwe: 25 variants removed due to Hardy-Weinberg exact test.
851040 variants and 379 people pass filters and QC.
Note: No phenotypes present.
--recode ped to re1.ped + re1.map ... done.



结果:

[dengfei@localhost 08_chapter]$ wc -l re1*
        24 re1.log
    851040 re1.map
       379 re1.ped
    851443 总用量

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2558.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

JDBC-01:如何获取数据库连接

文章目录初步了解jdbcJDBC程序编写步骤Driver接口介绍导入驱动(idea)加载与注册JDBC驱动要素一:URL要素二:用户名和密码获取数据库连接获取数据库连接的方式一获取数据库连接的方式二获取数据库连接的方式三获取数据库连接的方式四…

FreeRTOS移植STM32 printf()函数重定向到USART3

我们在移植FreeRTOS过程中如果没有printf()函数打印调试信息到串口精灵,则程序开发就会非常不方便。本文实现STM32工程上的printf()函数,方便用于程序开发中调试信息打印到电脑上的串口调试精灵。 最简单的方法就是使用MicroLIB库。 一、KEIL-MDK中勾选U…

字体管理工具 - RightFont使用教程

RightFont RightFont是 Mac OS X 上一款非常轻巧的字体管理工具,目前已经完成了与 PhotoShop、Sketch 两大设计应用的集成。RightFont 是 Mac系统上一款优秀的字体管理工具,专为设计师设计,轻量化和简洁,可以方便快速的管理你的字…

《C陷阱与缺陷》读书笔记1

词法分析:贪心法 主要就是解释词法分析时的原则,即: 编译器将程序分解为符号时,从左到右一个字符接一个字符的读入。如果编译器的输入流截止至某个字符之前都已经被分解为一个个符号,那么下一个符号将包括从该字符之…

Linux文件锁的使用

文件是一种共享资源,多个进程对同一文件进行操作的时候,必然涉及到竞争状态,因此引入了文件锁实现对共享资源的访问进行保护的机制,通过对文件上锁, 来避免访问共享资源产生竞争 状态。 一、文件锁的分类 1.建议性锁 建议性锁本质上是一种协…

Java并发编程——Threadlocal源码解析

Threadlocal源码解析一、基本结构二、ThreadLocal操作set操作get操作remove操作三、内存泄露?四、ThreadLocalMap核心变量数组下标计算方式阈值计算扩容下标冲突(hash冲突)从名称上来看可以理解为线程本地变量,也可以认为是线程局…

(JAVA)认识Java中的数据类型和变量

文章目录前言1.字面常量2. 数据类型3.变量3.1 变量概念3.2 语法格式3.3 整形变量3.4 浮点型变量3.5 字符型变量3.6布尔类型变量3.7 类型转换3.7.1 隐式转换(自动类型转换)3.7.2 显示转换 (强制类型转换)3.8 类型提升4. 字符串类型…

驱动开发:内核层InlineHook挂钩函数

在上一章《驱动开发:内核LDE64引擎计算汇编长度》中,LyShark教大家如何通过LDE64引擎实现计算反汇编指令长度,本章将在此基础之上实现内联函数挂钩,内核中的InlineHook函数挂钩其实与应用层一致,都是使用劫持执行流并跳…

三类基于贪心思想的区间覆盖问题【配套资源详解】

博主主页:Yu仙笙 配套资源:三类基于贪心算法覆盖问题-C文档类资源-CSDN下载 目录 三类基于贪心思想的区间覆盖问题 情形1:区间完全覆盖问题 描述: 样例: 解题过程: 例题: 题意: 例题&#xff1a…

深入理解Kafka服务端之索引文件及mmap内存映射

深入理解Kafka服务端之索引文件及mmap内存映射 - 墨天轮 一、场景分析 Kafka在滚动生成新日志段的时候,除了生成日志文件(.log),会同时生成一个偏移量索引文件(.index)、一个时间戳索引文件(.timeindex)和一个已中止事务索引文件(.txnindex)。 由于索引写…

JVM面试高频问题

一、进程与线程 在谈JVM的这些问题前,我们先来复习一下有关线程和进程的关系 进程可以看作是程序的执行过程。一个程序的运行需要CPU时间、内存空间、文件以及I/O等资源。操作系统就是以进程为单位来分配这些资源的,所以说进程是分配资源的基本单位。线…

C语言函数章--该如何学习函数?阿斗看了都说会学习了

前言 👻作者:龟龟不断向前 👻简介:宁愿做一只不停跑的慢乌龟,也不想当一只三分钟热度的兔子。 👻专栏:C初阶知识点 👻工具分享: 刷题: 牛客网 leetcode笔记软…

【Python入门指北】 发邮件与正则表达式

文章目录邮件发送一、群发邮件二、指定用户发邮件正则表达式一、预备知识正则1. 正则介绍2. 陷阱3. 特殊的字符二、 re 模块的方法1 常用方法2. 正则分组总结邮件发送 #第三方模块 yagmail #pip3 install yagmailimport yagmail""" 项目需求 yag yagmail.SMTP(u…

MyBatis Plus实现动态字段排序

利用周末时间,对已有的项目进行了升级,原来使用的是tkmybatis,改为mybatis plus。但是由于修改了返回数据的格式,前端页面字段排序失效了,需要刷新表格才会排序。页面效果如下 easyui的数据表格datagrid支持多字段排序…

【仿牛客网笔记】Spring Boot实践,开发社区登录模块-账号设置,检查登录

首先访问账号设置的页面。 新建一个Controller,用过RequestMapping生成访问路径 上传头像 首先打开配置文件,配置一下将文件配置到哪里。 直接在Controller存了, 更新的时候掉Map,参数为id和路径。 注入日志对象后,通过Val…

SpringBoot项目启动执行任务的几种方式

经过整理后得到以下几种常用方式,供大家参考。 1. 使用过滤器 init() :该方法在tomcat容器启动初始化过滤器时被调用,它在 Filter 的整个生命周期只会被调用一次。可以在这个方法中补充想要执行的内容。 Component public class MyFilter …

CTF竞赛网络安全大赛(网鼎杯 )Web|sql注入java反序列化

CTF竞赛网络安全大赛题目考点 sql注入 java反序列化 网鼎杯解题思路 题目一打开是这样的界面 下载题目的附件,并用jd-gui.exe打开 核心代码如下 Test代码 `` package 部分class;import cn.abc.common.bean.ResponseCode; import cn.abc.common.bean.ResponseResult; impor…

持续交付中流水线构建完成后就大功告成了吗?别忘了质量保障

上期文章我结合自己的实践经验,介绍了持续交付中流水线模式的软件构建,以及在构建过程中的3个关键问题。我们可以看出,流水线的软件构建过程相对精简、独立,只做编译 和打包两个动作。 但需要明确的是,在持续交付过程…

网课查题接口使用方法

网课查题接口使用方法 本平台优点: 多题库查题、独立后台、响应速度快、全网平台可查、功能最全! 1.想要给自己的公众号获得查题接口,只需要两步! 2.题库: 查题校园题库:查题校园题库后台(点…

Hadoop面试题汇总-20221031

Hadoop面试题汇总 HDFS部分 1、请描述HDFS的写流程。 答: 首先由客户端向 NameNode 发起文件上传请求,NameNode 检查文件要上传的目录,并鉴权。如果上传用户对此目录有权限,则允许客户端进行上传操作。客户端接收到允许指令后&…