PriceLab / chip-seq-motif-study

to determine the how TF motifs do and do not match ChIP-seq assays
0 stars 0 forks source link

sliceBamFile function #9

Closed mariam16548 closed 1 year ago

mariam16548 commented 4 years ago

I've put the function into the ctcf folder (sliceBamFunction.R).

mariam16548 commented 4 years ago

@paul-shannon

paul-shannon commented 4 years ago

@mariam16548 I am creating a new file sliceBamFile.R based on your function. It will have all of my suggestions, some of which are substantial, some just stylistic. Your code is headed in the right direction!

paul-shannon commented 4 years ago

@mariam16548 see ~/github/chip-seq-motif-study/explore/ctcf/sliceBamFile.R Note that this can be run and tested from the shell:

bash> R -f sliceBamFile.R
--- test_sliceBamFile
[1] TRUE

Lots of stylistic and substantial modifications here. Please absorb them!

paul-shannon commented 4 years ago

@mariam16548 Next task: I suggest a more friendly signature of sliceBamFile:

sliceBamFile <- function(bamFile,  newBamFileName, chrom, start=NA, end=NA)

If you call this function without a start and end, it implies "give me the whole chromosome". In that case, start <-1, and end can be looked up this way:

library(org.Hs.eg.db)
org.Hs.egCHRLENGTHS[[19]]    #  80373285

This is friendly in that it saves the caller the task of looking up the end of the chromosome of interest in those cases where we want an entire chromosome from the bam file.

mariam16548 commented 4 years ago

@paul-shannon I've made these requested changes and put them in sliceBamFunction.R. I will continue to look through your suggestions to make sure I understand them!

paul-shannon commented 4 years ago

@mariam16548 - good work! Two stylistic suggestions:

mariam16548 commented 4 years ago

Thank you for the feedback (I went back in and applied the suggestions)! -Mariam

On Mon, Aug 26, 2019 at 10:41 AM Paul Shannon notifications@github.com wrote:

@mariam16548 https://github.com/mariam16548 - good work! Two stylistic suggestions:

  • sliceBamFile.R is a better (more descriptive) name that sliceBamFunction.R in part because Function adds nothing to our understanding: most of the code your write will be functions!!
  • stylistic debates rage, but I prefer to see the terminating curly brace "}" indented the same as the code block it closes.
  • also, if your code block has only one line, I prefer omitting the curly brackets: you save a line, you save visual clutter, your code text becomes more expressive

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/PriceLab/chip-seq-motif-study/issues/9?email_source=notifications&email_token=AMNCZQTQWYKKJQ366JFRLN3QGQITHA5CNFSM4IPB5P72YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5FC7SQ#issuecomment-524955594, or mute the thread https://github.com/notifications/unsubscribe-auth/AMNCZQUHIEJESHO2W2YV3J3QGQITHANCNFSM4IPB5P7Q .