Cross reference some putative variants across multiple samples
A quick introduction. I received 5 samples of DNA sequencing data with a question: are there some shared/unique variants compared to the reference genome. As a reminder, these are orn deletion strains of pseudomonas.
I did the following:
- Trim the data aggressively to attempt to make sure there are as few sequencing mishaps as possible left in the data. This includes trimming off the first 10 nucleotides of every read.
- Pass the data to a mapper (bowtie2).
- Pass those results to my own samtools-based variant finder, which is quite conservative.
- Pass those results to the snippy software package.
The agreement is quite nice between the tools, which is encouraging. My tool is perhaps too conservative and suggests that more coverage is needed. Snippy suggests to me that the coverage is sufficient. I think I agree with snippy at this time.
There are a series of images in the igv/ directory which in theory back up these suppositions. I took one picture for each variant observed by snippy. Now I am going to read the results from it and look to see how many of these variants are shared among all samples vs. are unique.
Depending on what these results look like, I may do some venn or other shenanigans.
## Parsed with column specification:
## cols(
## CHROM = col_character(),
## POS = col_double(),
## TYPE = col_character(),
## REF = col_character(),
## ALT = col_character(),
## EVIDENCE = col_character(),
## FTYPE = col_character(),
## STRAND = col_character(),
## NT_POS = col_character(),
## AA_POS = col_character(),
## EFFECT = col_character(),
## LOCUS_TAG = col_character(),
## GENE = col_character(),
## PRODUCT = col_character()
## )
## Warning: 85 parsing failures.
## row col expected actual file
## 1 -- 14 columns 6 columns 'preprocessing/070919_21/outputs/snippy_paeruginosa_pa14/snps.csv'
## 2 -- 14 columns 6 columns 'preprocessing/070919_21/outputs/snippy_paeruginosa_pa14/snps.csv'
## 3 -- 14 columns 6 columns 'preprocessing/070919_21/outputs/snippy_paeruginosa_pa14/snps.csv'
## 4 -- 14 columns 6 columns 'preprocessing/070919_21/outputs/snippy_paeruginosa_pa14/snps.csv'
## 5 -- 14 columns 6 columns 'preprocessing/070919_21/outputs/snippy_paeruginosa_pa14/snps.csv'
## ... ... .......... ......... ..................................................................
## See problems(...) for more details.
## Parsed with column specification:
## cols(
## CHROM = col_character(),
## POS = col_double(),
## TYPE = col_character(),
## REF = col_character(),
## ALT = col_character(),
## EVIDENCE = col_character(),
## FTYPE = col_character(),
## STRAND = col_character(),
## NT_POS = col_character(),
## AA_POS = col_character(),
## EFFECT = col_character(),
## LOCUS_TAG = col_character(),
## GENE = col_character(),
## PRODUCT = col_character()
## )
## Warning: 81 parsing failures.
## row col expected actual file
## 1 -- 14 columns 6 columns 'preprocessing/070919_32/outputs/snippy_paeruginosa_pa14/snps.csv'
## 2 -- 14 columns 6 columns 'preprocessing/070919_32/outputs/snippy_paeruginosa_pa14/snps.csv'
## 3 -- 14 columns 6 columns 'preprocessing/070919_32/outputs/snippy_paeruginosa_pa14/snps.csv'
## 4 -- 14 columns 6 columns 'preprocessing/070919_32/outputs/snippy_paeruginosa_pa14/snps.csv'
## 5 -- 14 columns 6 columns 'preprocessing/070919_32/outputs/snippy_paeruginosa_pa14/snps.csv'
## ... ... .......... ......... ..................................................................
## See problems(...) for more details.
## Parsed with column specification:
## cols(
## CHROM = col_character(),
## POS = col_double(),
## TYPE = col_character(),
## REF = col_character(),
## ALT = col_character(),
## EVIDENCE = col_character(),
## FTYPE = col_character(),
## STRAND = col_character(),
## NT_POS = col_character(),
## AA_POS = col_character(),
## EFFECT = col_character(),
## LOCUS_TAG = col_character(),
## GENE = col_character(),
## PRODUCT = col_character()
## )
## Warning: 102 parsing failures.
## row col expected actual file
## 1 -- 14 columns 6 columns 'preprocessing/070919_54/outputs/snippy_paeruginosa_pa14/snps.csv'
## 2 -- 14 columns 6 columns 'preprocessing/070919_54/outputs/snippy_paeruginosa_pa14/snps.csv'
## 3 -- 14 columns 6 columns 'preprocessing/070919_54/outputs/snippy_paeruginosa_pa14/snps.csv'
## 4 -- 14 columns 6 columns 'preprocessing/070919_54/outputs/snippy_paeruginosa_pa14/snps.csv'
## 5 -- 14 columns 6 columns 'preprocessing/070919_54/outputs/snippy_paeruginosa_pa14/snps.csv'
## ... ... .......... ......... ..................................................................
## See problems(...) for more details.
## Parsed with column specification:
## cols(
## CHROM = col_character(),
## POS = col_double(),
## TYPE = col_character(),
## REF = col_character(),
## ALT = col_character(),
## EVIDENCE = col_character(),
## FTYPE = col_character(),
## STRAND = col_character(),
## NT_POS = col_character(),
## AA_POS = col_character(),
## EFFECT = col_character(),
## LOCUS_TAG = col_character(),
## GENE = col_character(),
## PRODUCT = col_character()
## )
## Warning: 102 parsing failures.
## row col expected actual file
## 1 -- 14 columns 6 columns 'preprocessing/070919_65/outputs/snippy_paeruginosa_pa14/snps.csv'
## 2 -- 14 columns 6 columns 'preprocessing/070919_65/outputs/snippy_paeruginosa_pa14/snps.csv'
## 3 -- 14 columns 6 columns 'preprocessing/070919_65/outputs/snippy_paeruginosa_pa14/snps.csv'
## 4 -- 14 columns 6 columns 'preprocessing/070919_65/outputs/snippy_paeruginosa_pa14/snps.csv'
## 5 -- 14 columns 6 columns 'preprocessing/070919_65/outputs/snippy_paeruginosa_pa14/snps.csv'
## ... ... .......... ......... ..................................................................
## See problems(...) for more details.
## Parsed with column specification:
## cols(
## CHROM = col_character(),
## POS = col_double(),
## TYPE = col_character(),
## REF = col_character(),
## ALT = col_character(),
## EVIDENCE = col_character(),
## FTYPE = col_character(),
## STRAND = col_character(),
## NT_POS = col_character(),
## AA_POS = col_character(),
## EFFECT = col_character(),
## LOCUS_TAG = col_character(),
## GENE = col_character(),
## PRODUCT = col_character()
## )
## Warning: 84 parsing failures.
## row col expected actual file
## 1 -- 14 columns 6 columns 'preprocessing/070919_76/outputs/snippy_paeruginosa_pa14/snps.csv'
## 2 -- 14 columns 6 columns 'preprocessing/070919_76/outputs/snippy_paeruginosa_pa14/snps.csv'
## 3 -- 14 columns 6 columns 'preprocessing/070919_76/outputs/snippy_paeruginosa_pa14/snps.csv'
## 4 -- 14 columns 6 columns 'preprocessing/070919_76/outputs/snippy_paeruginosa_pa14/snps.csv'
## 5 -- 14 columns 6 columns 'preprocessing/070919_76/outputs/snippy_paeruginosa_pa14/snps.csv'
## ... ... .......... ......... ..................................................................
## See problems(...) for more details.
## [1] 146 5
## 070919_21 070919_32 070919_54 070919_65
## Min. : 9.0 Min. : 7.0 Min. :10.0 Min. :10.0
## 1st Qu.:12.0 1st Qu.:12.0 1st Qu.:12.0 1st Qu.:12.0
## Median :14.0 Median :14.0 Median :15.0 Median :14.0
## Mean :16.4 Mean :15.6 Mean :17.2 Mean :17.1
## 3rd Qu.:19.0 3rd Qu.:17.0 3rd Qu.:19.0 3rd Qu.:18.0
## Max. :69.0 Max. :46.0 Max. :58.0 Max. :65.0
## NA's :61 NA's :65 NA's :44 NA's :44
## 070919_76
## Min. :10.0
## 1st Qu.:11.0
## Median :13.0
## Mean :15.5
## 3rd Qu.:17.2
## Max. :40.0
## NA's :62

Get shared positions by gene
## Loading required package: stats4
## Loading required package: S4Vectors
##
## Attaching package: 'S4Vectors'
## The following object is masked from 'package:base':
##
## expand.grid
## Loading required package: IRanges
## Loading required package: GenomeInfoDb
## Loading required namespace: rentrez
## Done Parsing raw GenBank file text. [ 21.443 seconds ]
## 2019-07-29 17:46:27 Starting creation of gene GRanges
## 2019-07-29 17:46:29 Starting creation of CDS GRanges
## Translation product seems to be missing for 77 of 6102 CDS annotations. Setting to ''
## 2019-07-29 17:46:32 Starting creation of exon GRanges
## No exons read from genbank file. Assuming sections of CDS are full exons
## 2019-07-29 17:46:32 Starting creation of variant VRanges
## 2019-07-29 17:46:32 Starting creation of transcript GRanges
## No transcript features (mRNA) found, using spans of CDSs
## 2019-07-29 17:46:32 Starting creation of misc feature GRanges
## Warning in fill_stack_df(feats[!typs %in% c("gene", "exon", "CDS",
## "variation", : Got unexpected multi-value field(s) [ inference ]. The
## resulting column(s) will be of class CharacterList, rather than vector(s).
## Please contact the maintainer if multi-valuedness is expected/meaningful
## for the listed field(s).
## 2019-07-29 17:46:33 - Done creating GenBankRecord object [ 5.70699999999999 seconds ]
## GRanges object with 6102 ranges and 19 metadata columns:
## seqnames ranges strand | type locus_tag
## <Rle> <IRanges> <Rle> | <character> <character>
## [1] UCBPP-PA14 483-2027 + | CDS PA14_RS00005
## [2] UCBPP-PA14 2056-3159 + | CDS PA14_RS00010
## [3] UCBPP-PA14 3169-4271 + | CDS PA14_RS00015
## [4] UCBPP-PA14 4275-6695 + | CDS PA14_RS00020
## [5] UCBPP-PA14 7018-7791 - | CDS PA14_RS00025
## ... ... ... ... . ... ...
## [6098] UCBPP-PA14 6533464-6533652 + | CDS PA14_RS31130
## [6099] UCBPP-PA14 6533634-6535001 - | CDS PA14_RS29880
## [6100] UCBPP-PA14 6535072-6536808 - | CDS PA14_RS29885
## [6101] UCBPP-PA14 6537049-6537456 - | CDS PA14_RS29890
## [6102] UCBPP-PA14 6537471-6537605 - | CDS PA14_RS29895
## old_locus_tag
## <CharacterList>
## [1] PA14_00010
## [2] PA14_00020
## [3] PA14_00030
## [4] PA14_00050
## [5] PA14_00060
## ... ...
## [6098] <NA>
## [6099] PA14_73400
## [6100] PA14_73410
## [6101] PA14_73420
## [6102] <NA>
## inference
## <character>
## [1] COORDINATES: similar to AAsequence:RefSeq:NP_064721.1
## [2] COORDINATES: similar to AAsequence:RefSeq:WP_002551317.1
## [3] COORDINATES: similar to AAsequence:RefSeq:WP_003253154.1
## [4] COORDINATES: similar to AAsequence:RefSeq:NP_064724.1
## [5] COORDINATES: similar to AAsequence:RefSeq:NP_064725.1
## ... ...
## [6098] COORDINATES: similar to AAsequence:RefSeq:WP_019727085.1
## [6099] COORDINATES: similar to AAsequence:RefSeq:NP_254254.1
## [6100] COORDINATES: similar to AAsequence:RefSeq:NP_254255.1
## [6101] COORDINATES: similar to AAsequence:RefSeq:NP_254256.1
## [6102] COORDINATES: similar to AAsequence:RefSeq:WP_002551315.1
## note
## <character>
## [1] Derived by automated computational analysis usinggene prediction method: Protein Homology.
## [2] Derived by automated computational analysis usinggene prediction method: Protein Homology.
## [3] frameshifted; Derived by automated computationalanalysis using gene prediction method: Protein Homology.
## [4] Derived by automated computational analysis usinggene prediction method: Protein Homology.
## [5] Derived by automated computational analysis usinggene prediction method: Protein Homology.
## ... ...
## [6098] incomplete; partial in the middle of a contig;missing stop; Derived by automated computational analysisusing gene prediction method: Protein Homology.
## [6099] Derived by automated computational analysis usinggene prediction method: Protein Homology.
## [6100] Derived by automated computational analysis usinggene prediction method: Protein Homology.
## [6101] Derived by automated computational analysis usinggene prediction method: Protein Homology.
## [6102] Derived by automated computational analysis usinggene prediction method: Protein Homology.
## codon_start transl_table
## <numeric> <numeric>
## [1] 1 11
## [2] 1 11
## [3] 1 11
## [4] 1 11
## [5] 1 11
## ... ... ...
## [6098] 1 11
## [6099] 1 11
## [6100] 1 11
## [6101] 1 11
## [6102] 1 11
## product
## <character>
## [1] chromosomal replication initiator protein DnaA
## [2] DNA polymerase III subunit beta
## [3] DNA replication/repair protein RecF
## [4] DNA gyrase subunit B
## [5] 1-acyl-sn-glycerol-3-phosphate acyltransferase
## ... ...
## [6098] hypothetical protein
## [6099] tRNA uridine-5-carboxymethylaminomethyl(34)synthesis GTPase MnmE
## [6100] membrane protein insertase YidC
## [6101] ribonuclease P protein component
## [6102] 50S ribosomal protein L34
## protein_id translation loctype EC_number
## <character> <AAStringSet> <character> <CharacterList>
## [1] WP_003109151.1 MSV...LTT normal <NA>
## [2] WP_003097262.1 MHF...MRL normal 2.7.7.7
## [3] <NA> normal <NA>
## [4] WP_003097268.1 MSE...LDV normal <NA>
## [5] WP_003100265.1 MST...VVS normal <NA>
## ... ... ... ... ...
## [6098] <NA> normal <NA>
## [6099] WP_003142192.1 MQA...IGK normal <NA>
## [6100] WP_003097255.1 MDI...KTA normal <NA>
## [6101] WP_003100251.1 MVS...THA normal 3.1.26.5
## [6102] WP_003100258.1 MKR...LTV normal <NA>
## pseudo gene ribosomal_slippage gene_synonym
## <logical> <character> <logical> <CharacterList>
## [1] FALSE <NA> FALSE <NA>
## [2] FALSE <NA> FALSE <NA>
## [3] TRUE <NA> FALSE <NA>
## [4] FALSE gyrB FALSE <NA>
## [5] FALSE <NA> FALSE <NA>
## ... ... ... ... ...
## [6098] TRUE <NA> FALSE <NA>
## [6099] FALSE <NA> FALSE <NA>
## [6100] FALSE <NA> FALSE <NA>
## [6101] FALSE <NA> FALSE <NA>
## [6102] FALSE <NA> FALSE <NA>
## transl_except gene_id transcript_id
## <character> <character> <character>
## [1] <NA> PA14_RS00005 PA14_RS00005.1
## [2] <NA> PA14_RS00010 PA14_RS00010.1
## [3] <NA> PA14_RS00015 PA14_RS00015.1
## [4] <NA> PA14_RS00020 PA14_RS00020.1
## [5] <NA> PA14_RS00025 PA14_RS00025.1
## ... ... ... ...
## [6098] <NA> PA14_RS31130 PA14_RS31130.1
## [6099] <NA> PA14_RS29880 PA14_RS29880.1
## [6100] <NA> PA14_RS29885 PA14_RS29885.1
## [6101] <NA> PA14_RS29890 PA14_RS29890.1
## [6102] <NA> PA14_RS29895 PA14_RS29895.1
## -------
## seqinfo: 1 sequence (1 circular) from NC_008463.1 genome
## start end width locus_tag protein_id
## 1 72417 72833 417 PA14_RS00315 WP_011666524.1
## 2 155072 156052 981 PA14_RS00700 WP_011666530.1
## 3 480769 481491 723 PA14_RS02220 WP_011666535.1
## 4 982553 983818 1266 PA14_RS04570 WP_003137629.1
## 5 2362217 2362468 252 PA14_RS10995 <NA>
## 6 2362217 2362468 252 PA14_RS10995 <NA>
## 7 2594316 2595665 1350 PA14_RS12215 <NA>
## 8 2978649 2985995 7347 PA14_RS13715 WP_011666646.1
## 9 3198432 3200081 1650 PA14_RS14615 <NA>
## 10 3356421 3356696 276 PA14_RS30570 WP_079261891.1
## 11 3441918 3443309 1392 PA14_RS15680 WP_011666691.1
## 12 3542183 3543730 1548 PA14_RS16110 WP_011666694.1
## 13 3565650 3566924 1275 PA14_RS16215 <NA>
## 14 3662585 3663361 777 PA14_RS16650 WP_003087949.1
## 15 3711641 3712378 738 PA14_RS16860 WP_011666705.1
## 16 3711641 3712378 738 PA14_RS16860 WP_011666705.1
## 17 3879065 3879706 642 PA14_RS17695 WP_011666710.1
## 18 4564368 4565960 1593 PA14_RS20885 WP_011666728.1
## 19 4760148 4760960 813 PA14_RS21850 WP_011666738.1
## 20 4996812 4998302 1491 PA14_RS22840 WP_011666749.1
## 21 5102858 5104042 1185 PA14_RS23350 WP_011666751.1
## 22 5102858 5104042 1185 PA14_RS23350 WP_011666751.1
## 23 5102858 5104042 1185 PA14_RS23350 WP_011666751.1
## 24 5529629 5530636 1008 PA14_RS25330 WP_003095046.1
## 25 5904323 5907271 2949 PA14_RS27055 WP_003141757.1
## 26 5966750 5968429 1680 PA14_RS27265 WP_011666782.1
## product
## 1 hypothetical protein
## 2 ABC transporter permease
## 3 16S rRNA (uracil(1498)-N(3))-methyltransferase
## 4 ABC transporter permease
## 5 hypothetical protein
## 6 hypothetical protein
## 7 NADH-quinone oxidoreductase subunit F
## 8 non-ribosomal peptide synthetase
## 9 acyl-CoA synthetase
## 10 hypothetical protein
## 11 GntP family permease
## 12 PucR family transcriptional regulator
## 13 hypothetical protein
## 14 hydroxyacylglutathione hydrolase
## 15 uroporphyrinogen-III C-methyltransferase
## 16 uroporphyrinogen-III C-methyltransferase
## 17 LysE family translocator
## 18 anthranilate synthase component 1
## 19 HNH endonuclease
## 20 DUF853 domain-containing protein
## 21 cell division protein FtsZ
## 22 cell division protein FtsZ
## 23 cell division protein FtsZ
## 24 iron ABC transporter substrate-binding protein
## 25 bifunctional [glutamate--ammonialigase]-adenylyl-L-tyrosinephosphorylase/[glutamate--ammonia-ligase]adenylyltransferase
## 26 class II poly(R)-hydroxyalkanoic acid synthase
LS0tCnRpdGxlOiAiUC4gYWVydWdpbm9zYSAyMDE5MDcyMDogQ3Jvc3MgcmVmZXJlbmNlIHB1dGF0aXZlIFNOUHMgYWNyb3NzIHNhbXBsZXMuIgphdXRob3I6ICJhdGIgYWJlbGV3QGdtYWlsLmNvbSIKZGF0ZTogImByIFN5cy5EYXRlKClgIgpvdXRwdXQ6CiAgaHRtbF9kb2N1bWVudDoKICAgIGNvZGVfZG93bmxvYWQ6IHRydWUKICAgIGNvZGVfZm9sZGluZzogc2hvdwogICAgZmlnX2NhcHRpb246IHRydWUKICAgIGZpZ19oZWlnaHQ6IDcKICAgIGZpZ193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