Check for new replies
need command to match snps
#1
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
Reply
#2
(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
Reply
#3
(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
Reply
#4
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.)
Reply
#5
plink --bfile data --extract snps.txt --recodeA
Reply
#6
(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
Reply
#7
Post your snp restriction file
Reply
#8
do you mean the " --extract snp.txt " command?
Reply
#9
(12-25-2024, 12:11 AM)AimSmall Wrote: Post your snp restriction file

will do
Reply
#10
(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
Reply
#11
(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
Reply
#12
(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
Reply

Check for new replies

Forum Jump:


Users browsing this thread: 1 Guest(s)