In the documentation of overlap, this is how the strandedness argument is defined:
strandedness ({None, "same", "opposite", False}, default None, i.e. auto) – Whether to compare PyRanges on the same strand, the opposite or ignore strand information. The default, None, means use “same” if both PyRanges are strande, otherwise ignore the strand information.
However, it seems that the default behavior is not strandedness='same'. I may be misunderstanding the docs, but that wasn't what I expected. This may be related to #356.
Example data: The two GTF files contain the following ranges:
test_1_gtf.txt
test_2_gtf.txt
chr1 unknown transcript 1 25 . + . gene_id "gene1"; transcript_id "transcript_1";
chr1 unknown transcript 1 25 . - . gene_id "gene1"; transcript_id "transcript_1";
x = pr.read_gtf('text_1_gtf.txt')
y = pr.read_gtf('text_2_gtf.txt')
Chromosome Source Feature Start End Score Strand Frame gene_id transcript_id
0 chr1 unknown transcript 0 25 . + . gene1 transcript_1
x.overlap(y,strandedness='opposite')
Chromosome Source Feature Start End Score Strand Frame gene_id transcript_id
0 chr1 unknown transcript 0 25 . + . gene1 transcript_1
x.overlap(y,strandedness='same')
pyranges version info:
{'pyranges version': '0.0.120', 'pandas version': '1.5.2', 'numpy version': '1.23.0', 'python version': sys.version_info(major=3, minor=9, micro=18, releaselevel='final', serial=0), 'ncls': '0.0.65', 'sorted_nearest': '0.0.37', 'pyrle': '0.0.35', 'ray': 'not installed', 'bamread': 'not installed', 'pyranges_db': 'not installed', 'pybigwig': 'not installed', 'hypothesis': 'not installed'}
In the documentation of overlap, this is how the
strandednessargument is defined:However, it seems that the default behavior is not
strandedness='same'. I may be misunderstanding the docs, but that wasn't what I expected. This may be related to #356.Example data: The two GTF files contain the following ranges:
test_1_gtf.txt
test_2_gtf.txt
pyranges version info: