make_pheno: Make Phenotype File

View source: R/make_pheno.R

make_phenoR Documentation

Make Phenotype File

Description

make_pheno generates a Pheno data.frame object containing additional metadata for unique samples.

Usage

make_pheno(pheno, counts = NULL, progress_report = NULL)

Arguments

pheno

Character vector with the path to a .csv file or a data.frame with a column named "Sample_ID".

counts

Data.frame object with the same column names as in Sample_ID column of the pheno.

progress_report

Data.frame object with progress report.

Details

Given the path to a directory with a single csv file, the function will read the file. Alternatively, a data.frame with sample information can be provided. If provided with a count table, (see make_counts), it will attempt to organize the row names according to the column names in the counts table.

Value

A Pheno data.frame compatible with make_PAC

See Also

https://github.com/Danis102 for updates on the current package.

Other PAC generation: PAC_check(), create_PAC(), make_PAC(), make_counts(), make_cutadapt(), make_trim(), merge_lanes()

Examples


### First make counts 

# Seqpac includes strongly down-sampled smallRNA fastq.
sys_path = system.file("extdata", package = "seqpac", mustWork = TRUE)
input <- list.files(path = sys_path, pattern = "fastq", all.files = FALSE,
                full.names = TRUE)

# Notice that make_counts will generate another temp folder, that will 
# be emptied on finalization. By setting save_temp=TRUE you may save the 
# content.  
 
counts  <- make_counts(input, threads=2, parse="default_neb",
                       trimming="seqpac", plot=TRUE,
                       evidence=c(experiment=2, sample=1))

colnames(counts$counts)

### Then generate a phenotype table with make_pheno

#  Note:  'Sample_ID' column needs to be similar IDs as 
#          colnames in the counts table. You may also 
#          specify a path to a txt file.

Sample_ID <- colnames(counts$counts)

pheno <- data.frame(Sample_ID=Sample_ID,
                       Treatment=c(rep("heat", times=1), 
                                   rep("control", times=2)),
                       Batch=rep(c("1", "2", "3"), times=1)) 

pheno <- make_pheno(pheno=pheno, progress_report=counts$progress_report, 
                     counts=counts$counts)


pheno 

# Note that progress report from make_counts is added if you specify it  
     
### Lastly combine into PAC

pac <- make_PAC(pheno=pheno, counts=counts$counts)


pac
names(pac)

# Note: a simple annotation table is added automatically.
head(anno(pac))

# Clean up temp
closeAllConnections()
fls_temp  <- list.files(tempdir(), recursive=TRUE, full.names = TRUE)
file.remove(fls_temp, showWarnings=FALSE)


Danis102/seqpac documentation built on Aug. 26, 2023, 10:15 a.m.