pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

pastebin private pastebin - collaborative debugging tool What's a private pastebin?

Posted by P on Sat 8th Dec 14:13 (modification of post by view diff)
diff | download | new post

  1. # import sys module
  2. # user will have to run the script ... python3 my_script.py my_input.txt
  3. #import sys
  4. #input_filename = sys.argv[1]
  5. #print sys
  6.  
  7. #input_seq_file = input()
  8. input_filename = 'small_input_file.txt'
  9.  
  10. # creating a dict that will separate species name and dna
  11. seq = {}
  12. # for every line in the 'input_filename' that python will open
  13. for line in open(input_filename):
  14.         #print(line)
  15.         # to get the name remove new line and space
  16.         name = line.rstrip('\n').split(' ')[0]
  17.         # to get motif remove new line and space
  18.         dna = line.rstrip('\n').split(' ')[1]
  19.         # print name and motif one next to the other
  20.         print(name, dna)
  21.         # the name of the sequence should return the motif minus the new line
  22.         seq[name] = dna
  23.  
  24.  
  25. # ask the user for the primer length
  26. #primer_length = input('What is the the min and max primer length?')
  27.  
  28. primer_min = input('What is the the min primer length?')
  29. primer_max = input('What is the the max primer length?')
  30.  
  31.  
  32.  
  33. #primer_length (should be 2 numbers)
  34. #If the number is negative, >20 or <8, print error and loop asking to input again
  35. primer_length = 0, 0
  36. #if primer_length > 8
  37. #       store in list
  38. #else:
  39. #       print('Wrong primer length. Primers must be between 8-20bp long. Please try again') # loop through that - ask for primer length again
  40. #if primer_length < 20
  41. #       store in list
  42. #else:
  43. #       print('Wrong primer lenght. Primers must be between 8-20bp long. PLease try again') # loop through that - ask for primer length again
  44.  
  45.        
  46. # create overlapping segments - something wrong here - script ignores user input
  47. for n in range(primer_min,primer_max):
  48.         seqs = dna
  49.         last_pos = len(dna) - (n-1)
  50.         for pos in range(0,last_pos):
  51.                 #print(pos)
  52.                 print(dna[pos:pos+n])
  53.                
  54. # store in list of possible primers - call this primer_list
  55. primer_list = []
  56.  
  57. # find primer pairs
  58.         # can I use a function to find the pairs? i.e.
  59.         # def primer_pairs(input_filename):
  60.         #       if Fprimer(list1) = unique
  61.         #       if Rprimer(list2) = unique
  62.         #       and if len(Fprimer) s= len(Rprimer)
  63.         #              print in file
  64.         #       else:
  65.         #             report error
  66.        
  67. #output_file = open('unique_primers.txt', 'wt')   
  68. #primer_list = list(range(0, 5))
  69.  
  70. #print(primer_list)
  71. #for F_primer in primer_list:
  72. #       for R_primer in primer_list:
  73. #              print(F_primer, R_primer)
  74.                 # check which species they amplify - are they unique?
  75.                 # if they are unique AND they are within the primer length then:
  76.                         # write the primers to output_file

Submit a correction or amendment below. (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Use syntax highlighting

To highlight particular lines, prefix each line with @@


Remember my settings