biopython - trimming sequences from both ends of a fasta file -


I have a fasta file which looks like (original_reads.fasta)

read_identifier : abcdefgh AAGTGTAAAGCCTGGGGTGCCTAATGATCGATCGATCAGGTGTGTGAGTGTGTGTGTGTGTGTGTGAATGGGAGTCCTGCAGCGCACTGTGCCCGACTGAAATTCCGTATCAGAATCTGTTGACTTTCTCCCAGATCGATCGATCAAAAAGGATCTCAAGAAGATCC

My Library sequence 37 bp (which begins after an adapter sequence) and Long 96 BPA. After that the remaining 34 base pairs is another adapter sequence. I want to trim 37 bp adapter and 34 bp adapter. The code I tried did not work because the whole sequence is to be sorted in the second round. I used bilateral experiment. Here is my code: Suggest a solution

  def trim_adaptors (record, adapter):. List or iterator "" "The correct adapter trims, it should be a generator function, record logic. Return to the #cache SeqRecord objects for later record in record" "" len_adaptor = Lane (adapter):. Index = record.seq.find (adapter) if index == -1: #adaptor is not found, then the trim editor will not record: #trimim off adapter yield record [index + len_adaptor:] original_reads = SeqIO.parse (" Original_reads.fasta "," Fasta ") trimmed_reads1 = trim_adaptors (original_brides," AAGTGTAAGCCTGGGTGCCTAAATGCTGATC ") count = CQO Trimmed_reads2 = trim_adaptors (trimmed_reads1, "GATCGATCGATCAAAAAGGATCTCAAGAAGATCC"), "trimmed1.fasta", "fasta") print ("save% i read" count) Seqio.write (trimmed_reads2, "trim med.fasta", "fasta") print ("save% i read"% counts)  

To create another trim_adaptors and modify the last line to record Yeload [: index]


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -