Entering edit mode
14 months ago
Keith
•
0
Good afternoon
Currently I'm working on this bit of code for the purpose of input DNA code that's attempting to isolate a specific DNA based on it's location upstream and downstream. The issue I am having is with the following instructions:
"Add braces to the DNA sequence 100 bp upstream and downstream of the requested position."
This is what I have so far:
parser = argparse.ArgumentParser(description = "This takes in input_file")
parser.add_argument('-I','--Fasta_filename', help='the name of a fasta file', type=str)
parser.add_argument('-C','--Chromosome_of_interest', help='The chromosome we want to amplify', type=str)
parser.add_argument('-P','--Position_of_amplification', help='Position we want amplified', type=int)
args = parser.parse_args()
"""
Open the fasta file and read in the entirety of the sequence. You can use whatever data structure you prefer.
"""
F = Fasta(args.Fasta_filename)
"""
Identify the sequence 500 bp upstream and downstream of the requested position and store it as a string.
"""
req_pos = F[args.Chromosome_of_interest][args.Position_of_amplification-501:args.Position_of_amplification+501]
I am not sure how to implement
Why would you want to add braces to a sequence? Is the end goal just to print the sequence formatted that way, because adding non ATGC/IUPAC characters to a sequence is just data corruption.
Is this an assignment on string manipulation?
Yes it is. The file is entered as a string and the goal is to locate a primer and output that location.
Alternatively, you can use an argument in the input file to specify this
I was thinking of using process.run()
Why are you looking to run a process/subprocess when string manipulation of the sort you're looking for is easier in a programming environment?
I asked for help with an assignment which I clearly stated, stop asking irrelevant questions.
Your assignment says "add braces". It does not say "use python to spawn a shell process that adds braces". My question is about your approach, which is very much relevant. What is apparent is your poor attitude, which does not bode well for you on a volunteer driven forum.
I got a lot of help and figured it out. But now I am getting this error message:
This is my code: