Issue_4
Adding the code for Issue_4 as well as the nextflow workflow
Merge request reports
Activity
Please fix the linter issues (see CI log or just run
flake8
locally in your checked out feature branch). Use Google to find out more about what the linter complains about. E.g., forsrc/PrimingProb.py:63:17: E741 ambiguous variable name 'l'
, googlingE741 ambiguous variable name
will bring you here: https://www.flake8rules.com/rules/E741.htmlPlease proceed in a similar way to make sure the entire CI pipeline passes, then please assign me to review. If you have any specific questions, please ask them during the session or on the forum on ADAM.
Edited by Alex Kanitzadded 2 commits
- src/RIblast_process3.nf 0 → 100644
1 #!/usr/bin/env nextflow changed this line in version 13 of the diff
- src/PrimingProb_Final.py 0 → 100644
1 """Imports.""" changed this line in version 8 of the diff
- src/PrimingProb_Final.py 0 → 100644
1 """Imports.""" changed this line in version 8 of the diff
- src/PrimingProb_Final.py 0 → 100644
1 """Imports.""" 2 import numpy as np Check this comment about ordering imports: !13 (comment 24993)
changed this line in version 8 of the diff
- src/PrimingProb_Final.py 0 → 100644
1 """Imports.""" 2 import numpy as np 3 import scipy.constants 4 import argparse 5 from pathlib import Path 6 7 8 class Probability: The way this is implemented, there is no advantage of using a class here over just regular functions. As far as I can see no data is passed between methods. Also, application-level code is interspersed with methods, this is not good practice. I think it's best to refactor in a way that you just use functions and no class.
changed this line in version 8 of the diff
- src/PrimingProb_Final.py 0 → 100644
1 """Imports.""" 2 import numpy as np 3 import scipy.constants 4 import argparse 5 from pathlib import Path 6 7 8 class Probability: 9 """Calculates the probability of priming and write the gff file.""" 10 11 # adding parser Best is to put the application-level ("main" code) together with the CLI stuff in another module. To avoid conflicts with other people's work, I would put this in a subpackage, e.g.,
src/priming_prob
, then put modulespriming_prob.py
andcli.py
in there. In the latter you would put all the CLI parser andmain()
code. In the former, you put just theInterPara()
andInterProb()
functions (but name theminter_para()
andinter_prob()
rather.changed this line in version 8 of the diff
requested review from @zavolan
This needs some refactoring as well as unit tests and a test run of the pipeline in the CI. There may also be additional functional comments from @zavolan.
mentioned in merge request !17 (closed)
mentioned in merge request !22 (closed)
mentioned in merge request !23 (closed)
- src/PrimingProb_Final.py 0 → 100644
145 del prob_list2[0:counter_list[jj]] # Normalized probabilities 146 147 # real_prob contains all the linearized probabilities 148 149 for vv in range(0, len(para_list)): 150 para_list[vv][1] = real_prob[vv] 151 152 final_list = [] 153 154 for bb in range(0, len(sum_list)): # Insert ID in paralist 155 for ss in range(0, counter_list[bb]): 156 para_list[ss][0] = mycounter_list[bb] 157 final_list.append(para_list[ss]) 158 del para_list[0:counter_list[bb]] 159 160 gff = open("../inputs/Potential_Priming_sites.txt", "w+") # gff file changed this line in version 8 of the diff
- src/PrimingProb_Final.py 0 → 100644
48 49 return(mylist) 50 51 data = InterPara(args.input_file) 52 53 def InterProb(data_list): 54 """Calculate the prob. and make the gff file. 55 56 Args: 57 data_list (list): Contains all parameters of RIblast 58 59 Returns: 60 gff (file): Gff file contains all the output information 61 """ 62 # count interactions per script through fasta ID (first line of fasta) 63 mycounter = open("../inputs/transcript.fasta", "r") changed this line in version 8 of the diff
- src/PrimingProb_Final.py 0 → 100644
52 53 def InterProb(data_list): 54 """Calculate the prob. and make the gff file. 55 56 Args: 57 data_list (list): Contains all parameters of RIblast 58 59 Returns: 60 gff (file): Gff file contains all the output information 61 """ 62 # count interactions per script through fasta ID (first line of fasta) 63 mycounter = open("../inputs/transcript.fasta", "r") 64 65 mycounter_list = [] 66 67 for mylinecounter in mycounter: changed this line in version 8 of the diff
- src/PrimingProb_Final.py 0 → 100644
64 65 mycounter_list = [] 66 67 for mylinecounter in mycounter: 68 if mylinecounter.startswith(">"): 69 a = mylinecounter 70 a = mylinecounter.replace(">", "") 71 b = a.replace("\n", "") 72 mycounter_list.append(b) 73 else: 74 continue 75 76 counter = 0 77 counter_list = [] 78 79 for cc in range(0, len(mycounter_list)): changed this line in version 8 of the diff
- src/PrimingProb_Final.py 0 → 100644
81 if mycounter_list[cc] in data_list[dd]: 82 counter = counter + 1 83 else: 84 continue 85 counter_list.append(counter) 86 counter = 0 87 88 para_list = [] 89 90 for i in range(0, len(data_list)): 91 x = data_list[i].split(",") 92 para_list.append(x) 93 # splitting each list item by the "," this results in a 2-D list 94 95 for j in range(0, len(para_list)): 96 del para_list[j][1:-2] changed this line in version 8 of the diff