countLines: Count lines in all (text) files in a directory whose file...

Description Usage Arguments Value Author(s) Examples

View source: R/AllGenerics-Base.R

Description

countLines visits all files in a directory path dirPath whose base (i.e., file) name matches pattern. Lines in the file are counted as the number of new line characters.

Usage

1
countLines(dirPath, pattern=character(0), ..., useFullName=FALSE)

Arguments

dirPath

A character vector (or other object; see methods defined on this generic) giving the directory path (relative or absolute) of files whose lines are to be counted.

pattern

The (grep-style) pattern describing files whose lines are to be counted. The default (character(0)) results in line counts for all files in the directory.

...

Additional arguments, passed internally to list.files. See list.files.

useFullName

A logical(1) indicating whether elements of the returned vector should be named with the base (file) name (default; useFullName=FALSE) or the full path name (useFullName=TRUE).

Value

A named integer vector of line counts. Names are paths to the files whose lines have been counted, excluding dirPath.

Author(s)

Martin Morgan

Examples

1
2
3
4
sp <- SolexaPath(system.file('extdata', package='ShortRead'))
countLines(analysisPath(sp))
countLines(experimentPath(sp), recursive=TRUE)
countLines(experimentPath(sp), recursive=TRUE, useFullName=TRUE)

Example output

Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colMeans, colSums, colnames, do.call,
    duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
    lapply, lengths, mapply, match, mget, order, paste, pmax, pmax.int,
    pmin, pmin.int, rank, rbind, rowMeans, rowSums, rownames, sapply,
    setdiff, sort, table, tapply, union, unique, unsplit, which,
    which.max, which.min

Loading required package: BiocParallel
Loading required package: Biostrings
Loading required package: S4Vectors
Loading required package: stats4

Attaching package: 'S4Vectors'

The following object is masked from 'package:base':

    expand.grid

Loading required package: IRanges
Loading required package: XVector

Attaching package: 'Biostrings'

The following object is masked from 'package:base':

    strsplit

Loading required package: Rsamtools
Loading required package: GenomeInfoDb
Loading required package: GenomicRanges
Loading required package: GenomicAlignments
Loading required package: SummarizedExperiment
Loading required package: Biobase
Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

Loading required package: DelayedArray
Loading required package: matrixStats

Attaching package: 'matrixStats'

The following objects are masked from 'package:Biobase':

    anyMissing, rowMedians


Attaching package: 'DelayedArray'

The following objects are masked from 'package:matrixStats':

    colMaxs, colMins, colRanges, rowMaxs, rowMins, rowRanges

The following object is masked from 'package:Biostrings':

    type

The following object is masked from 'package:base':

    apply

    s_1_sequence.txt       s_2_export.txt s_5_0001_realign.txt 
                1024                 1000                 1012 
           s_1_sequence.txt              s_2_export.txt 
                       1024                        1000 
       s_5_0001_realign.txt            s_1_0001_prb.txt 
                       1012                         256 
           s_1_0001_seq.txt         s_1_1_0001_qseq.txt 
                        256                         256 
           s_1_0001_int.txt            s_1_0001_nse.txt 
                        256                         256 
ERR127302_1_subset.fastq.gz ERR127302_2_subset.fastq.gz 
                      80000                       80000 
     s_1_aligned_bowtie.txt               out.aln.1.txt 
                       1000                        1000 
              out.aln.2.txt 
                       1000 
    /usr/lib/R/site-library/ShortRead/extdata/Data/C1-36Firecrest/Bustard/GERALD/s_1_sequence.txt 
                                                                                             1024 
      /usr/lib/R/site-library/ShortRead/extdata/Data/C1-36Firecrest/Bustard/GERALD/s_2_export.txt 
                                                                                             1000 
/usr/lib/R/site-library/ShortRead/extdata/Data/C1-36Firecrest/Bustard/GERALD/s_5_0001_realign.txt 
                                                                                             1012 
           /usr/lib/R/site-library/ShortRead/extdata/Data/C1-36Firecrest/Bustard/s_1_0001_prb.txt 
                                                                                              256 
           /usr/lib/R/site-library/ShortRead/extdata/Data/C1-36Firecrest/Bustard/s_1_0001_seq.txt 
                                                                                              256 
        /usr/lib/R/site-library/ShortRead/extdata/Data/C1-36Firecrest/Bustard/s_1_1_0001_qseq.txt 
                                                                                              256 
                   /usr/lib/R/site-library/ShortRead/extdata/Data/C1-36Firecrest/s_1_0001_int.txt 
                                                                                              256 
                   /usr/lib/R/site-library/ShortRead/extdata/Data/C1-36Firecrest/s_1_0001_nse.txt 
                                                                                              256 
                /usr/lib/R/site-library/ShortRead/extdata/E-MTAB-1147/ERR127302_1_subset.fastq.gz 
                                                                                            80000 
                /usr/lib/R/site-library/ShortRead/extdata/E-MTAB-1147/ERR127302_2_subset.fastq.gz 
                                                                                            80000 
                          /usr/lib/R/site-library/ShortRead/extdata/bowtie/s_1_aligned_bowtie.txt 
                                                                                             1000 
                                      /usr/lib/R/site-library/ShortRead/extdata/maq/out.aln.1.txt 
                                                                                             1000 
                                      /usr/lib/R/site-library/ShortRead/extdata/maq/out.aln.2.txt 
                                                                                             1000 

ShortRead documentation built on Nov. 8, 2020, 8:02 p.m.