The GenArchivist Forum
need command to match snps - Printable Version

+- The GenArchivist Forum (https://genarchivist.net)
+-- Forum: Human Personal & Genealogical Genetics (https://genarchivist.net/forumdisplay.php?fid=1)
+--- Forum: Inquiries Corner (https://genarchivist.net/forumdisplay.php?fid=20)
+--- Thread: need command to match snps (/showthread.php?tid=1350)



need command to match snps - Genetics189291 - 12-24-2024

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


RE: need command to match snps - AimSmall - 12-24-2024

(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"


RE: need command to match snps - Genetics189291 - 12-24-2024

(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


RE: need command to match snps - AimSmall - 12-24-2024

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.)



RE: need command to match snps - AimSmall - 12-24-2024

plink --bfile data --extract snps.txt --recodeA


RE: need command to match snps - Genetics189291 - 12-24-2024

(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


RE: need command to match snps - AimSmall - 12-25-2024

Post your snp restriction file


RE: need command to match snps - nomad01 - 12-25-2024

do you mean the " --extract snp.txt " command?


RE: need command to match snps - Genetics189291 - 12-25-2024

(12-25-2024, 12:11 AM)AimSmall Wrote: Post your snp restriction file

will do


RE: need command to match snps - Genetics189291 - 12-25-2024

(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


RE: need command to match snps - nomad01 - 12-25-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


RE: need command to match snps - Genetics189291 - 12-25-2024

(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