Posts: 454
Threads: 68
Joined: Nov 2023
Gender: Male
Ethnicity: Arab
I want to match the snps (rsid) from a file I have to my dataset so that it only matches those snps. I've tried several commands and it's just not doing it
Posts: 675
Threads: 41
Joined: Aug 2023
Gender: Male
Ethnicity: Colonial American
Nationality: American
Y-DNA (P): R1b-U152 >R-FTA96415
Y-DNA (M): I2-P37 > I-BY77146
mtDNA (M): J1b1a1a
mtDNA (P): H66a
(12-24-2024, 10:31 PM)Genetics189291 Wrote: I want to match the snps (rsid) from a file I have to my dataset so that it only matches those snps. I've tried several commands and it's just not doing it
plink(version number) --bfile "dataset" --keep extractlist --make-bed --out "your sample"
Genetics189291 likes this post
Posts: 454
Threads: 68
Joined: Nov 2023
Gender: Male
Ethnicity: Arab
(12-24-2024, 10:35 PM)AimSmall Wrote: (12-24-2024, 10:31 PM)Genetics189291 Wrote: I want to match the snps (rsid) from a file I have to my dataset so that it only matches those snps. I've tried several commands and it's just not doing it
plink(version number) --bfile "dataset" --keep extractlist --make-bed --out "your sample"
I should have mentioned it's a .txt file it's formatted in this way
rs6668
rs2134532
etc
when I use that command it tells me line 1 of keep file has fewer tokens then expected
Posts: 675
Threads: 41
Joined: Aug 2023
Gender: Male
Ethnicity: Colonial American
Nationality: American
Y-DNA (P): R1b-U152 >R-FTA96415
Y-DNA (M): I2-P37 > I-BY77146
mtDNA (M): J1b1a1a
mtDNA (P): H66a
My bad.... keep is for samples
Use --snps
Think you can put a filename after the --snps
Code:
Multiple ranges
--snps <variant ID(s)/range(s)...>
--exclude-snps <variant ID(s)/range(s)...>
--snps accepts a collection of individual variant IDs and variant ranges. For example,
--snps rs1111-rs2222, rs3333, rs4444
tells PLINK to load all variants between rs1111 and rs2222 inclusive, as well as rs3333 and rs4444. (Syntax works the same way as --chr. If your variant IDs contain dashes, you'll want to use the --d flag as well.) If rs1111 and rs2222 are on different chromosomes i < j, then all variants on chromosomes numbered between i and j are loaded, as well as the last variants on chromosome i and the first variants on chromosome j. (You can exclude some intermediate chromosomes by combining --snps with --not-chr.)
Posts: 675
Threads: 41
Joined: Aug 2023
Gender: Male
Ethnicity: Colonial American
Nationality: American
Y-DNA (P): R1b-U152 >R-FTA96415
Y-DNA (M): I2-P37 > I-BY77146
mtDNA (M): J1b1a1a
mtDNA (P): H66a
plink --bfile data --extract snps.txt --recodeA
Posts: 454
Threads: 68
Joined: Nov 2023
Gender: Male
Ethnicity: Arab
(12-24-2024, 10:53 PM)AimSmall Wrote: My bad.... keep is for samples
Use --snps
Think you can put a filename after the --snps
Code:
Multiple ranges
--snps <variant ID(s)/range(s)...>
--exclude-snps <variant ID(s)/range(s)...>
--snps accepts a collection of individual variant IDs and variant ranges. For example,
--snps rs1111-rs2222, rs3333, rs4444
tells PLINK to load all variants between rs1111 and rs2222 inclusive, as well as rs3333 and rs4444. (Syntax works the same way as --chr. If your variant IDs contain dashes, you'll want to use the --d flag as well.) If rs1111 and rs2222 are on different chromosomes i < j, then all variants on chromosomes numbered between i and j are loaded, as well as the last variants on chromosome i and the first variants on chromosome j. (You can exclude some intermediate chromosomes by combining --snps with --not-chr.)
I tried this but it didn't seem to work
I tried the command below which also didn't seem to work, I can go through it one by one and filter it but it would take a long time to do
Posts: 675
Threads: 41
Joined: Aug 2023
Gender: Male
Ethnicity: Colonial American
Nationality: American
Y-DNA (P): R1b-U152 >R-FTA96415
Y-DNA (M): I2-P37 > I-BY77146
mtDNA (M): J1b1a1a
mtDNA (P): H66a
Post your snp restriction file
Posts: 324
Threads: 4
Joined: May 2024
do you mean the " --extract snp.txt " command?
Posts: 454
Threads: 68
Joined: Nov 2023
Gender: Male
Ethnicity: Arab
(12-25-2024, 12:11 AM)AimSmall Wrote: Post your snp restriction file
will do
Posts: 454
Threads: 68
Joined: Nov 2023
Gender: Male
Ethnicity: Arab
(12-25-2024, 09:30 AM)nomad01 Wrote: do you mean the " --extract snp.txt " command?
I tried this and it seemed not to work, I checked the files and it didn't execute the command, I also tried awk but no luck
Posts: 324
Threads: 4
Joined: May 2024
(12-25-2024, 12:55 PM)Genetics189291 Wrote: (12-25-2024, 09:30 AM)nomad01 Wrote: do you mean the " --extract snp.txt " command?
I tried this and it seemed not to work, I checked the files and it didn't execute the command, I also tried awk but no luck
it should be working, bed/bim/fam, plink2.exe and snp.txt should all be in the same folder
Genetics189291 likes this post
Posts: 454
Threads: 68
Joined: Nov 2023
Gender: Male
Ethnicity: Arab
(12-25-2024, 01:30 PM)nomad01 Wrote: (12-25-2024, 12:55 PM)Genetics189291 Wrote: (12-25-2024, 09:30 AM)nomad01 Wrote: do you mean the " --extract snp.txt " command?
I tried this and it seemed not to work, I checked the files and it didn't execute the command, I also tried awk but no luck
it should be working, bed/bim/fam, plink2.exe and snp.txt should all be in the same folder
I’m gonna try when I get home