Arduino RFID-RC522 transmit UID to Waspmote using UART, then send UID to Raspberry Pi with DRAGINO LoRa shield through LoRa P2P, then insert record into MySQL.
It is quite complex solution as the environmental constrains. My DB server is in a lab and the distance from the door to the lab is quite far, so the WiFi cannot reach. So the only fast and cheap solution is to use LoRa, lucky we brought them.
Arduino RFID-RC522 read UID
The code & connection diagram for RFID-RC522 of Arduino is very easy to find in the internet, has plenty of them.
UART communication between Arduino & Waspmote
Since we only need to transmit the UID to Waspmote, does not require feedback, so we only need to connect the TX pin of Arudino to the RX pin of the Waspmote. However, the primary serial port is used by the LoRa, so we need to use the auxiliary serial port, Waspmote does have 2 auxiliary serial ports, thanks to that. Just need to modify the Radio P2P example - Sending packets of the Waspmote LoRa example and add a few line of code, as below.
#include "WaspUART.h"
WaspUART uart = WaspUART();
void setup()
{
USB.ON();
USB.println(F("Radio P2P example - Sending packets\n"));
// module setup
error = radioModuleSetup();
// Check status
if (error == 0)
{
USB.println(F("Module configured OK"));
}
else
{
USB.println(F("Module configured ERROR"));
}
uart.setBaudrate(9600);
uart.setUART(1);
uart.beginUART();
Utils.setMuxAux1();
beginSerial(9600,1);
}
void loop()
{
uart.readBuffer(sizeof(uart._buffer));
if (uart._length > 0)
{
for (int i = 0; i < 8; i++)
{
uid[i * 2 + 1] = uart._buffer[i];
}
// Send packet
error = LoRaWAN.sendRadio(uid);
// Check status
if (error == 0)
{
USB.println(F("--> Packet sent OK"));
}
else
{
USB.print(F("Error waiting for packets. error = "));
USB.println(error, DEC);
}
}
delay(1000);
}
#
#
#
Waspmote send UID to Raspberry Pi with DRAGINO LoRa shield through LoRa P2P
To setup, I mainly followed the instructions from Use Lora/GPS HAT + RaspberryPi to set up a Lora Node.
Use ''raspi-config'' to ensure that SPI can be used on RPi;
Use ''git clone git://git.drogon.net/wiringPi'' to install the GPIO access library written in C for the BCM2835 used in the Raspberry Pi;
Get the single channel LoRa Gateway source code from HERE.
Edit the ''main.cpp''.
Since I am not going to send any data to the internet, I have made quite modifications, I removed all the codes that used to communicate to the TTN network and debug printings. But, I didn''t change any of the logic, the only thing I add, I will discuss it next.
Raspberry Pi insert record into MySQL once received.
Since the code using for receiving is written in C, so it will be quite troublesome to do SQL operations. My solution is to use python script to do the insertion. In order for C to execute Python script, you need to do the following.
Run sudo apt-get install python-dev If you don''t have Python.h, which usually not necessary.
Modify the code.
#include <Python.h>
#add the code snippet after successfully received in the receivePkt(char *payload) function
FILE *cp = fopen("insertUID.py", "r");
Py_Initialize();
char *argv[2];
argv[0] = "insert";
argv[1] = payload;
PySys_SetArgv(2, argv);
int rc = PyRun_SimpleFile(cp, "insertUID.py");
fclose(cp);
Py_Finalize();
Twin study是什么?优势是什么?用于估计heritability。本质就是控制变量,同卵双胞胎share了同样的遗传物质,所以他们的表型差异完全可以归结为非genetic的环境变异。"identical" or monozygotic (MZ) twins share essentially 100% of their genes, which means that most differences between the twins (such as height, susceptibility to boredom, intelligence, depression, etc.) are due to experiences that one twin has but not the other twin.
GWAS里面cohort study是什么?The importance of cohort studies in the postGWAS era
burden testing of rare variant是什么?以基因为单位,检验rare variant在case和control中的差异是否显著。
10 Years of GWAS Discovery: Biology, Function, and Translation
之前的第一个五年总结:Five Years of GWAS Discovery
The GWAS is an experimental design used to detect associations between genetic variants and traits in samples from populations. 可以说genetic variants,也可以说gene,或者loci。
The path from GWAS to biology is not straightforward because an association between a genetic variant at a genomic locus and a trait is not directly informative with respect to the target gene or the mechanism whereby the variant is associated with phenotypic differences.
The statistical power to detect associations between DNA variants and a trait depends on the experimental sample size, the distribution of effect sizes of (unknown) causal genetic variants that are segregating in the population, the frequency of those variants, and the LD between observed genotyped DNA variants and the unknown causal variants.
In addition, other genome-wide scans, such as WES and WGS studies, allow testing for a burden of rare variants across shared functional units (e.g., genes) in a way that is not accessible to GWASs.
Burden Testing of Rare Variants Identified through Exome Sequencing via Publicly Available Control Data
新的分析方法学New Analysis Methodology Underpinning New Discovery
GWAS的后续研究主要有以下四个方面:
(1) methods of better modeling population structure and relatedness between individuals in a sample during association analyses,28–34 (2) methods of detecting novel variants and gene loci on the basis of GWAS summary statistics, 35–37 (3) methods of estimating and partitioning genetic (co)variance,38,39 and (4) methods of inferring causality.40–42
常见变异解释了大部分的累积遗传变异Common Variants Together Tag a Substantial Proportion of Additive Genetic Variance