GithubHelp home page GithubHelp logo

automated-enhancer-gene-scrambler's People

Contributors

kmace avatar ronnie-crawford avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

kmace

automated-enhancer-gene-scrambler's Issues

Include elif condition

You need an elif condition on the apply_hard_filter() , saying elif minimax == "min" , and then the else should be reserved for anything else, and should raise an error accordingly. You can imagine a situation in which neither min nor max gets passed as an argument, and the data gets erroneously manipulated by your else condition. This may not announce itself as an error until much later on - or it may not even announce itself at all. Which is of course bad, and needs accounting for.

Simplify code

kernel = get_kernel(di.ENHANCER_KERNEL_SHAPE, int((di.RELATIVE_ENHANCER_KERNEL_SIZE * (gene["Search_window_end"] - gene["Search_window_start"]))), int(di.RELATIVE_ENHANCER_KERNEL_SIGMA * (gene["Search_window_end"] - gene["Search_window_start"])))

This line is too convoluted, it should be broken down into separate distinct steps

Rename true/false conditions

if di.INTERFERRING_GENE_OVERLAPS == False:

(This is a super pedantic point, I learnt it myself 5 mins ago, but) the best (i.e. fastest/safest/most robust) way of checking if x is true or false is by writing if x and if not x, respectively. So, in your case, this should be rewritten to if not di.INTERFERRING_GENE_OVERLAPS, and all other instances of not evaluating true/false conditions in this way should be replaced.

Source: https://docs.python.org/2/library/stdtypes.html#truth-value-testing
Source: https://stackoverflow.com/questions/37103705/what-is-the-correct-way-to-check-for-false

Remove all comments

#plateau_regions.to_csv((di.RESULTS_DIRECTORY + "plateaus_test.bed"), sep = "\t", index = False, columns = ["Chromosome", "Start", "End", "Gene_name", "Strand", "Sequence"], mode = "a")

Github tracks everything, so by leaving stuff commented on the unlikely chance that you may want to come back to it, you are just cluttering the program a bit unnecessarily.

Rename 'pr' Variables

interferring_genes_pr = pr.PyRanges(gene_data.loc[gene_data["Specific_gene_expression"] > di.CELL_LINE_SPECIFIC_EXPRESSION_THRESHOLD])

Not sure what 'pr' means in the variable names?

For example, you know what pyranges does and what it returns, so line 67 genes_pr = pr.PyRanges(gene_data) makes sense to you. But it does not to me; if the variable(s) was named differently it should hopefully make more sense!

Rename ENHANCER_CONVOLUTION constant

for index, gene in genes_search.head(di.ENHANCER_CONVOLUTION).iterrows():

Not sure if I am reading this right? You would like to iterate though the dataframe, a set number of times, so you use head() to count from the top of the dataframe, and you use ENHANCER_CONVOLUTION to define how many rows from the top you would like to include? If so, then you should rename ENHANCER_CONVOLUTION to something else - as this name does not signify what it is being used for.

Re-order functions

Functions should flow chronologically: in the order that they are called within the program. In this way, the user should be able to read the code from top to bottom, smoothly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.