from keras.layers import Conv2D from keras.layers import AveragePooling2D from janggu import inputlayer from janggu import outputconv from janggu import DnaConv2D from janggu.data import ReduceDim # load the dataset which consists of # 1) a reference genome REFGENOME = resource_filename('janggu', 'resources/pseudo_genome.fa') # 2) ROI contains regions spanning positive and negative examples ROI_FILE = resource_filename('janggu', 'resources/roi_train.bed') # 3) PEAK_FILE only contains positive examples PEAK_FILE = resource_filename('janggu', 'resources/scores.bed') # DNA sequences are loaded directly from the reference genome DNA = Bioseq.create_from_refgenome('dna', refgenome=REFGENOME, roi=ROI_FILE, binsize=200) # Classification labels over the same regions are loaded into the Coverage dataset. It is important that both DNA and LABELS load with the same binsize, stepsize to ensure the correct correspondence between both datasets. Finally, the ReduceDim dataset wrapper transforms the 4D Coverage object into a 2D table like object (regions by conditions) LABELS = ReduceDim(Cover.create_from_bed('peaks', roi=ROI_FILE,bedfiles=PEAK_FILE,binsize=200,resolution=None), aggregator='mean') # 2. define a simple conv net with 30 filters of length 15 bp and relu activation. outputconv as opposed to outputdense will put a conv layer as output @inputlayer @outputdense('sigmoid') def double_stranded_model(inputs, inp, oup, params): with inputs.use('dna') as layer: # The DnaConv2D wrapper can be used with Conv2D # to scan both DNA strands with the weight matrices. layer = DnaConv2D(Conv2D(params, (params, 1), activation=params))(layer) output = GlobalAveragePooling2D(name='motif')(layer) return inputs, output # 3. instantiate and compile the model model = Janggu.create(template=double_stranded_model, modelparams=(30, 15, 'relu'), inputs=DNA, outputs=LABELS) model.compile(optimizer='adadelta', loss='binary_crossentropy', metrics=['acc']) # 4. fit the model model.fit(DNA, ReduceDim(LABELS, epochs=100))
I am using google collab. Please tell me how to add bedtools path in google collab. I have already read the documentation cannot make anything out of it. I am trying to solve this issue for one week. Thank You.