In [5]:
import os
os.chdir('../')
print(os.getcwd())
import pandas as pd
import numpy as np


/ifs/projects/adam/pipeline_tests/data/test1/test_chiptools.dir

In [2]:
import matplotlib.pyplot as plt
import matplotlib.lines as mlines
from matplotlib.colors import ListedColormap
from matplotlib import cm

In [14]:
def plotGCContent(TagDir):
    TagGC = "tagGCcontent.txt"
    GenomeGC = "genomeGCcontent.txt"
    TagGC = "homer/Tag.dir/" + TagDir + "/" + TagGC 
    GenomeGC = "homer/Tag.dir/" + TagDir + "/" + GenomeGC
    
    data = pd.read_csv(TagGC, sep="\t")
    data2 = pd.read_csv(GenomeGC, sep="\t")
    x = data.columns[0]
    y = np.array([data.columns[2], data2.columns[2]])

    data.plot(x,y)
    plt.xlabel("GC-content of fragments")
    plt.ylabel("Normalized Fraction")
    plt.title("Fragment GC% Distribution")
    plt.show()

In [15]:
names = set()

design = pd.read_table('design.tsv')
samples = design.bamReads.values
for sample in samples:
    #print(sample.strip(".bam"))
    names.add(sample.strip(".bam"))

for (dirpath, dirnames, filenames) in os.walk(os.getcwd()):
    for dirname in dirnames:
        if dirname in names:
            plotGCContent(dirname)