trichelab / spiky

2 stars 5 forks source link

methylation_specificity generates NaN/NA #26

Open prisnir-zz opened 3 years ago

prisnir-zz commented 3 years ago

Hi, I am working with the following commands:

res <- scan_spiked_bam(sb, bins=GRanges())

This works fine for me:

GRangesList object of length 2:
$genomic
GRanges object with 0 ranges and 1 metadata column:
   seqnames    ranges strand |  coverage
      <Rle> <IRanges>  <Rle> | <numeric>
  -------
  seqinfo: 52 sequences from spike genome

$spikes
GRanges object with 52 ranges and 1 metadata column:
                             seqnames    ranges strand |  coverage
                                <Rle> <IRanges>  <Rle> | <numeric>
   80b_1C_35G-1          80b_1C_35G-1      1-80      * |         2
   80b_1C_35G-2 80b_1C_35G-2_mod_meth      1-80      * |        16
   80b_1C_50G-1          80b_1C_50G-1      1-80      * |         6
   80b_1C_50G-2 80b_1C_50G-2_mod_meth      1-80      * |       496
   80b_1C_65G-1          80b_1C_65G-1      1-80      * |        16
            ...                   ...       ...    ... .       ...
  320b_8C_35G-2         320b_8C_35G-2     1-320      * |         0
  320b_8C_50G-1         320b_8C_50G-1     1-320      * |         3
  320b_8C_50G-2    320b_8C_50G-2_meth     1-320      * |      1514
  320b_8C_65G-1    320b_8C_65G-1_meth     1-320      * |       407
  320b_8C_65G-2         320b_8C_65G-2     1-320      * |         3
  -------
  seqinfo: 52 sequences from spike genome

Next, when I run the following: methylation_specificity(res) I get NaNs

$mean
[1] NaN
$median
[1] NA

For the same bam file; scan_methylation_specificity works just right.

ttriche commented 3 years ago

This is odd -- using the current codebase and the examples as written,

library(GenomicRanges)
sb <- system.file("extdata", "example.spike.bam", package="spiky", mustWork=TRUE)
res <- scan_spiked_bam(sb, bins=GRanges())

I get

methylation_specificity(res)
# $mean
# [1] 0.979735175
#
# $median
# [1] 0.997228632

and

scan_methylation_specificity(sb, spike=spike)
#                      mean      median
# example.spike 0.979913763 0.995485836

Granted this is with a recent push, but neither of the above functions are among the changes:

packageVersion("spiky")
# [1] '0.99.37'
R.version
#               _
# platform       x86_64-pc-linux-gnu
# arch           x86_64
# os             linux-gnu
# system         x86_64, linux-gnu
# status
# major          4
# minor          0.0
# year           2020
# month          04
# day            24
# svn rev        78286
# language       R
# version.string R version 4.0.0 (2020-04-24)
# nickname       Arbor Day

Can you post your sessionInfo() or any other information that may reveal the source of the issue?

Timothy J. Triche, Jr., PhD Assistant Professor of Bioinformatics, Van Andel Institute 330 Bostwick Avenue NE, Grand Rapids, MI, 49503 (616) 234-5316 (office) (626) 375-9663 (mobile) (616) 234-5252 (administrative, courtesy of Lauren Dunkelberg) https://trichelab.vai.org/


From: Prisni R @.***> Sent: Monday, April 5, 2021 5:17 PM To: trichelab/spiky Cc: Subscribed Subject: [External] [trichelab/spiky] methylation_specificity generates NaN/NA (#26)

Hi, I am working with the following commands: res <- scan_spiked_bam(sb, bins=GRanges()) works fine `GRangesList object of length 2: $genomic GRanges object with 0 ranges and 1 metadata column: seqnames ranges strand coverage

seqinfo: 52 sequences from spike genome

$spikes GRanges object with 52 ranges and 1 metadata column: seqnames ranges strand coverage
80b_1C_35G-1 80b_1C_35G-1 1-80 * 2
80b_1C_35G-2 80b_1C_35G-2_mod_meth 1-80 * 16
80b_1C_50G-1 80b_1C_50G-1 1-80 * 6
80b_1C_50G-2 80b_1C_50G-2_mod_meth 1-80 * 496
80b_1C_65G-1 80b_1C_65G-1 1-80 * 16

... ... ... ... . ... 320b_8C_35G-2 320b_8C_35G-2 1-320 | 0 320b_8C_50G-1 320b_8C_50G-1 1-320 | 3 320b_8C_50G-2 320b_8C_50G-2_meth 1-320 | 1514 320b_8C_65G-1 320b_8C_65G-1_meth 1-320 | 407 320b_8C_65G-2 320b_8C_65G-2 1-320 * | 3

seqinfo: 52 sequences from spike genome`

Next, when I run the following: methylation_specificity(res) I get NaNs

$mean [1] NaN $median [1] NA

For the same bam file; scan_methylation_specificity works just right.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/trichelab/spiky/issues/26, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAABCIUZQ6V5N3G3K3A3K33THISIBANCNFSM42NPDZ2Q.

CAUTION: This email was sent from outside of the organization @.). Do not click links or open attachments unless you recognize the sender and know the content is safe. If you have any questions, please contact @*.**@*.***>.