def check_required_arguments(ribo_file, transcriptome_fasta, transcript_name=None):
<EOL>try:<EOL><INDENT>is_bam_valid(ribo_file)<EOL><DEDENT>except ValueError:<EOL><INDENT>log.error('<STR_LIT>')<EOL>raise<EOL><DEDENT>if not bam_has_index(ribo_file):<EOL><INDENT>log.info('<STR_LIT>')<EOL>create_bam_index(ribo_file)<EOL>if not bam_has_index(ribo_file):<EOL><INDENT>msg = ('<STR_LIT>'<EOL>'<STR_LIT>')<EOL>log.error(msg)<EOL>raise BamFileError(msg)<EOL><DEDENT><DEDENT>fasta_valid = False<EOL>try:<EOL><INDENT>fasta_valid = is_fasta_valid(transcriptome_fasta)<EOL><DEDENT>except IOError:<EOL><INDENT>log.error('<STR_LIT>')<EOL>raise<EOL><DEDENT>if fasta_valid:<EOL><INDENT>if transcript_name:<EOL><INDENT>try:<EOL><INDENT>get_fasta_records(transcriptome_fasta, [transcript_name])<EOL><DEDENT>except IOError:<EOL><INDENT>log.error('<STR_LIT>'.format(transcript_name))<EOL>raise<EOL><DEDENT><DEDENT>else:<EOL><INDENT>transcript_name = get_first_transcript_name(transcriptome_fasta)<EOL><DEDENT>with pysam.AlignmentFile(ribo_file, '<STR_LIT:rb>') as bam_file:<EOL><INDENT>if transcript_name not in bam_file.references:<EOL><INDENT>msg = '<STR_LIT>'.format(transcript_name)<EOL>log.error(msg)<EOL>raise ArgumentError(msg)<EOL><DEDENT><DEDENT><DEDENT>
Check required arguments of both riboplot and ribocount.