Skip to content

Instantly share code, notes, and snippets.

View kashiff007's full-sized avatar
🏠
Working from home

Kashif Nawaz kashiff007

🏠
Working from home
View GitHub Profile
@kashiff007
kashiff007 / HeatMap.R
Created October 23, 2018 08:48
Heatmap in R with tree cutting method
HeatMap R
library(gplots)
library(RColorBrewer)
data <- data.frame(read.table("All",sep="\t",header=FALSE))
updown <- data[data$V19 == "protein_coding_gene" & data$V10 > 0 & data$V12 <= 0.05 & data$V16 < 0 & data$V18 <= 0.05,]; updown <- cbind.data.frame(updown$V1,updown$V5,updown$V7,updown$V9)
@kashiff007
kashiff007 / SNP_pipeline
Created October 23, 2018 08:45
SNP detection pipeline and plot frequency with R
bowtie map reads:
bowtie2 -x TAIR10_chr_all.fas -U All_Mutant_Reads/NGS_rawdata/2172_A_run347_ACTTGAAT_S36_L002_R1_001_f.fastq -S 2172_A_run347_ACTTGAAT_S36_L002_R1_001.sam
sam to sorted bam:
samtools view -u 2172_A_run347_ACTTGAAT_S36_L002_R1_001.sam | samtools sort -@ 4 -o 2172_A_run347_ACTTGAAT_S36_L002_R1_001.bam
Samtools and bcftools : bam to bcf to vcf "SNP and INDEL both":
samtools mpileup -go 2608_A_run410_ACACAGTG_S128_L008_R1_001.bcf -f TAIR10_chr_all.fas 2608_A_run410_ACACAGTG_S128_L008_R1_001.bam
For Indel
bcftools call -mO z -V snps -o W35_indel.vcf.gz W35.bcf
@kashiff007
kashiff007 / methylation_sequence_context.py
Last active August 27, 2020 20:11
Get CG, CHG and CHH context from fatsa file (BioPython)
#!/usr/bin/python
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from collections import defaultdict
from Bio.Alphabet import generic_dna
import sys
import re
@kashiff007
kashiff007 / DESeq_r_pipeline.R
Created August 12, 2018 15:09
DESeq Pipeline with read counts
library(DESeq2)
## Load read counts with replicates
CountTable <- as.data.frame(round(as.matrix(read.csv("replicate.read_counts", sep="\t", header=TRUE, row.names=1))))
##Comparisons combination
CA20_CA50 <- (CountTable[,c(1,2,3,4)])
CA20_CE20 <- (CountTable[,c(1,2,5,6)])
CA20_CE50 <- (CountTable[,c(1,2,7,8)])
CA20_TA20 <- (CountTable[,c(1,2,9,10)])
@kashiff007
kashiff007 / Rotational_to_Linear.py
Created July 26, 2018 10:04
Python: Convert Rotational to Linear Coordinates
#!/usr/bin/python
from __future__ import division
import numpy as np
from itertools import count, tee, islice
import math
#window_size = 100
#stride = 20
@kashiff007
kashiff007 / Split_day2hour.R
Last active July 26, 2018 10:06
R: Generate and plot hourly temperature data between two dates
library(Interpol.T)
date<-date.time(day.begin="01/04/2020", day.end="31/07/2020", date.format= "d/m/y") # generate Date hour
tempd <- read.table("result.txt", sep="\t", header=FALSE) #from python program CIBSE Algorithm
x <- data.frame(date$year ,date$month, date$day, date$hour, tempd$V2)
y <- data.frame(x$year,x$month, x$day)
@kashiff007
kashiff007 / netcdf_extraction.r
Last active July 26, 2018 11:09
R script for netcdf file data extraction (Coordinate with Temperature)
library(ncdf4)
library(chron)
library(lattice)
library(RColorBrewer)
ncin <- nc_open("Pr_CORDEX/EUROPE/pr_EUR-44_MPI-M-MPI-ESM-LR_rcp45_r1i1p1_MPI-CSC-REMO2009_v1_day_20060102-20101231.nc")
csvname <- "pr_EUR-44_MPI-M-MPI-ESM-LR_rcp45_r1i1p1_MPI-CSC-REMO2009_v1_day_20060102-20101231.txt"
@kashiff007
kashiff007 / fasta_summary.py
Last active August 27, 2020 20:09
Get all nucleotide's number and percentage from a fasta file with multiple sequences
#!/usr/bin/python
"""
run this with python2.7
python2.7 fasta_summary.py
Enter the fasta file:
your_fasta_file.fa
"""
@kashiff007
kashiff007 / statistical_diff_wig.py
Last active April 20, 2018 14:48
Compare two wig (bigwig) files for estimation of difference in each corresponding bin with pvalue
#!/usr/bin/python
import sys
import multiprocessing
import time
import threading
file = open("Heat_danpos_norm-Control_danpos_norm.positions.integrative.txt","r")
#file2 = open("diff/Heat_danpos_norm-Control_danpos_norm.pois_diff.wig","r")
fOut = open("filerted_diff_1.wig","w")
@kashiff007
kashiff007 / sliding_window.py
Created April 27, 2016 09:35
sliding window for a column and average for each bin
#!/usr/bin/python
import numpy as np
from itertools import count, tee, izip, islice
window_size = 100
stride = 20
fOut = open("result.txt", "w")
x = raw_input("Enter your file name: ")