def addStartTag(in_path, out_path): FH_in = FastaIO(in_path) FH_out = FastaIO(out_path, "w") for record in FH_in: record.string = "^" + record.string FH_out.write(record) FH_in.close() FH_out.close()
def getSeqByChr(genome_path): """ Return by chromosome name the sequence of this chromosome. :param genome_path: Path to the genome file (format: fasta). :type genome_path: str :return: By chromosome name the sequence of this chromosome in uppercase. :rtype: dict """ genome_by_chr = dict() FH_seq = FastaIO(genome_path) for record in FH_seq: genome_by_chr[record.id] = record.string.upper() FH_seq.close() return genome_by_chr
help= 'Path to the definition of the amplicons (format: Illumina manifest).') group_output = parser.add_argument_group('Outputs') # Outputs group_output.add_argument( '-f', '--fwd-barcodes', default="fwd_barcodes.fasta", help= '******************************** (format: fasta). [Default: %(default)s]' ) group_output.add_argument( '-r', '--rvs-barcodes', default="rvs_barcodes.fasta", help= '******************************** (format: fasta). [Default: %(default)s]' ) args = parser.parse_args() # Process amplicons = getAmplicons(args.input_manifest) FH_fwd = FastaIO(args.fwd_barcodes, "w") FH_rvs = FastaIO(args.rvs_barcodes, "w") for ampl in amplicons: record_fwd = Sequence(ampl.name, ampl.up_primer) FH_fwd.write(record_fwd) record_rvs = Sequence(ampl.name, revcom(ampl.down_primer)) FH_rvs.write(record_rvs) FH_fwd.close() FH_rvs.close()