Skip to content
Snippets Groups Projects

Issue_4

Closed Melvin Alappat requested to merge Issue_4 into main

Adding the code for Issue_4 as well as the nextflow workflow

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
1 #!/usr/bin/env nextflow
  • 1 """Imports."""
  • 1 """Imports."""
  • 1 """Imports."""
    2 import numpy as np
  • 1 """Imports."""
    2 import numpy as np
    3 import scipy.constants
    4 import argparse
    5 from pathlib import Path
    6
    7
    8 class Probability:
  • 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 modules priming_prob.py and cli.py in there. In the latter you would put all the CLI parser and main() code. In the former, you put just the InterPara() and InterProb() functions (but name them inter_para() and inter_prob() rather.

    • Melvin Alappat changed this line in version 8 of the diff

      changed this line in version 8 of the diff

    • Please register or sign in to reply
  • Alex Kanitz requested review from @zavolan

    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.

  • Alex Kanitz mentioned in merge request !17 (closed)

    mentioned in merge request !17 (closed)

  • Alex Kanitz mentioned in merge request !22 (closed)

    mentioned in merge request !22 (closed)

  • Alex Kanitz mentioned in merge request !23 (closed)

    mentioned in merge request !23 (closed)

  • 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
  • 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")
  • 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:
  • 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)):
  • 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]
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading