metascope_id | R Documentation |
This function will read in a .bam or .rds file, annotate the taxonomy and genome names, reduce the mapping ambiguity using a mixture model, and output a .csv file with the results. Currently, it assumes that the genome library/.bam files use NCBI accession names for reference names (rnames in .bam file).
metascope_id( input_file, input_type = "bam", aligner = "subread", NCBI_key = NULL, out_file = paste(tools::file_path_sans_ext(input_file), ".metascope_id.csv", sep = ""), EMconv = 1/10000, EMmaxIts = 25, num_species_plot = NULL )
input_file |
The .bam or .rds file that needs to be identified. |
input_type |
Extension of file input. Should be either "bam" or "rds". Default is "bam". |
aligner |
The aligner which was used to create the bam file. Default is "subread" but can also be set to "bowtie" or "other" |
NCBI_key |
(character) NCBI Entrez API key. optional. See taxize::use_entrez(). Due to the high number of requests made to NCBI, this function will be less prone to errors if you obtain an NCBI key. You may enter the string as an input or set it as ENTREZ_KEY in .Renviron. |
out_file |
The name of the .csv output file. Defaults to the input_file basename plus ".metascope_id.csv". |
EMconv |
The convergence parameter of the EM algorithm. Default set at
|
EMmaxIts |
The maximum number of EM iterations, regardless of whether
the EMconv is below the threshhold. Default set at |
num_species_plot |
The number of genome coverage plots to be saved.
Default is |
This function returns a .csv file with annotated read counts to genomes with mapped reads. The function itself returns the output .csv file name.
#### Align reads to reference library and then apply metascope_id() ## Assuming filtered bam files already exist ## Subread aligned bam file ## Create object with path to filtered subread bam file bamPath <- system.file("extdata","subread_target.filtered.bam", package = "MetaScope") ## Run metascope id with the aligner option set to subread metascope_id(input_file = bamPath, aligner = "subread", num_species_plot = 0) ## Bowtie aligned bam file ## Create object with path to filtered subread bam file bamPath <- system.file("extdata","bowtie_target.filtered.bam", package = "MetaScope") ## Run metascope id with the aligner option set to bowtie metascope_id(input_file = bamPath, aligner = "bowtie", num_species_plot = 0) ## Different or unknown aligned bam file ## Create object with path to unknown origin bam file bamPath <- system.file("extdata","subread_target.filtered.bam", package = "MetaScope") ## Run metascope id with the aligner option set to other metascope_id(input_file = bamPath, aligner = "other", num_species_plot = 0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.