Skip to content

Commit

Permalink
Support the latest FTDNA format
Browse files Browse the repository at this point in the history
Only outputs to 23andme at the moment and autodetection does not work
  • Loading branch information
teepean authored Aug 13, 2019
1 parent 19f815b commit d323283
Showing 1 changed file with 28 additions and 9 deletions.
37 changes: 28 additions & 9 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,19 @@ class Program
public const int TYPE_FTDNA2 = 7;
public const int TYPE_IYG = 8;
public const int TYPE_GSGT = 9;
public const int TYPE_FTDNA3 = 10;

public static string[] TYPE = { "ftdna", "23andme", "ancestry", "decodeme", "geno2", "plink", "eigenstrat", "ftdna2", "iyg", "gsgt" };
public static string[] TYPE = { "ftdna", "23andme", "ancestry", "decodeme", "geno2", "plink", "eigenstrat", "ftdna2", "iyg", "gsgt", "ftdna3" };

public static void printLogo()
{
Console.WriteLine("+-------------------------------------------+");
Console.WriteLine("| Product: Autosomal DNA Converter |");
Console.WriteLine("| Website: www.y-str.org |");
Console.WriteLine("| Developer: Felix Immanuel <[email protected]> |");
Console.WriteLine("| Version: 1.8 |");
Console.WriteLine("| Build Date: 8-May-2019 |");
Console.WriteLine("| Felix Immanuel <[email protected]> |");
Console.WriteLine("| Teemu Nätkinniemi <[email protected]> |");
Console.WriteLine("| Version: 2.0 |");
Console.WriteLine("| Build Date: 13-Aug-2019 |");
Console.WriteLine("+-------------------------------------------+");
}

Expand All @@ -41,7 +43,7 @@ public static void printSyntax()
Console.WriteLine("\taconv <in-file> <out-file> [options]");
Console.WriteLine();
Console.WriteLine("Optional Parameters:");
Console.WriteLine(" -i [Input Type] - Value can be detect,ftdna,ftdna2,23andme,decodeme,ancestry, eigenstrat, iyg, gsgt or geno2. ");
Console.WriteLine(" -i [Input Type] - Value can be detect,ftdna,ftdna2,23andme,decodeme,ancestry, eigenstrat, iyg, gsgt, ftdna3 or geno2. ");
Console.WriteLine(" This values is optional and not required. Use only if ");
Console.WriteLine(" autodetect fails. Default is detect");
Console.WriteLine(" -o [Output Type] - Value can be ftdna,23andme,ancestry,geno2, plink or eigenstrat.");
Expand Down Expand Up @@ -100,6 +102,8 @@ static void Main(string[] args)
in_type = TYPE_FTDNA;
else if (args[i + 1].ToLower() == "ftdna2")
in_type = TYPE_FTDNA2;
else if (args[i + 1].ToLower() == "ftdna3")
in_type = TYPE_FTDNA3;
else if (args[i + 1].ToLower() == "23andme")
in_type = TYPE_23ANDME;
else if (args[i + 1].ToLower() == "ancestry")
Expand Down Expand Up @@ -262,7 +266,19 @@ private static int updateMasterSNPlist(string infile,string outfile, int intype,
pos = data[2];
genotype = data[3] + data[4];
}

if (intype == TYPE_FTDNA3)
{
if (!line.StartsWith("rs"))
{
continue;
}
tLine = line.Replace("\"", "");
data = line.Split(",".ToCharArray());
rsid = data[0];
chr = data[1];
pos = data[2];
genotype = data[3];
}
if (intype == TYPE_23ANDME)
{
if (line.StartsWith("#") || line.Trim() == "")
Expand Down Expand Up @@ -357,9 +373,10 @@ private static int updateMasterSNPlist(string infile,string outfile, int intype,

if (outtype == TYPE_FTDNA)
{
if (chr == "Y" || chr == "M" || chr == "MT" || chr == "24" || chr == "25" || chr == "0" || chr == "XY")
if (chr == "Y" || chr == "M" || chr == "MT" || chr == "24" || chr == "25" || chr == "0" || chr == "XY" || chr == "26")
continue;
if (genotype == "II" || genotype == "DI" || genotype == "DD")
continue;

if (chr == "23")
chr = "X";
else if (chr == "24")
Expand All @@ -368,7 +385,9 @@ private static int updateMasterSNPlist(string infile,string outfile, int intype,
}
else if (outtype == TYPE_23ANDME)
{
if (chr == "0" || chr == "XY")
if (chr == "0" || chr == "XY" || chr == "26")
continue;
if (genotype == "II" || genotype == "DI" || genotype == "DD")
continue;
if (chr == "23")
chr = "X";
Expand Down

0 comments on commit d323283

Please sign in to comment.