features = record.features for feature in features: if feature.type == "rRNA": if "16S" in feature.qualifiers["product"][0]: fasta = extract16sFasta(organismID, feature, record) if 1000 < len(fasta) < 2000: # Removes partial sequences and really large sequence do to genbank. FASTAS.append(fasta) return FASTAS # =========================================================================================================== # Main program code: # House keeping... argsCheck(3) # Checks if the number of arguments are correct. entrezEmail(sys.argv[2]) # Sets up arguments email require for genbank file extraction. # Stores file one for input checking. print() ">> Opening sequence list..." inFile = sys.argv[1] # File extension check if not inFile.endswith(".txt"): print("[Warning] " + inFile + " may not be a txt file!") # Reads sequence file list and stores it as a string object. Safely closes file.try: try: with open(inFile, "r") as newFile: sequences = newFile.read() newFile.close()
"Entrez User Requirements. If the NCBI finds you are abusing their systems, they can" ) print( "and will ban your access! Use the optional email parameter so the NCBI can contact" ) print("you if there is a problem.") sys.exit( 1) # Aborts program. (exit(1) indicates that an error occurred) # =========================================================================================================== # Main program code: # House keeping... argsCheck(3) # Checks if the number of arguments are correct. entrezEmail(sys.argv[2] ) # Sets up arguments email require for genbank file extraction. # Stores file one for input checking. print(">> Opening sequence list...") inFile = sys.argv[1] # File extension check if not inFile.endswith(".txt"): print("[Warning] " + inFile + " may not be a txt file!") # Reads sequence file list and stores it as a string object. Safely closes file: try: with open(inFile, "r") as newFile: sequences = newFile.read() newFile.close() except IOError: