INNER CODE UNIT · Python

read_plasmidfinder_report

StaPH-B/docker-builds · build-files/cbird-util/2.0/html_report.py:87

def read_plasmidfinder_report(plasmid_report):
    df = pd.read_csv(plasmid_report, sep = '\t')
    df2 = df.loc[:, ['Plasmid','Identity','Query / Template length','Accession number']].copy()
    df2 = df2.sort_values(by=['Identity','Plasmid'], ascending=False)
    df2 = df2.rename(columns={'Identity':'Identity(%)'})
    return df2 

def read_mash_report(mash_report):
    df = pd.read_csv(mash_report, sep = '\t', header=None)
    df.columns = ['Microorganism', 'Identity(%)']
    return df

def read_blast_report(blast_report):
    df = pd.read_csv(blast_report, sep = '\t')
    if not df.empty:
        df['Coverage(%)'] = df['length'] / df['qlen'] * 100
        df.drop(columns=['sseqid', 'mismatch','gapopen','qstart','qend','sstart','send','evalue','bitscore'], inplace=True)
        df.rename(columns={'qseqid':'Gene','pident':'Identity(%)','length':'Length'}, inplace=True)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…