Learn R Programming

NIPTeR (version 1.0.2)

bin_bam_sample: Load and bin BAM file

Description

Load a BAM file and count reads in bins of size 50.000 base pairs

Usage

bin_bam_sample(bam_filepath, do_sort = FALSE, separate_strands = FALSE, custom_name = NULL)

Arguments

bam_filepath
Character The location and filename on the file system where the bam file is stored
do_sort
Boolean Sort the bam file? If the bam is unsorted set to true, but the use of pre-sorted bam files is recommended.
separate_strands
Boolean If set to true, reads from forward and reverse strands are counted and stored separately. This option should be used if you are planning on using regression, since this doubles the number of predictors (F+R) and distributes predictive power more equally over prediction sets since F and R strand from the same chromosome cannot be both in one prediction set.
custom_name
String The name of sample. Default samplename is the filename of the bam file without the .bam suffix and filepath prefix.

Value

Object NIPTSample

Details

This function returns an object of class NIPTSample, the main 'currency' of this package. It is a list with 5 items:
  • List autosomal_chromosome_reads Autosomal reads are stored in a matrix where the columns are the bins and rows (22) represent the autosomal chromosomes. The length of this list is either 1 or 2, depending if the forward and reverse reads are counted separately.
  • Character correction_status_autosomal_chromosomes The correction status of the autosomal reads. The status can either be Uncorrected or GC Corrected and/or Chi Corrected
  • List sex_chromosome_reads Sex chromosome reads are stored in a similar matrix(es) as the autosomal chromosome reads, now with 2 (X and Y) rows.
  • Character correction_status_autosomal_chromosomes The status can either be Uncorrected or GC Corrected and/or Chi Corrected.
  • Character sample_name Sample name

Examples

Run this code
## Not run: 
# ##To process a single sample
# binned_sample <- bin_bam_sample(bam_filepath = "/path/to/file.bam", 
#                                 separate_strands = T)
# 
# ##To create a control group out of a set of bam files
# bam_filepaths <- list.files(path = "/Path/to/bamfiles/", 
#                             pattern = ".bam", full.names = T)
# 
# control_group  <- as_control_group(nipt_samples = lapply(X = bam_filepaths, 
#                                    bin_bam_sample, do_sort = F, 
#                                    separate_strands = T))
# ## End(Not run)

Run the code above in your browser using DataLab