This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data = read.csv("~/data.csv") | |
colnames(data) <- c("contig", "pos", "t", "f", "value", "value2") | |
qplot(data=data, x=pos,y=1,color=value, alpha=I(1),geom="jitter",facets=contig ~ ., main="Position vs. % of Alleles out of Hardy-Weinberg Equilibrium (p<=0.05)", xlab="Chromosome Position (Bin Size=10Kb)",ylab="") + theme_bw() + theme(axis.title = element_text(size = 15), axis.ticks.y=element_blank(),axis.text.y=element_blank()) + scale_x_continuous() + guides(colour = guide_legend(override.aes = list(alpha = 1))) + scale_colour_gradient(low="white",high="red") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rice3k = read.csv("~/Downloads/rice3k_z.csv",header=F) | |
#chromosomes 1-12, excludes Sy and Un | |
rice3k.z = as.matrix(rice3k[,c(2:45,129:165,166:202,203:239,240:270,271:302,303:333,334:362,363:386,46:69,70:99,100:128)]) | |
rownames(rice3k.z) = rice3k[,1] | |
colnames(rice3k.z) = c(rep(1,44),rep(2,37),rep(3,37),rep(4,37),rep(5,31),rep(6,32),rep(7,31),rep(8,29),rep(9,24),rep(10,24),rep(11,30),rep(12,29)) | |
heatmap(rice3k.z,Colv=NA,ColSideColors=colnames(rice3k.z),labCol=F,scale="none",cexRow=0.1) | |
#2:45 #1 | |
#46:69 #10 | |
#70:99 #11 | |
#100:128 #12 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH | |
ind AS ( | |
-- count variants for each sample/ref/bin | |
SELECT | |
call.name AS sample, reference_name AS ref, CAST(start_position/1000000 AS INT64) AS bin, COUNT(call.name) AS n | |
FROM `bigquery-public-data.genomics_rice.Rice3K_DeepVariant_Os_Nipponbare_Reference_IRGSP_1_0` | |
JOIN UNNEST(call) AS call | |
JOIN UNNEST(alternate_bases) AS alt | |
WHERE alt.alt != '<*>' | |
GROUP BY sample, ref, bin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@example-rice-fastq | |
CTAAACCCTAAACCCTAAACCCTAAACCCTAAACCCTAAACCCTAAACCCTAAACCCTAACCCTAAACCCTAACCCTAAACCCTAAACCCTAAACCCTAAACCCTAAACCCTAAACAGCTGACAGTACGATAGATCCACGCGAGAGGAAC | |
+ | |
"##"""""#1'##.&&'#&(&'($&'+)""#"##"""$#&*&+),&$##$*-(,-1850*(&###&(*'&&),//($'*(%'#%##(('"$"&#"$')&$"$&+($#"$(%%"""""#$$"%##"%#%""'$#+*,$,*%%$%"&$++$" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH double_entry_book AS ( | |
-- debits | |
SELECT | |
ARRAY_TO_STRING(inputs.addresses, ",") AS address | |
, inputs.type | |
, -inputs.value AS value | |
FROM `bigquery-public-data.crypto_bitcoin_cash.transactions` JOIN UNNEST(inputs) AS inputs | |
WHERE block_timestamp_month = '2019-01-01' | |
UNION ALL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH double_entry_book AS ( | |
-- debits | |
SELECT | |
array_to_string(inputs.addresses, ",") as address | |
, inputs.type | |
, -inputs.value as value | |
, block_timestamp | |
FROM `bigquery-public-data.crypto_bitcoin.inputs` as inputs | |
UNION ALL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with | |
double_entry_book as ( | |
-- debits | |
select to_address as address, value as value, block_timestamp | |
from `bigquery-public-data.crypto_ethereum.traces` | |
where to_address is not null | |
and status = 1 | |
and (call_type not in ('delegatecall', 'callcode', 'staticcall') or call_type is null) | |
union all | |
-- credits |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with | |
double_entry_book as ( | |
-- debits | |
select to_address as address, CAST(value AS NUMERIC) as value, block_timestamp | |
from `bigquery-public-data.crypto_ethereum.token_transfers` | |
where from_address is not null and to_address is not null | |
and token_address = LOWER('0x408e41876cccdc0f92210600ef50372656052a38') --OMG | |
union all | |
-- credits | |
select from_address as address, -CAST(value AS NUMERIC) as value, block_timestamp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: gpl-3.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
txn_count, | |
COUNT(txn_count) AS num_addresses | |
FROM | |
( | |
SELECT | |
ARRAY_TO_STRING(inputs.addresses, '') AS addresses, | |
COUNT(DISTINCT `hash`) AS txn_count | |
FROM `crypto-etl-ethereum-dev.bitcoin_blockchain.transactions` AS txns | |
CROSS JOIN UNNEST(txns.inputs) AS inputs |