Based on two alignment metrics, this function guesses the samples are paired end or not.

is_paired_end(
  x,
  avg_mapped_read_length = "recount_qc.star.average_mapped_length",
  avg_read_length = "recount_seq_qc.avg_len"
)

Arguments

x

Either a RangedSummarizedExperiment-class created by create_rse() or the sample metadata created by read_metadata().

avg_mapped_read_length

A character(1) specifying the metdata column name that contains the average fragment length after aligning. This is typically twice the average read length for paired-end reads.

avg_read_length

A character(1) specifying the metadata column name that contains the average read length prior to aligning.

Value

A logical() vector specifying whether each sample was likely paired-end or not.

See also

Other count transformation functions: compute_read_counts(), compute_scale_factors(), transform_counts()

Examples


## Download the metadata for SRP009615, a single-end study
SRP009615_meta <- read_metadata(
    metadata_files = file_retrieve(
        locate_url(
            "SRP009615",
            "data_sources/sra",
        )
    )
)
#> 2024-12-10 22:01:38.898621 caching file sra.sra.SRP009615.MD.gz.
#> 2024-12-10 22:01:39.363913 caching file sra.recount_project.SRP009615.MD.gz.
#> 2024-12-10 22:01:39.959124 caching file sra.recount_qc.SRP009615.MD.gz.
#> 2024-12-10 22:01:40.346302 caching file sra.recount_seq_qc.SRP009615.MD.gz.
#> 2024-12-10 22:01:40.79932 caching file sra.recount_pred.SRP009615.MD.gz.

## Are the samples paired end?
is_paired_end(SRP009615_meta)
#> SRR387777 SRR387778 SRR387779 SRR387780 SRR389079 SRR389080 SRR389081 SRR389082 
#>     FALSE     FALSE     FALSE     FALSE     FALSE     FALSE     FALSE     FALSE 
#> SRR389083 SRR389084 SRR389077 SRR389078 
#>     FALSE     FALSE     FALSE     FALSE 

## Download the metadata for DRP000499, a paired-end study
DRP000499_meta <- read_metadata(
    metadata_files = file_retrieve(
        locate_url(
            "DRP000499",
            "data_sources/sra",
        )
    )
)
#> 2024-12-10 22:01:41.233278 caching file sra.sra.DRP000499.MD.gz.
#> 2024-12-10 22:01:41.64884 caching file sra.recount_project.DRP000499.MD.gz.
#> 2024-12-10 22:01:42.106257 caching file sra.recount_qc.DRP000499.MD.gz.
#> 2024-12-10 22:01:42.540452 caching file sra.recount_seq_qc.DRP000499.MD.gz.
#> 2024-12-10 22:01:42.988749 caching file sra.recount_pred.DRP000499.MD.gz.
is_paired_end(DRP000499_meta)
#> Warning: is_paired_end(): Looks like some samples failed to align and will return NA.
#> DRR001622 DRR001623 DRR001624 DRR001625 DRR001626 DRR001627 DRR001628 DRR001629 
#>      TRUE      TRUE      TRUE        NA      TRUE      TRUE      TRUE      TRUE 
#> DRR001630 DRR001631 DRR001632 DRR001633 DRR001634 DRR001635 DRR001636 DRR001637 
#>      TRUE      TRUE      TRUE      TRUE      TRUE      TRUE      TRUE      TRUE 
#> DRR001638 DRR001639 DRR001640 DRR001641 DRR001642 
#>      TRUE      TRUE      TRUE      TRUE      TRUE