sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
14fc6a88aeece9ff4f3347bdb949e30d00aed44d5191600994c8f8f0a9121596
SAS
6,477
256
%macro tabulate4cutoff( dsd, byids, target_var, target_cutoffs, step, dsdout, ge_or_le, draw_fig4passed_tot=0, /*draw scatter plot with its y-axis for the total number of samples passed the target_cutoffs; otherwise, it will draw the figure using the % of samples passed the target_cutoffs*/ sumary_fig_ht=1000...
e71c075b3be421a4472fcb7845b0233f58d691a0fdac77edb3689131b7605fe8
SAS
6,577
279
%macro deseq_normalization_slow( dsdin, read_vars, dsdout, readcutoff=3, cellcutoff=5 ); /*readcutoff and cellcutoff will be used to exclude genes NOT passing the filters: at least the number of cells expressing at least the number of reads*/ /* options compress=yes; */ *The length of the value of the macro variable R...
360bae3411a9a2331069195537dd91241e75faa4ca4f1b4c2f0c9f794fa8ab83
SAS
6,640
229
%macro IdentifyBedClusters(bedin,chr_var,st_var,end_var,bedout,dist=0); /*Note: the input bed should have regions with st < end position and from the same or different chrs or groups!*/ /*Try to lookup the st pos of each bed region with other regions in the same bed*/ /*the a.&st_var^=b.&st_var is important to ...
e389d0bbacd71130210888fb6544933ed2820787687d60b8c45a7635f2832cfb
SAS
6,649
192
%macro SQ_DROPMISS( DSNIN /* name of input SAS dataset */ , DSNOUT /* name of output SAS dataset */ , NOCOMPRESS= /* [optional] variables to be omitted from the minimum-length computation process */ , NODROP= /* [optional] variables to be omitted from droping even if they have only ...
127739d525e619abd94a3c023552be16b0ba177fe186d17c6186b3c9e5e5ee7b
SAS
6,664
216
%macro Caculate_eQTL_in_GTEx( /*Please use CaculateMulteQTLs_in_GTEx to replace this macro*/ query_snp=rs13057307, gene=Apobec3a, genoexp_outdsd=genoexp, eQTLSumOutdsd=AssocSummary, filter4geno= /*provide sas where or if condition to filter genotype data such as %str(where geno^=0;) */ ); %QueryGTEx4GeneID( geneids=&g...
209f28b3413fc120a6cb9886058f71dbcc11e923c0c41169663d0e0e9b93111e
SAS
6,754
248
%macro bed_region_plot_by_grp_splitted( bed_dsd, chr_var, st_var, end_var, grp_var,/*bed regions will be colored according to the group membership*/ val_var4bed_reg, indv_var,/*If empty, the macro will draw bed regions without considering individual information*/ inethickness=20 ); *Note: this macro will make...
003f2281af6fd6db3639a19157d18abff6fb0831ab1d277f59628d9e04bf03a9
SAS
6,931
243
%macro make_fake_axis_values4grps_new( dsdin, axis_var, axis_grp, new_fake_axis_var, dsdout, yaxis_macro_labels=ylabelsmacro_var ); *Fix a bug when only one record in a group; *make an extra copy for the records to make it has >1 records; *This is because the script will not be able to update corrected; *y...
d8ae47cc638b260a3d75d74e834cac634cfb6d792d2f694852a083b9b4a13ab3
SAS
6,959
232
%macro needleplot4snpsdiffzscores( diffzscore_gwas, gwas1_z, gwas2_z, snp_var, snps, diffzscore_p_var, gwas1pvar, gwas2pvar, fig_height=400, fig_width=600, NotDrawBubbleBySize=0, /*Draw common bubble plot with the same size of bubbles*/ transparency4needles=0.6, keep_snp_order4xaxis=0, draw_p_axis_by_z_direction=1, /*D...
ed45e0f64d831f9792a5a2dea2f7e3dfd960604c4032b5887b90366101b0683a
SAS
6,970
272
%macro PrepareDsd4MutRegPlot( dsd, pos_var, ID_var4yaxis, x_st4mut, x_end4mut, gr4color, pic_wd, pic_ht, dot_size, dsdout, seriesplot=0, yoffsetmin=0.01, /*Adjust the y-axis offset min or max to prevent the axis overlap with barplot*/ yoffsetmax=0.01, xoffsetmin=0.01, xoffsetmax=0.01, colors4grps=CXd178...
ed11c10f8b92be67ca8fba87f575a0816900e2365429b95e79249520aa1d241e
SAS
6,983
295
%macro gwas_manhattan_pipeline( GWAS_File, Marker_Col_Name, Marker_Pos_Col_Name, Xaxis_Col_Name, Yaxis_Col_Name, Marker_X_Xpos_Y_ColNums, GWAS_dsdout, gwas_thrsd, OutDir, Replace_Previous_Rst=1, Numeric_Xaxis_Col=1 ); %let Marker_Col_Name=%assign_str4missing(Inval=&Marker_Col_Name,NewVal=SNP); %let Xaxis_Col_Name...
a9e04d2d087c4f442b7b32d6ca168d030d85c5edaeda7a6ca46e55adc375ba49
SAS
7,085
279
%macro ImportSpecCols4FilesInDirbyScan( fileDir /*raw data file dir*/ ,fileRegexp /*regexp to match files*/ ,dsdout /*SAS output dataset name; N.B.: All variables are in character!*/ ,firstobs=0 /*The line number for header; if there is no header, firstobs=0*/ /*if the header is at 3...
476f42e868f189d09a99a180d7be19f892f1a9780363fa576652653a527032c9
SAS
7,098
248
%macro gwas_top_hits_manhattan( GWAS_File=, Marker_Col_Name=, Marker_Pos_Col_Name=, Xaxis_Col_Name=, Yaxis_Col_Name=, Marker_X_Xpos_Y_ColNums=, GWAS_dsdout=, gwas_thrsd=, Mb_SNPs_Nearby=,/*this Mb_factor will multiple 1,000,000 when running in the program*/ OutDir= ); %let Marker_Col_Name=%assign_str4mis...
1da7798fcccc647c7ed20fb7b80e3f53b120dc0d5d3c8b458c20f9b85a2d6749
SAS
7,205
292
%macro ImportFilesInDSDbyScan(filedsd /*sas dsd containing filenames*/ ,filename_var /*filename variable in the above dsd*/ ,fileDir/*raw data file dir; if using fullpath in dsd,let it empty*/ ,fileRegexp /*regexp to match files*/ ,dsdout/*SAS output dataset name; N.B.: All var...
bad9523150993a0ac472d9f7213dee71120acefba75466467ff07bf5c011a32d
SAS
7,230
225
%macro VarscanIDs2Annovar(VarscanID_dsd, Tbl_or_File, VarName, dsdout, annovar_input, annovar_dir, annovar_outdir, Anno_dsd_...
dae5717eb22f0e52ed6a9695eb46b3fc0f1680214414b59e3d2a116f95d92fb2
SAS
7,238
234
%macro tree_CL_positions( data=, /*A typical output generated by proc cluster*/ child=child, /*Equivalent to y_name_ or x_name_ from proc cluster; ensure there is not spaces included in the elements of this variable!*/ parent=parent, /*Equivalent to y_parent_ or x_parent_ from proc cluster*/ hh=hh, /*Equivalent...
7fb23df9c29511fcef327c55b25d0ab0d677c0b3c3bcd7a38a3e1680edd92474
SAS
7,287
216
%macro sorted_barplot( grpdsd=, /*input dataset for making sorted barplots by the values of a grp variable*/ grp_var=ID, /*character groups for x-axis, thus if no extra color variable supplied for the last paramter colorgrp_var, the macro will draw ALL bars in different colors, which sometimes is not informative!*/ ...
3ee4798af22d17d2bc24ac76f599cdcb336b68f7c32c0c99fbd1007bdc9ada64
SAS
7,314
212
/* gwas_names: such as A1_ALL, B1_ALL, B2_ALL, and C2_ALL; furthermore, except B1, all others have subpopulation GWASs, such as B2_AFR, B2_EAS, B2_SAS, B2_EUR; Note: A2_HIS, C2_HIS and B2_HIS tar gz file was broken Also include long covid GWASs from locuszoom: LC_W1, LC_N2, LC_W2, and LC_N1; Long COVID HGI - DF4...
1a78c91ce37b84c5fbe56111e0677f5b033fa80d4d65b1aa9dc07e0a938a9fc0
SAS
7,328
190
%macro towide(longdata,widedata,id,suffix,suffixlo,suffixhi,vars,types=,lengths=,numprint=,quiet=,sorted=); /* longdata - name of input data file that is in long form widedata - name of output data file that will be in wide form id - variable that uniquely identifies the wide records suffix - va...
ccaa4b8bbd08178b1b4fe9b2dabb8a9eb9bfb9d32116d099d7bcf8dfd2559466
SAS
7,362
235
%macro spaceAdjust( /* This macro can generate new numbers by adjusting its distance space in the sorted numbers, so please ensure the input dataset containing numbers that are sorted in ascending order; if the input is a list, the macro will generate a sorted dataset and generate adjust numbers automatically. */ dat...
727128bf71b9ed2f2dd981614ed4d859fc394bc9d06f8eb059230c679fd225ba
SAS
7,484
224
%macro adjust_close_positions( /*Limitation: where there are only 2 closely related positions, a fixed distance with Pct4OnlyTwoPos*step will be used to separate them; Additonally, if there are positions too close to the start or end of position in the figure, it is possible to modify the internal macro var pct2adj4...
5bfe13e20e6c21b0bf74e3c511e0c44a60dbab47c88530120d69c86730322778
SAS
7,611
271
%macro make_fake_axis_values4grps1( dsdin, axis_var, axis_grp, new_fake_axis_var, dsdout, yaxis_macro_labels=ylabelsmacro_var ); *Fix a bug when only one record in a group; *make an extra copy for the records to make it has >1 records; *This is because the script will not be able to update corrected; *y axis labels if...
88129684d5c8fedd70e1f947a0421b20f9792de7689bc1634ab05f2e08a3113d
SAS
7,653
255
%macro GTEX_SexBasedDiffGeneHeatmap(GTEx_sex_gz_file,gtf_dsd,st,end,chr,vars4sortheatmap); /**The downloaded file with multiple files included in the subdirectory, SAS will miss the file headers for these compressed data*/ /* https://www.gtexportal.org/home/datasets */ /* %let file_url=https://storage.googleapis.com/...
fd135242547edb68a424da6cd0caca161497dfd6d407602f2123b26d4cf7ee41
SAS
7,727
226
%macro _is_sas_macro(file=, bytes=8192, mv=IS_SASMACRO); %if "%sysfunc(strip(&file))" ="" %then %do; %put NOTE: (is_sas_macro) FILE= was blank, so this candidate will be skipped.; %let &mv = 0; %return; %end; %global &mv; %let _exists = %sysfunc(fileexist(%sysfunc(dequote(...
220573f12350181a54fc2be6e98de4c181d132373efb8ed7262b7ad138ffaea9
SAS
7,731
270
%macro Mult_BED_Enrichment(bed_db, query_db, query_var_name, random_db, random_var_name, np, sampling_dsdout, fdr_dsd_out, by_var4bed_db, output_mut_summary, Uniq_match_only ); /*only count unique match when query columns in d...
2daf787e37ff427a04fa6da2ee26c6f1fd42ff9a44bdb351b9112fbe4db7517f
SAS
7,768
247
%macro Beta2OR_forest_plot( dsdin=, beta_var=, se_var=, sig_p_var=,/*adjust the threshold of p in the extra_condition4updatedsd*/ marker_var=, marker_label=, svgoutname=, figfmt=png, figwidth=600, figheight=800, dotsize=10, autolegend=0, xaxis_value_range=%str(0.4 to 1.6 by 0.2), sort_var4y=,/*Provide a v...
b20639f842b6d4b8fe5d7450120c068a4c45f25e9bd5c93669e581e7b2c18981
SAS
7,885
271
%macro make_fake_axis_values4grps_old( dsdin, axis_var, axis_grp, new_fake_axis_var, dsdout, yaxis_macro_labels=ylabelsmacro_var ); *Fix a bug when only one record in a group; *make an extra copy for the records to make it has >1 records; *This is because the script will not be able to update corrected; *y...
644526885b7935acdb893c747e38985e9ff3656d88aa50cb963b6c46099662f3
SAS
7,901
306
/* A SAS Macro for doing semiparametric regression of multi-dimensional genetic pathway data, using least squares kernel machines and linear mixed models. https://content.sph.harvard.edu/xlin/software.html Liu, D., Lin, X. and Ghosh, D. (2007) Semiparametric Regression of Multi-Dimensional Genetic Pathway Data: ...
e56e6e866344ddeb24b33508cd94d17177134ed16adbc5bc6c88f0b042491700
SAS
7,917
201
%macro random_import_cell_mtex( /*Funcational annotation: this macro is suitable for columns more than 1 million, which is relative faster than other similar macros; For subsetting smaller % of columns, the macro seems to be not better than the macro random_import_cell_mtex4smalldsd!*/ gzfile=,/*the fullpath to comp...
f93ed378f36c6de817d01c689635d9e323bf7d74aa49ff866ea9a155b91d86de
SAS
8,042
241
%macro longformdsd4heatmap( /*Compared to the macro heatmap4longformatdsd, this macro may not be good enough! whenever possible, please use the heatmap4longformatdsd! The macro is kept for code reusing purpose!*/ dsdin, row_var, col_var, value_var, value_upperthres, Newvalue4upper, value_lowerthres, Newvalue4lower, cl...
6acb76c1398f4e56711b8a89e29543a3c83948ed13b75f1de81f53215e0faa01
SAS
8,082
275
%macro _make_fake_axis_values4grps_( dsdin, axis_var, axis_grp, new_fake_axis_var, dsdout, yaxis_macro_labels=ylabelsmacro_var ); *Fix a bug when only one record in a group; *make an extra copy for the records to make it has >1 records; *This is because the script will not be able to update corrected; *y a...
c5855e2fb3162ad875ee3fe91886d7674a7311848300306cd8b9407cc7c2c924
SAS
8,186
228
%macro GTEx_Hap_eQTL_Analyzer( /*If there is not plink prunned snps available, please use SAS macro Haplotype_Analysis4SNPs_in_GTEx by following its demo codes*/ SNPs4Haplotype=rs7872943 rs1887428 rs1887429 rs59679286 rs5938437 rs10974914 rs1576271, /*SNPs for haplotype eQTL analysis*/ plink_prunned_snp_file=H:\D_Qu...
8cf7bd709f1be7e36408c42b8a0e2e9ca3f092df54f131f0b37be4e02eb78927
SAS
8,193
253
%macro ucsc_cell_matrix2wideformatdsd( /*Note: this macro can also import large table with 1st column is gene and others for sample exp!*/ gzfile_or_url,/*Can be url for gz or plain text or tsv file; also, it can be a fullpath for these files in local computer*/ dsdout4headers, dsdout4data, extra_cmd4infile=,/*It ...
32f9a97b99268a69c05495ae62b3a559596d56b3a7322c52b4a57d4d428ac348
SAS
8,239
246
%macro subbranches( data=, /* input dataset, which should contain the following 3 input vars:*/ y_name_var=y_name_, y_parent_var=y_parent_, y_height_var=y_height_, out=work.sub, /* output dataset */ height=, /* numeric cutoff (use either height= or parent=), and only the t...
813a0da0f5638aaaa6b6b8cf7a085b986776b4c2e9e362315ac3293d66d038b6
SAS
8,348
259
/* The macro has been changed to read sas dataset directly by Zhongshan Cheng; A SAS Macro for estimating and testing for the effect of a genetic pathway on a disease outcome using logistic kernel machine regression via logistic mixed models.; https://content.sph.harvard.edu/xlin/software.html Liu, D., Ghosh, ...
ff73ea730c9f58978d940c46730d436db59b4b59e4441f8ac1f8bf3212409123
SAS
8,553
286
%macro MutRegOverlappedBlock( block_dsdin ,block_chr_var ,block_st_var ,block_end_var ,chr ,mindist ,maxdist ,Mut_dsdin ,Mut_chr_var ,Mut_st_var ,mut_sample_var ,Final_dsdout ,block_filcolor ,block_filaltcolor ,dotsize ,dotcolor ,max_y ,add_sample_ref_line=0 ,graph_designwidth=400 ,graph_designheigh...
ca57d0f0b82fb858e4235a09fb93e1ac6d6a5fad27bbd79430b1d9f51fa0bfb4
SAS
8,641
228
/* ----------------------------------------------------------------------- Program : Tmplt.sas Purpose : Generate a template for multiple plot displays. Also embed the TREPLAY macro so that it can be invoked as an option to replay plots lockstep through the newly ...
4fce829d1af55a584ac4d5bf90b96cacce702f78be31fe8485ccf354697caf7e
SAS
8,736
327
%macro heatmap4longformatdsd( /*Note: the easiest way to sort the x and y axis with customized order is to pre-sort the dsdin according to specific xgrpvar and ygrpvar in user customized order i.e.: proc sort data=dsdin;by xgrpvar ygrpvar;run; These two grp vars can be generated by proc sql with specific conditions...
5bba79a74b879c7e3325c8aa7d18db7b6f606fddfcae0fb0bc5bf6b9f0cd446a
SAS
8,765
285
/* For linux: sasv9_usermods.cfg /usr/local/SASHome/SASStudioBasic/3.4/template_usermods/workspaceserver/sasv9_usermods.cfg but it doesn't work The only way to solve the problem is put user macros into sasautos dir sudo cp /home/zhongshan/TCGA_Paper_Scripts/NewSASMacros/* /usr/local/SASHome/SASFoundation/9.4/sasautos...
51dbd39d17013756deca7f40f6d2e8dde04cd1e72481aec0afc7bd475bdc7528
SAS
8,891
331
/*Note: this macro is only able to import HGI GWAS release 7;*/ %macro ImportHGICovidGWASFromHGI_R7( zip, filename_rgx, sasdsdout, deleteZIP, for_subpop=0 /*R7 GWAS for ALL and sub-populations are in different format*/ ); %local nfiles txtfilenames txtfilename; /*CHR POS REF ALT SNP all_meta_N all_inv_var_meta_beta ...
1ec006e83ed9c1c2a195076ca101762f899006e4953e70ad03c87ae3323ff08a
SAS
9,178
209
%macro SQUEEZE_1( DSNIN /* name of input SAS dataset */ , DSNOUT /* name of output SAS dataset */ , NOCOMPRESS= /* [optional] variables to be omitted from the minimum-length computation process */ ); *This macro is the original version of SQUEEZE.sa...
7466f51f879fa400b9561d88522f2dc44360da35554b9c5bf9b2df7d9801b298
SAS
9,214
317
%macro sc_umap( umap_ds=umap, xvar=x, yvar=y, cluster_var=cluster, sample_grp_var=, ordered_sample_grps=,/*Provide ordered group names here to generate subplots in the same order as in this macro var*/ down_sampling_num=1,/* Provide pct value ranging from 0 to 1 or number of cells to get random cells for dow...
567b6f215d50e63adda48e7b09b0529cfb18407734fdce6640c13f9f2662c0a8
SAS
9,229
294
%macro UKB_Female_vs_Male_GWAS_Pipeline( female_gwas_url, male_gwas_url, female_male_gwas_url, outdir=/home/cheng.zhong.shan/my_shared_file_links/cheng.zhong.shan/F_vs_M_Covid19_Hosp, forece=1 ); *Use EUR COVID19 GWAS; /* %let GWAS_F_url=https://grasp.nhlbi.nih.gov/downloads/COVID19GWAS/06182021/UKBB_hsptl_EUR_F_061821...
6c7089a7509d5542b0981d00447bdb529f66e0915bc4359c62b089845165ea6a
SAS
9,286
335
%macro Get_Tested_ASE_Muts( Cancer, normal_aaf, gene, MatlabAnalysisDir=F:\NewTCGAAssocRst /*This is the matlab analysis directory containing directories for different cancer types, and each cancer directory has the following subdir: MatlabAnalysis*/ ); %if &gene ne %then %do; %put Will only query ASE-Mut for ...
e99765690a6570fffb09e0b81a7ad4d1e0b87256e15a8aa155cb677088531f0b
SAS
9,305
351
%macro Boxplots4GenesInGTExV8ByAA( genes=MAP3K19 R3HDM1 CXCR4 DARS LCT UBXN4 MCM6 ZRANB3 RAB3GAP1 CCNT2 ACMSD TMEM163, dsdout=exp, UseGeneratedDsd=0, PreviousDsd=tgt, Lib4PreviousDsd=GTEx, WhereFilters4Boxplot=%str(), boxplot_width=800, boxplot_height=1000 ); %let gene4sort=%qscan(&genes,1,%str( )); %if &boxplot_heigh...
e9c8d13cd4ed9f60483035d79c6fae8db44dd2af00679b364bff53469843a480
SAS
9,455
295
%macro make_fake_axis_values4grps( /*This macro has issue when axis_var containing positve and negative values among different grps*/ dsdin, axis_var, axis_grp, new_fake_axis_var, dsdout, yaxis_macro_labels=ylabelsmacro_var, step4yaxis_macro_labels=1,/*Only keep ticks with mod(t,step)=0, which will prevent the ...
5c141b1eb1e8c6a30511fc326d6af00775a783c0b701c937752c26e2cc242022
SAS
9,480
390
*options mprint mlogic symbolgen; %let macrodir=%sysfunc(pathname(HOME))/Macros; %include "&macrodir/importallmacros_ue.sas"; %importallmacros_ue; %mkdir(dir=%sysfunc(pathname(HOME))/data); libname D '%sysfunc(pathname(HOME))/data'; %let gwas_url=https://grasp.nhlbi.nih.gov/downloads/COVID19GWAS/10202020/COVID19_HGI_...
8edb5a464850c96b832dec0cb262dd18022434e4203eb485986dd974b84f8421
SAS
9,516
367
%macro HGI2PairwiseGWASPipeline( gwasfile_dir=F:\360yunpan\SASCodesLibrary\SAS-Useful-Codes\Macros, gwas1gzfile=COVID19_HGI_B1_ALL_leave_23andme_20210107.b37.txt.gz, gwas2gzfile=COVID19_HGI_B2_ALL_leave_23andme_20210107.b37.txt.gz, EUR_AFR_frq_file=EUR_AFR_specific.txt, tgt_snps=12:113357193:G: 17:44219831:T:A 19:...
5164a11119cba07c377743574d5aa91ee6f3c33cdd9109b651b7eb64d45a5c96
SAS
9,544
264
%macro local_multigwas_manhattan( GWAS_SAS_DSD=, Marker_Col_Name=, Marker_Pos_Col_Name=, Xaxis_Col_Name=, Yaxis_Col_Names=, /*Support multiple p-val vars*/ GWAS_dsdout=, gwas_thrsd=, /*-log10(P) threshold, such as 5*/ Mb_SNPs_Nearby=,/*this Mb_factor will multiple 1,000,000 when running in the program*/ snps=, design_w...
7fb875f355983295f83b0bcc61533e12cbab060373f862f6caaa4c813cfd939f
SAS
9,615
335
/***********************Important********************************************; *Note: for typical microarrays with thousands of genes,; *the simplely running of glimmix will not be computational feasible; *because of the large size of the X matrix; *In this situation, we recommend breaking the model into two parts:; *t...
7d26c3404c92c68040f7f6dfe63866a49dfc7cbe1d5be1799d7e069dca0d988c
SAS
9,622
314
%macro Bed4BlockGraphByGrp( dsdin, mindist, maxdist, chr, chr_var, st_var, end_var, dsdout, graph_wd, graph_ht, show_block_values, Grp, block_colors=darkred darkblue, gap_color=white ); /*make sure no overlapping between each bed region*/ %local i block_values grp_list grp_n color xi gi; /*typical c...
a8a9732a99c8fe3ea13d47cbc3e2b31e364bc6a9573874f8cacf16cc28be57ac
SAS
9,718
317
%macro scatter_over_bed_track( bed_dsd, chr_var, st_var, end_var, grp_var, yval_var, yaxis_label=Group, linethickness=20, track_width=800, track_height=400, dist2st_and_end=0, dotsize=10 ); *A new numberic group, ord, is created in descending order; *Note: it is important to sort the group by yval_var ...
d35edc8b27d83269e221125544afb97295ac1f70215a4554c701e8f01e0c3a6b
SAS
9,865
327
%macro gscatter_over_bed_track( bed_dsd, chr_var, st_var, end_var, grp_var, scatter_grp_var, yval_var, yaxis_label=Group, linethickness=20, track_width=800, track_height=400, dist2st_and_end=0, dotsize=10 ); %if &scatter_grp_var eq %then %do; %put Please provide the variable for scatter_grp_var, as it is empty!; %a...
8d407bb5ea32aaefbf95da4e51cedcc8680edc0383ebeb9c7846583db336b3e4
SAS
9,868
376
%macro deseq_normal_not_optimized(/*for backup purpose*/ dsdin,/*Note: to save space, the input dsd will be replace*/ read_vars, dsdout, readcutoff=3, cellcutoff=5 ); /*readcutoff and cellcutoff will be used to exclude genes NOT passing the filters: at least the number of cells expressing at least the number of reads*/...
ee15b3b9c8d9f150ef3b98f76049b88195829d37c9404fe173a7a4fceb9dba28
SAS
9,941
363
*This macro is replace by deseq_normalization; *as the old one takes too much resource and memory; %macro deseq_normalization_old( dsdin, read_vars, dsdout, readcutoff=3, cellcutoff=5 ); /*readcutoff and cellcutoff will be used to exclude genes NOT passing the filters: at least the number of cells expressing ...
e9778e3c52f7a2c6a2f1276a528f08bba152fa71f2294bf21e8996ca0e675b93
SAS
10,032
232
%macro DIRLISTWIN( PATH /* Windows path of directory to examine */ , MAXDATE= /* [optional] maximum date/time of file to report */ , MINDATE= /* [optional] minimum date/time of file to report */ ...
c598d8ad177f0912474efce360e48efc7c2abead7719f50f4a86fc613c0b89ab
SAS
10,282
395
%macro Bed4BlockGraph( dsdin, mindist, maxdist, chr, chr_var, st_var, end_var, dsdout, graph_wd, graph_ht, show_block_values, block_color=CX0000FF, /*color for the bed block regions*/ gap_color=CXFFFFFF /*color for the space regions between bed regions*/ ); /*make sure no overlapping between each bed reg...
5572fe5db3331b5aa7483b258fa81a2622bd8a8063ff99352c6f3b7b0cac66e0
SAS
10,480
339
%macro review_tree_branches( inputdsd=a, y_name_var=child, y_parent_var=parent, y_height_var=hh, outdsd=out,/*A output dataset would be further used to draw new tree with sgrender template HeatDendrogram1*/ branch_name_dsd=branch_name_dsd /*Ordered branche names for the end leaves in the final cluster from left t...
f37a984a9620c1baeebf56f80ce99da124132ea6f7966160298070865236702e
SAS
10,557
392
*Note: this macros is the old version as it only can handle single GWAS; *For better performance, it is suggest to use the following macro, which can plot multiple GWASs; *Manhattan4DiffGWASs.sas; * macro that can be used later to generate symbols for plots with two alternating colors; %macro twocolors(c1,c2); %do j=1...
dbd18c679f310674953050a7428fd43894cacf1ba9968f57a02eb6d68561d31d
SAS
10,668
319
/* / Program : xl2sas.sas / Version : 1.0 / Author : Roland Rashleigh-Berry / Date : 03-Feb-2008 / Purpose : Read an html Excel spreadsheet into a sas dataset using DDE / SubMacros : none / Notes : This is meant to be run interactively. The start and end rows / ...
b1bf640468b9a6f9798f5e2c4974555da85218192a4413cba29441c5138a84e0
SAS
10,832
266
%macro SQUEEZE( DSNIN /* name of input SAS dataset */ , DSNOUT /* name of output SAS dataset */ , NOCOMPRESS= /* [optional] variables to be omitted from the minimum-length computation process */ ); *Note: this macro was updated by zhongshan to gen...
8d55abe53313a82a9cb9dfd7bcc8244411ef33f81b4150ef27c3366a8c7832f3
SAS
10,988
347
%macro InstallGitHubZipPackage( git_zip=https://github.com/chengzhongshan/COVID19_GWAS_Analyzer/archive/refs/heads/main.zip, homedir=%sysfunc(pathname(HOME)),/*SAS OnDemand for Academics HOME folder*/ InstallFolder=NewMacros, /*Put all uncompressed files into the folder under the homedir*/ DeletePreviousFolder=0, /...
c44433ebab9a17cde232521c8ddde450813264cf280cebb81034ff717cef7a2f
SAS
11,014
353
%macro GTEx_eQTL_genes_scatterplot( genes=Apobec3a Apobec3b, hg38_gtf_dsd=FM.GTF_HG38, eqtldsdout=tgtgenewidedsd, min_pos= ,/*restrict the start position in hg38 of local Manhattan plot; If it is empty, default value would be the minimum start position;*/ max_pos= ,/*restrict the end position in hg38 of local Manhatta...
723b86dbbe48c1c5b6f1b6ee46a974e4a6380ff6f7c7fc42f2380922defdc11a
SAS
11,079
322
%macro FisherTestGenomeWide( /*Note: Please use the macro two_cohorts_mut_fisher_test to replace this macro! this macro will use unique sampleID and pheno_var to make all to all combinations, please make sure the input table contain all target sampleID and pheno_var; If not, please supply a sas dataset containing ...
3ac9bbed8ec977a3cc79a5340ad6c046f8dcf761f990d211db3e8cdb5baac15f
SAS
11,147
417
%macro GWAS_Merge_1KG( OneKG_Path, OneKG_Pop, PLINK_EXE, WorkDir, User_Imput_GWAS ); /*In case of input of multiple populations*/ %let re=%sysfunc(prxparse(s/ +/" "/oi)); %let pop_list="%sysfunc(prxchange(&re,-1,&OneKG_Pop))"; %put OneKG_Pops: &pop_list; %syscall prxfree(re); %let OneKG_Pop=%sysfunc(prxchange(s/\s+/...
578c7ac2f5564b06f0b4ba61d1a8c27335467baf68c500d40422f0ac20553b54
SAS
11,457
291
%macro local_gwas_hits_and_nearby_sigs( /*Note: this macro is only works for top GWAS hits with p < 1e-6, as it requires to have the top independent SNPs as input for the var snps; However, there are still bugs as the output figure is abnormal for the center marker of the topest snp; somethings are wrong with th...
17ce8065093a39a86e28f7a97478b64c9d36d72582551ea7a19a3e479102eef0
SAS
11,609
335
%macro Haplotype_Analysis4SNPs_in_GTEx( query_snps=rs7850484 rs17425819, gene=GAPDH, genoexp_outdsd=genos, eQTLSumOutdsd=AssocSummary, rgx4tissues=, /*optional regular expression to select specific tissues for haplotype association; such as (lung|liver) */ filter4geno= %str(where geno^=-1) /*put conditional filt...
073562b1c90e8ee1686faeb9d54edf6fc8c2d120fa8a3c9dc9786087cc878a64
SAS
11,639
348
%macro UKB_Female_vs_Male_GWAS_GRASP( /*this macro is ONLY able to process GWASs regardless of sex from both GRASP COVID-19 database; This means the two input GWASs can be any GRASP GWASs with potential biological differences for further investigation; for example, it can be used to perform differential GWAS between AF...
6fed3bcba85d2a8952e6e645008d5f118130b9c3b8c622b642fce4942340ae60
SAS
11,646
369
%macro sc_scatter4genebygrp( dsd=, dsd_headers=, dsd_umap=, gene=, pheno_var=, pheno_categories=, grpvar4boxplot=, samplewide=1, sample_var=sample, boxplot_width=1000, boxplot_height=600, boxplot_nrows=3 ); /* libname sc "/home/cheng.zhong.shan/data"; */ *Need to have sc.exp, sc.UMAP; %let ncats=%ntokens(&pheno_categor...
afcbcd48f321f6adf893f634b0a8997d3a9c3de8cb15024d3e7deb2317fa923a
SAS
11,840
353
%macro DiffTwoGWAS(/*Note: only common SNPs will be kept; also requires to have two allele vars common to both GWASs: such as allele1 and allele2 in both GWAS; duplicate snps in each GWAS will be excluded Important: it is necessary to sort the two input GWAS by chr and pos before applying current macro! */...
f88a08a05ea96a8bb3f4724d173def7d5f40766a4813f2375923eba210100614
SAS
11,989
436
%macro Boxplots4GenesInGTExV8( genes=MAP3K19 R3HDM1, dsdout=exp, bysex=1, UseGeneratedDsd=0, PreviousDsd=tgt, Lib4PreviousDsd=GTEx, WhereFilters4Boxplot=%str(), boxplot_width=1200, boxplot_height=1000 ); %if &boxplot_height eq %then %let boxplot_height=%eval(250*%ntokens(&genes)); %let gene4sort=%qscan(...
fb99efaa7d026063ef28712a783c35ffa342ad3e018de1552d3c866403876fd6
SAS
12,495
396
%macro ImportFileHeadersFromZIP( zip=,/*Only provide file with .gz, .zip, or common text file without comporession Note: it is necessary to have fullpath for the input file!*/ filename_rgx=., obs=max, sasdsdout=x, deleteZIP=0, infile_command=%str(firstobs=1 obs=10;input;info=_infile_;), /*Better to use nrbquote...
ec47b457ac6a4ca7709d1f4abe6f2c6d5439b974134377446d2b609ef8d62a1c
SAS
12,538
447
%macro deseq_normalization( dsdin,/*Note: to save space, the input dsd will be replace*/ read_vars, dsdout, readcutoff=3, cellcutoff=5 ); /*readcutoff and cellcutoff will be used to exclude genes NOT passing the filters: at least the number of cells expressing at least the number of reads*/ *Alternative way ...
7c2c74c773bc598c1c5f9aae2c444be4c9c33f933fb45b846ff1736645182d0f
SAS
12,610
382
*********************************************************************************************************************** ***********A macro that execute R scipt in base SAS******************************************************************** ** MACRO Version: 1.0 ...
12704167d5caecd8c62e17b4a1a8a66bec214a05ee75a0b78660b6aba7c3dd30
SAS
13,019
308
/* MACRO %GetVarList Version: 2.01 Author: Daniel Mastropietro Created: 27-Dec-2004 Modified: 20-Jun-2016 (previous: 17-Aug-2006) DESCRIPTION: This macro parses a list of variables in a dataset by converting the keywords _ALL_, _NUMERIC_, _CHAR_, hyphen strings (such as in x1-x7, id--name), and colon refere...
a35dc5f69f3e48245c94b4dcbf07064bcb9f9cbf8b1f3a7b6a186202c6576b81
SAS
13,570
281
%macro get_HGI_R7_GWAS( gwas_name=, /*such as B1_ALL, B2_ALL, and C2_ALL; furthermore, except B1, all others have subpopulation GWASs, such as B2_AFR, B2_EAS, B2_SAS, B2_HIS; Note: A2_HIS, C2_HIS and B2_HIS tar gz file was broken! No A1_ALL Only SNPs with het_p>0.05 will be kept! */ hgi_gwas=hgi_gwas_out, /*sas ...
ce9eef58772de90e38ad46b22c29d193a5ee8f4c2e1eb2ad829b5825df94408a
SAS
13,756
399
%macro UKB_Female_vs_Male_GWAS_Pipeline( /*this macro is able to process GWASs regardless of sex from both Neale lab and GRASP COVID-19 database*/ female_gwas_url, male_gwas_url, female_male_gwas_url, outdir=/home/cheng.zhong.shan/my_shared_file_links/cheng.zhong.shan/F_vs_M_Covid19_Hosp, forece=1, label4female_gwas=F...
a0abadc3e091503a7773d3d2beb9405d2054d5453908c90ca2daf97b5f28778c
SAS
13,963
459
%macro sc_scatter4gene( dsd=, dsd_headers=, dsd_umap=, gene=, cell_type_var=cluster, pheno_var=, pheno_categories=, grpvar4boxplot=,/*separate umap and boxplot by pheno_var and grpvar*/ samplewide=0, sample_var=sample, boxplot_width=1000, boxplot_height=600, umap_width=1000, umap_height=500, umap_lattice...
bf49f66aa8a435209eb32ecc581cdc9f410399668b81e771a33d8f0c39b480b8
SAS
14,208
323
%macro long2wide4multigrpsSameTypeVars( /*Note: this macro is handy when there are multiple target numeric or characteric variables needs to be transposed to rowwide; *Tranditional transpose procedure usually handle one type of variable to rowwide by other group variables; *But this macro can abtain wide format tabl...
6862e6ff085b3857dd261d972b81ac39b62de4189d7c6f4aa4e1ef472e344f4a
SAS
14,213
489
%macro get_macros_used_by_macro(/*This macro may run endlessly when the macro include its macro name without the Demo tag*/ macrorgx=.,/*No need to include \.sas, as the macro will only keep sas script having prefix matching with the macrorgx!*/ dir=%sysfunc(pathname(HOME))/Macros ~/shared/Macros /home/zcheng/SAS-...
e3df8f42ef215e9380e03b268226e815c55a8fc6e49a588ab250d0857c037ada
SAS
14,490
466
%macro InitEstHapFrq( gen_pheno_sasdsd=, /*The input sas dataset should be in the following format: ID pheno cov1 snpA1 snpA2 snpB1 snpB2 snpC1 snpC2; with two alleles represented by 0 and 1 and the order of allele1 and allele2 should be strictly put in the order of 0 and 1; */ Hapfrq_outdsd=Hapfrq, /*Initially...
b913b167b42599cc8bbd323cb9721e5e1a61afd5fe4dd21917be935510556ac8
SAS
14,815
391
*It is still better to have these raw SPredXcan association signals by tissue and HGI GWAS; *To acomplish this, the raw SPredXcan output needs to be combined into a single file for making expected TWAS heatmap; *Use my own Perl script to combine these files within linux docker image; *H:\MetaXcan\MetaXcan\software...
d97b99e70e400e7f98f70feefca9e0d74f98f35643cf251d9b32222df052bc64
SAS
15,051
496
/*The issue for this macro is that the two parameters startlinenum and endlinenum may lead to the read of partial data for a specific feature, which means the records of the feature may be splitted into two sections and included in two blocks*/ %macro ucsc_cell_mtx2iml( /*This macro can import data from url, download...
429ecb0d09247ce711fee3a870b8a293f1e7df24466109552b0a6b7cd2f88779
SAS
15,319
441
%macro CaculateMulteQTLs_in_GTEx( query_snps=rs17425819 rs7850484, gene=JAK2, genoexp_outdsd=genos_and_exps,/*output dataset name in long format for genotype and gene expression across different tissues*/ eQTLSumOutdsd=AssocSummary, rgx4tissues=, /*optional regular expression to select specific tissues for haplotype as...
6b9540bc92e0bbdc4521791a7dda5e2d04cf5707b76b4703d21dace4dd58b370
SAS
15,722
332
%macro Long_format_muts2ProteinTrack( /*See the demo code at the end of this macro for how to generate fake gtf and inptu data set based on ncbi gpff file; Note: several important parameters can adjust the label on the top: yoffset4max_drawmarkersontop and Yoffset4textlabels can be used to enlarge the top regions co...
929229b57a0deb532833c920f8b7a9dd73e521d40479006675312edf90e87334
SAS
15,785
407
%macro make_fake_axis4NegPosVal_by_grps(/*The macro will scale up or down positive or negative values and generate yaxis macro labels with the original postive values; To keep using the original positive value but also to scale the ratio between these positve and negative values, the macro variable NotChangePosVals ...
01983b197e4d1899b08a457dc0ddcfbadf2bf40f7c03cc6d7668d23c12e67e4e
SAS
16,000
523
/* data a; */ /* input chr $ st end type $ grp $; */ /* cards; */ /* chr1 1 100 gene a */ /* chr1 10 20 exon a */ /* chr1 50 70 exon a */ /* chr1 200 800 gene b */ /* chr1 300 500 exon b */ /* chr1 600 700 exon b */ /* chr1 1100 3000 gene c */ /* chr1 1200 2000 exon c */ /* chr1 2200 2800 exon c */ /* chr1 ...
ee6d5c41d919cf8241edcd3f60f89f133ad59f5af421aab6b11293779c2050dc
SAS
16,435
507
%macro sc_freq_boxplot( /*Note: the macro also perform gene expression differential expression analysis!;*/ longformdsd, cell_type_var= ,/*It will be used for lattice boxplot headernames*/ sample_grp_var= ,/*This will be used to generate sample level cell expression statistics*/ pheno_var= , /*Pheno var will be used a...
c23b1f234120060a28389b92816da4913d0b6e7a98e7a4fea1bbc79d1bc93869
SAS
16,764
366
%macro Long_format_GWAS2Wide( longformat_GWAS=,/*Long format HGI GWAS with association signals in a union by same columns and different gwas dsd names; Note: the input GWAS data should be in hg38 build if querying by genesymbol!*/ gwas_dsd_var=gwas,/*The gwas variable in the longformat_GWAS*/ filter4gwas_dsd=,/*Add ful...
39d8d482dac3e13ba03d028dccdd3aa0d593401f8e9d50481993a2cac8dcbccf
SAS
17,041
570
%macro scASE_FMM_and_ORA_Analysis( pathway_gene_dsd=base,/*a dataset containing genes that will be used to overlapped with ASE genes from the following celltype_level_dsd*/ pathway_gene_var=gene,/*variable name for genes in the pathway_gene_dsd*/ ASE_gene_var=gene,/*variable name for genes in the celltype_level_dsd*...
8305723677027a4ae35ab46df8e95ec03489f591970d26f49f004dce83fe61e4
SAS
17,212
452
* _\|/_ (o o) +----oOO-{_}-OOo----------------------------------------------------------------------------+ : : : Version...
299aeeb40b3285a0cb1b703e9c7d8732f6b1ad4ac923f841ca699c56ecc26da8
SAS
17,445
530
%macro Lattice_gscatter_over_bed_track0(/*Old macro without adding of gene annotation to tracks, which is for backup only*/ bed_dsd,/*Too many bed regions (>1000) for the gene track will slow down the macro dramatically*/ chr_var, st_var, end_var, grp_var, scatter_grp_var, lattice_subgrp_var, yval_var, yaxis_label=Grou...
34607c3dad382e6c00d36e7af04d4f070f3d08cb34e2347f685705ae4e5f2888
SAS
18,234
310
%macro Gene_Local_Manhattan_With_GTF( /* Note: comparing to the macro SNP_Local_Manhattan_With_GTF, this macro has fewer parameters to control the final figure; If possible, please use SNP_Local_Manhattan_With_GTF to draw gene level Manhattan by providing genomic range for a target gene; As this macro use other s...
f9db549909d9b3eba6a64712ead656f65a2ab8770474f232a873b7b3284ef42c
SAS
19,022
517
%macro clustergram4longformatdsd( /*The limitation of clustergram4longformatdsd compared to clustergram4sas is that the orders of two axes of final heatmap is sorted by varnames if not clustered, as this macro will sort the long format data by rowname_var and colname_var, and then tranpose it for cluster if either ...
ecf4188e45f1d5fcad62790abcffb17a0c8320f1f4da8397b091cee52cb03d24
SAS
19,771
635
%macro ucsc_cell_mtx2wideformatdsd( /*This macro can import data from url, downloaded gz file, or even plain files*/ mtx_gzfile_or_url=matrix.mtx.gz,/*Important: Input fullpath or url for these 3 input files*/ feat_gzfile_or_url=features.tsv.gz, barcode_gzfile_or_url=barcodes.tsv.gz, dsdout4headers=header, dsdout...
71c37df0b44578457335f9821465ca5e2676fbb8b5e987d1dde36d0e99eb2a00
SAS
19,808
576
%macro GetMultQTLs4GenesInGTEx( /*Unlike the macro CaculateMulteQTLs_in_GTEx, this macro is helpful to get genotypes and gene expression for multiple query SNPs and Genes at the same time; it output both long- and wide-form datasets for gene expression corresponding to input genes, i.e., &genoexp_outdsd and &genoex...
5b7a26680d71ef22d3f7d9d50a2df732f848fa141a19a99aad020d70abe2e312
SAS
20,709
765
/*----- * group: Data out * purpose: Export SAS datasets and OUTPUT catalog entries as worksheets of an Excel file.<BR>This macro can write to _WEBOUT to deliver binary Excel worksheets from SAS/Intrnet applications * notes: Requires Perl and modules XML::Simple, Spreadsheet::WriteExcel and Date::Calc<BR><i>Current ...
8763c3857ecce77f4081a58b6cfd220794b2de21ed8e7b6cf8891ff39cc9621b
SAS
20,973
564
/* UKBB 06.18.21 Hospitalized Positive vs. Non-Hospitalized Positive or Negative or Untested 1,343 / 262,886 Mixed F 47.88M 395 Summary Stats Annotated Grasp EBI GTeX eQLdb UKBB 06.18.21 Hospitalized Positive vs. Non-Hospitalized Positive or Negative or Untested 1,917 / 221,174 Mixed M 47.45M 53...
25713ca90f0ad1a622b876c2b6afca87e96a84a8e4014281e0c7103744919baa
SAS
21,034
636
%macro Lattice_gscatter_over_bed_track_( bed_dsd,/*Too many bed regions (>1000) for the gene track will slow down the macro dramatically*/ chr_var, st_var, end_var, grp_var, scatter_grp_var, lattice_subgrp_var, yval_var, yaxis_label=Group, linethickness=20, track_width=800, track_height=400, dist2st_and_end=0, dotsize=...
663351bfb5dfb9080b0c93ad90dce757b27d79d34b710a18fa48576e5b745188
SAS
21,737
549
*https://sesug.org/proceedings/sesug_2024_SAAG/PresentationSummaries/Papers/151_Final_PDF.pdf; *options mprint mlogic symbolgen; filename M url "https://raw.githubusercontent.com/chengzhongshan/COVID19_GWAS_Analyzer/main/Macros/importallmacros_ue.sas"; %include M; Filename M clear; %importallmacros_ue(MacroDir=%s...
30c2620934e75cad4b45ceefde92eab9800738333f1aa711319cc81bb9c91aff
SAS
21,987
781
%macro Boxplots4GenesInGTExV8ByGrps( genes=MAP3K19 R3HDM1 CXCR4, dsdout=exp, bygrps=sex AA, /*by AA population and sex or either of them!*/ UseGeneratedDsd=0, PreviousDsd=tgt, /*This is a fixed dsd used by the proc sgpanel*/ Lib4PreviousDsd=GTEx, WhereFilters4Boxplot=%str(),/*such as cluster in ("Lung" "Spleen" ...