Question: use of 2 covariate files for association analysis in plink
0
gravatar for SKS
3.9 years ago by
SKS10
SKS10 wrote:

Dear all, I want to use 2 covariate file in my association analysis in plink, is this possible ?, (without combining all the covariates in 1 file) Is it valid to use ? --bfile file \ --logistic \ --covar /covarfile1.txt \ --covar-number 1-3 \ --covar/covarfile2.txt --covar-number2-3 \ --out filename Thanks

cov plink association • 1.3k views
ADD COMMENTlink modified 3.9 years ago by chrchang5237.6k • written 3.9 years ago by SKS10

Please use:
-A more informative title: adding stuff like "association analysis" and "plink" would be good
-More precise tags: for example "plink"

ADD REPLYlink written 3.9 years ago by WouterDeCoster45k
3
gravatar for chrchang523
3.9 years ago by
chrchang5237.6k
United States
chrchang5237.6k wrote:

No; you'll need to merge the files with a short script.

ADD COMMENTlink written 3.9 years ago by chrchang5237.6k

Many thanks for your response. Could you please advice how the covariate files can be merged based on FID and IID in bash/ plink? (The individuals can be uniquely identified only by using both FID and IID information). And not al individuals in first covariate file are present in the second covariate file and vice versa.

ADD REPLYlink modified 3.9 years ago • written 3.9 years ago by SKS10
1

With a bash script:

A. Merge the FID and IID fields with something like

cat orig_covar_1.txt | awk '{out=$1"_"$2; for(i=3;i<=NF;++i){out=out"\t"$i}; print out}' > covar_merged_ids_1.txt

cat orig_covar_2.txt | awk '{out=$1"_"$2; for(i=3;i<=NF;++i){out=out"\t"$i}; print out}' > covar_merged_ids_2.txt

If underscores are already present in your file, replace "_" with some other character that isn't used.

B. Use the Unix "join" command (https://en.wikipedia.org/wiki/Join_(Unix) ) to merge covar_merged_ids_1.txt and _2.txt.

C. Split the merged IDs back into FID/IID with e.g.

cat covar_joined_merged_ids.txt | tr '_' '\t' > covar_joined.txt

ADD REPLYlink modified 3.9 years ago • written 3.9 years ago by chrchang5237.6k

Thank you very much.

ADD REPLYlink written 3.9 years ago by SKS10
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2136 users visited in the last hour
_