plotting_scripts/plot_GC_content_by_DE.py
def compute_all_GCs(fasta):
    """ For each fasta transcript:
          1) Extract gene name
          2) Compute GC content of sequence
          3) Record gene name, transcript ID, and GC content in pandas df.
    """
    gene_names = []
    transcript_IDs = []
    GC_content = []

    try:
        with gzip.open(fasta, "rt") as handle:
            for record in SeqIO.parse(handle, "fasta"):
                split_ID = (record.id).split("|")
                gene_name = split_ID[5]
                transcript_ID = split_ID[0]

                gene_names.append(gene_name)
                transcript_IDs.append(transcript_ID)
                GC_content.append(GC(record.seq))
               
    except Exception as e:
        print(e)
        sys.exit("Problem reading fasta sequence file. Expecting gzipped file")

    # Convert lists into a pandas data frame
    df = pd.DataFrame({"gene": gene_names, 
                       "transcript_ID": transcript_IDs, 
                       "GC": GC_content})
  
    return df
 For each fasta transcript:
          1) Extract gene name
          2) Compute GC content of sequence
          3) Record gene name, transcript ID, and GC content in pandas df.
    
For each fasta transcript:
1) Extract gene name
2) Compute GC content of sequence
3) Record gene name, transcript ID, and GC content in pandas df.
For each fasta transcript : 1 ) Extract gene name 2 ) Compute GC content of sequence 3 ) Record gene name transcript ID and GC content in pandas df .
def compute_all_GCs(fasta):
    gene_names = []
    transcript_IDs = []
    GC_content = []
    try:
        with gzip.open(fasta, "rt") as handle:
            for record in SeqIO.parse(handle, "fasta"):
                split_ID = (record.id).split("|")
                gene_name = split_ID[5]
                transcript_ID = split_ID[0]
                gene_names.append(gene_name)
                transcript_IDs.append(transcript_ID)
                GC_content.append(GC(record.seq))
    except Exception as e:
        print(e)
        sys.exit("Problem reading fasta sequence file. Expecting gzipped file")
    df = pd.DataFrame({"gene": gene_names, 
                       "transcript_ID": transcript_IDs, 
                       "GC": GC_content})
    return df
def compute_all_GCs ( fasta ) : gene_names = [ ] transcript_IDs = [ ] GC_content = [ ] try : with gzip . open ( fasta , "rt" ) as handle : for record in SeqIO . parse ( handle , "fasta" ) : split_ID = ( record . id ) . split ( "|" ) gene_name = split_ID [ 5 ] transcript_ID = split_ID [ 0 ] gene_names . append ( gene_name ) transcript_IDs . append ( transcript_ID ) GC_content . append ( GC ( record . seq ) ) except Exception as e : print ( e ) sys . exit ( "Problem reading fasta sequence file. Expecting gzipped file" ) df = pd . DataFrame ( { "gene" : gene_names , "transcript_ID" : transcript_IDs , "GC" : GC_content } ) return df
For each fasta transcript:
1) Extract gene name
2) Compute GC content of sequence
3) Record gene name, transcript ID, and GC content in pandas df.
For each fasta transcript : 1 ) Extract gene name 2 ) Compute GC content of sequence 3 ) Record gene name transcript ID and GC content in pandas df .
""" For each fasta transcript:
          1) Extract gene name
          2) Compute GC content of sequence
          3) Record gene name, transcript ID, and GC content in pandas df.
    """ # Convert lists into a pandas data frame
fasta