Package 'microhaplot'

Title: Microhaplotype Constructor and Visualizer
Description: A downstream bioinformatics tool to construct and assist curation of microhaplotypes from short read sequences.
Authors: Thomas Ng [aut, cre]
Maintainer: Thomas Ng <[email protected]>
License: GPL-3
Version: 1.0.2
Built: 2025-02-16 04:16:40 UTC
Source: https://github.com/ngthomas/microhaplot

Help Index


Transfer a copy of microhaplot app.

Description

Moves shiny microhaplot app to a different directory

Usage

mvShinyHaplot(path)

Arguments

path

string. directory path. Required

Value

a logical value of whether file.copy is successfully transferred Shiny app to its new directory

Examples

mvShinyHaplot(tempdir())

Extracts haplotype from alignment reads.

Description

The function microhaplot extracts haplotype from sequence alignment files through perl script hapture and returns a summary table of the read depth and read quality associate with haplotype.

Usage

prepHaplotFiles(
  run.label,
  sam.path,
  label.path,
  vcf.path,
  out.path = tempdir(),
  add.filter = FALSE,
  app.path = tempdir(),
  n.jobs = 1
)

Arguments

run.label

character vector. Run label to be used to display in haPLOType. Required

sam.path

string. Directory path folder containing all sequence alignment files (SAM). Required

label.path

string. Label file path. This customized label file is a tab-separate file that contains entries of SAM file name, individual ID, and group label. Required

vcf.path

string. VCF file path. Required

out.path

string. Optional. If not specified, the intermediate files are created under TEMPDIR, with the assumption that directory is granted for written permission.

add.filter

boolean. Optional. If true, this removes any haplotype with unknown and deletion alignment characters i.e. "*" and "_", removes any locus with large number of haplotypes ( # > 40) , and remove any locus with fewer than half of the total individuals.

app.path

string. Path to shiny haPLOType app. Optional. If not specified, the path is default to TEMPDIR.

n.jobs

positive integer. Number of SAM files to be parallel processed. Optional. This multithread is only available for non Window OS. Recommend two times the number of processors/core.

Value

This function returns a dataframe of 9 columns i.e group, id, locus, haplotype, depth, sum of Phred score, max of Phred score, allele balance and haplotype rank from highest to lowest read depth. This dataframe will also be saved in out.path.

Examples

run.label <- "sebastes"

sam.path <- tempdir()
untar(system.file("extdata",
                  "sebastes_sam.tar.gz",
                  package="microhaplot"),
      exdir = sam.path)


label.path <- file.path(sam.path, "label.txt")
vcf.path <- file.path(sam.path, "sebastes.vcf")

mvShinyHaplot(tempdir())
app.path <- file.path(tempdir(), "microhaplot")

# retrieve system Perl version number
perl.version <- as.numeric(system('perl -e "print $];"', intern=TRUE))

if (perl.version >= 5.014) {
haplo.read.tbl <- prepHaplotFiles(run.label = run.label,
                            sam.path = sam.path,
                            out.path = tempdir(),
                            label.path = label.path,
                            vcf.path = vcf.path,
                            app.path = app.path)
}else {
message("Perl version is outdated. Must >= 5.014.")}

Run shiny microhaplot

Description

Run shiny microhaplot app

Usage

runShinyHaplot(
  path = system.file("shiny", "microhaplot", package = "microhaplot")
)

Arguments

path

Path to shiny microhaplot app. Optional. If not specified, the path is default to local app path.

Value

Runs shiny microhaplot application via shiny::runApp which typically doesn't return; interrupt R to stop the application (usually by pressing Ctrl+C or Esc).

Examples

if(interactive()){
runShinyHaplot()
}