conflict_resolution
stringlengths 27
16k
|
---|
<<<<<<<
import org.junit.contrib.truth.subjects.DefaultSubject;
import org.junit.contrib.truth.subjects.IntSubject;
=======
import org.junit.contrib.truth.subjects.IntegerSubject;
>>>>>>>
import org.junit.contrib.truth.subjects.DefaultSubject;
import org.junit.contrib.truth.subjects.IntegerSubject; |
<<<<<<<
public class IntegerSubject extends Subject<IntegerSubject, Long> {
=======
/**
* Propositions for Integral numeric subjects
*
* @author David Saff
* @author Christian Gruber ([email protected])
*/
public class IntegerSubject extends Subject<Long> {
>>>>>>>
/**
* Propositions for Integral numeric subjects
*
* @author David Saff
* @author Christian Gruber ([email protected])
*/
public class IntegerSubject extends Subject<IntegerSubject, Long> { |
<<<<<<<
EXPECT.that("abc").contains("x")
.and().contains("y")
.and().contains("z");
=======
EXPECT.that("abc").contains("x").contains("y").contains("z");
EXPECT.that(Arrays.asList(new String[]{"a", "b", "c"})).containsAnyOf("a", "c");
>>>>>>>
EXPECT.that("abc").contains("x")
.and().contains("y")
.and().contains("z");
EXPECT.that(Arrays.asList(new String[]{"a", "b", "c"})).containsAnyOf("a", "c"); |
<<<<<<<
public And<IntegerSubject> isInclusivelyInRange(int lower, int upper) {
if (lower > upper) {
throw new IllegalArgumentException(String.format(
RANGE_BOUNDS_OUT_OF_ORDER_MSG, lower, upper));
}
=======
public Subject<Long> isInclusivelyInRange(long lower, long upper) {
ensureOrderedBoundaries(lower, upper);
>>>>>>>
public And<IntegerSubject> isInclusivelyInRange(long lower, long upper) {
ensureOrderedBoundaries(lower, upper);
<<<<<<<
public And<IntegerSubject> isBetween(int lower, int upper) {
if (lower > upper) {
throw new IllegalArgumentException(String.format(
RANGE_BOUNDS_OUT_OF_ORDER_MSG, lower, upper));
}
=======
public Subject<Long> isBetween(long lower, long upper) {
ensureOrderedBoundaries(lower, upper);
>>>>>>>
public And<IntegerSubject> isBetween(long lower, long upper) {
ensureOrderedBoundaries(lower, upper);
<<<<<<<
public And<IntegerSubject> isEqualTo(Integer other) {
=======
/**
* Guards against inverted lower/upper boundaries, and throws if
* they are so inverted.
*/
private void ensureOrderedBoundaries(long lower, long upper) {
if (lower > upper) {
throw new IllegalArgumentException(String.format(
RANGE_BOUNDS_OUT_OF_ORDER_MSG, lower, upper));
}
}
public Subject<Long> isEqualTo(Integer other) {
>>>>>>>
/**
* Guards against inverted lower/upper boundaries, and throws if
* they are so inverted.
*/
private void ensureOrderedBoundaries(long lower, long upper) {
if (lower > upper) {
throw new IllegalArgumentException(String.format(
RANGE_BOUNDS_OUT_OF_ORDER_MSG, lower, upper));
}
}
public And<IntegerSubject> isEqualTo(Integer other) { |
<<<<<<<
public class PhotoGridAdapter extends RecyclerView.Adapter<PhotoGridAdapter.PhotoViewHolder> implements View.OnClickListener, View.OnLongClickListener {
=======
public class PhotoGridAdapter extends RecyclerView.Adapter<PhotoGridAdapter.PhotoViewHolder>{
>>>>>>>
public class PhotoGridAdapter extends RecyclerView.Adapter<PhotoGridAdapter.PhotoViewHolder> {
<<<<<<<
@Override
public void onClick(View v) {
if (v.getTag() != null) {
int index = (Integer) v.getTag();
toggleSelected(index);
}
}
@Override
public boolean onLongClick(View v) {
if (v.getTag() != null) {
int index = (Integer) v.getTag();
toggleSelected(index);
mContext.mList.setDragSelectActive(true, index);
}
return false;
}
=======
>>>>>>> |
<<<<<<<
=======
// non-polymorphic type variables from bindings in closure
YType closureVars[] = NO_PARAM;
int closureVarCount;
void restrictArg(YType type, boolean active) {
if (type.seen)
return;
if (type.field >= FIELD_NON_POLYMORPHIC)
active = true; // anything under mutable field is evil
YType t = type.deref();
int tt = t.type;
if (tt != VAR) {
type.seen = true;
for (int i = t.param.length; --i >= 0;)
// array/hash value is in mutable store and evil
restrictArg(t.param[i], active || i == 0 &&
(/*tt == FUN ||*/ tt == MAP && t.param[1] != NO_TYPE));
type.seen = false;
} else if (active) {
if (closureVars.length <= closureVarCount) {
YType[] tmp = new YType[closureVars.length * 3 / 2 + 32];
System.arraycopy(closureVars, 0, tmp, 0, closureVarCount);
closureVars = tmp;
}
closureVars[closureVarCount++] = t;
}
}
>>>>>>> |
<<<<<<<
shell = new CypherShell(linePrinter, new PrettyConfig(Format.PLAIN, true, 1000), false);
shell.connect(new ConnectionConfig("bolt://", "localhost", 7687, "neo4j", "neo", false, ABSENT_DB_NAME));
=======
shell = new CypherShell(linePrinter, new PrettyConfig(Format.PLAIN, true, 1000));
connect( "neo" );
>>>>>>>
shell = new CypherShell(linePrinter, new PrettyConfig(Format.PLAIN, true, 1000), false);
connect( "neo" ); |
<<<<<<<
import org.junit.Ignore;
import org.junit.Rule;
=======
import org.junit.Before;
>>>>>>>
import org.junit.Before;
import org.junit.Rule;
<<<<<<<
ShellAndConnection sac = getShell( cliArgs );
CypherShell shell = sac.shell;
ConnectionConfig connectionConfig = sac.connectionConfig;
=======
Logger logger = new AnsiLogger(cliArgs.getDebugMode());
PrettyConfig prettyConfig = new PrettyConfig(cliArgs);
connectionConfig = new ConnectionConfig(
cliArgs.getScheme(),
cliArgs.getHost(),
cliArgs.getPort(),
cliArgs.getUsername(),
cliArgs.getPassword(),
cliArgs.getEncryption());
shell = new CypherShell(logger, prettyConfig);
}
>>>>>>>
ShellAndConnection sac = getShell( cliArgs );
shell = sac.shell;
connectionConfig = sac.connectionConfig;
}
<<<<<<<
@Test
public void wrongPortWithBolt() throws Exception
{
// given
Main main = getMain( new ByteArrayOutputStream() );
CliArgs cliArgs = new CliArgs();
cliArgs.setScheme( "bolt://", "" );
cliArgs.setPort( 1234 );
ShellAndConnection sac = getShell( cliArgs );
CypherShell shell = sac.shell;
ConnectionConfig connectionConfig = sac.connectionConfig;
exception.expect( ServiceUnavailableException.class );
exception.expectMessage( "Unable to connect to localhost:1234, ensure the database is running and that there is a working network connection to it" );
main.connectMaybeInteractively( shell, connectionConfig, true );
}
@Test
public void wrongPortWithNeo4j() throws Exception
{
// given
Main main = getMain( new ByteArrayOutputStream() );
CliArgs cliArgs = new CliArgs();
cliArgs.setScheme( "neo4j://", "" );
cliArgs.setPort( 1234 );
ShellAndConnection sac = getShell( cliArgs );
CypherShell shell = sac.shell;
ConnectionConfig connectionConfig = sac.connectionConfig;
exception.expect( ServiceUnavailableException.class );
exception.expectMessage( "Unable to connect to database, ensure the database is running and that there is a working network connection to it" );
main.connectMaybeInteractively( shell, connectionConfig, true );
}
private Main getMain( ByteArrayOutputStream baos )
{
// what the user inputs when prompted
String inputString = String.format( "neo4j%nneo%n" );
InputStream inputStream = new ByteArrayInputStream( inputString.getBytes() );
PrintStream ps = new PrintStream( baos );
return new Main( inputStream, ps );
}
private ShellAndConnection getShell( CliArgs cliArgs )
{
Logger logger = new AnsiLogger( cliArgs.getDebugMode() );
PrettyConfig prettyConfig = new PrettyConfig( cliArgs );
ConnectionConfig connectionConfig = new ConnectionConfig(
cliArgs.getScheme(),
cliArgs.getHost(),
cliArgs.getPort(),
cliArgs.getUsername(),
cliArgs.getPassword(),
cliArgs.getEncryption(),
cliArgs.getDatabase() );
return new ShellAndConnection( new CypherShell( logger, prettyConfig, true ), connectionConfig );
}
=======
@Test
public void promptsSilentlyOnWrongAuthenticationIfOutputRedirected() throws Exception {
// when
assertEquals("", connectionConfig.username());
assertEquals("", connectionConfig.password());
main.connectMaybeInteractively(shell, connectionConfig, true, false);
// then
// should be connected
assertTrue(shell.isConnected());
// should have prompted silently and set the username and password
assertEquals("neo4j", connectionConfig.username());
assertEquals("neo", connectionConfig.password());
String out = baos.toString();
assertEquals( "", out );
}
>>>>>>>
@Test
public void promptsSilentlyOnWrongAuthenticationIfOutputRedirected() throws Exception {
// when
assertEquals("", connectionConfig.username());
assertEquals("", connectionConfig.password());
main.connectMaybeInteractively(shell, connectionConfig, true, false);
// then
// should be connected
assertTrue(shell.isConnected());
// should have prompted silently and set the username and password
assertEquals("neo4j", connectionConfig.username());
assertEquals("neo", connectionConfig.password());
String out = baos.toString();
assertEquals( "", out );
}
@Test
public void wrongPortWithBolt() throws Exception
{
// given
CliArgs cliArgs = new CliArgs();
cliArgs.setScheme( "bolt://", "" );
cliArgs.setPort( 1234 );
ShellAndConnection sac = getShell( cliArgs );
CypherShell shell = sac.shell;
ConnectionConfig connectionConfig = sac.connectionConfig;
exception.expect( ServiceUnavailableException.class );
exception.expectMessage( "Unable to connect to localhost:1234, ensure the database is running and that there is a working network connection to it" );
main.connectMaybeInteractively( shell, connectionConfig, true, true );
}
@Test
public void wrongPortWithNeo4j() throws Exception
{
// given
CliArgs cliArgs = new CliArgs();
cliArgs.setScheme( "neo4j://", "" );
cliArgs.setPort( 1234 );
ShellAndConnection sac = getShell( cliArgs );
CypherShell shell = sac.shell;
ConnectionConfig connectionConfig = sac.connectionConfig;
exception.expect( ServiceUnavailableException.class );
exception.expectMessage( "Unable to connect to database, ensure the database is running and that there is a working network connection to it" );
main.connectMaybeInteractively( shell, connectionConfig, true, true );
}
private ShellAndConnection getShell( CliArgs cliArgs )
{
Logger logger = new AnsiLogger( cliArgs.getDebugMode() );
PrettyConfig prettyConfig = new PrettyConfig( cliArgs );
ConnectionConfig connectionConfig = new ConnectionConfig(
cliArgs.getScheme(),
cliArgs.getHost(),
cliArgs.getPort(),
cliArgs.getUsername(),
cliArgs.getPassword(),
cliArgs.getEncryption(),
cliArgs.getDatabase() );
return new ShellAndConnection( new CypherShell( logger, prettyConfig, true ), connectionConfig );
} |
<<<<<<<
CopyMode, CopyModeDesc, PatternTerminal, CraftingPattern, ProcessingPattern, Crafts, Creates, And, With, MolecularAssembler,
StoredPower, MaxPower, RequiredPower, Efficiency, InWorldCrafting, inWorldFluix, inWorldPurification, inWorldSingularity,
OfSecondOutput, NoSecondOutput, RFTunnel, Stores, Next, SelectAmount, Lumen, Empty;
=======
StoredPower, MaxPower, RequiredPower, Efficiency, InWorldCrafting, inWorldFluix, inWorldPurificationCertus, inWorldPurificationNether, inWorldPurificationFluix, inWorldSingularity, OfSecondOutput, NoSecondOutput, RFTunnel;
>>>>>>>
CopyMode, CopyModeDesc, PatternTerminal, CraftingPattern, ProcessingPattern, Crafts, Creates, And, With, MolecularAssembler,
StoredPower, MaxPower, RequiredPower, Efficiency, InWorldCrafting, inWorldFluix, inWorldPurificationCertus, inWorldPurificationNether, inWorldPurificationFluix, inWorldSingularity,
OfSecondOutput, NoSecondOutput, RFTunnel, Stores, Next, SelectAmount, Lumen, Empty; |
<<<<<<<
public static ItemStack extractItemsByRecipe(IEnergySource energySrc, BaseActionSource mySrc, IMEMonitor<IAEItemStack> src, World w, IRecipe r,
ItemStack output, InventoryCrafting ci, ItemStack providedTemplate, int slot, IItemList<IAEItemStack> aitems)
{
if ( energySrc.extractAEPower( 1, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > 0.9 )
{
if ( providedTemplate == null )
return null;
AEItemStack ae_req = AEItemStack.create( providedTemplate );
ae_req.setStackSize( 1 );
IAEItemStack ae_ext = src.extractItems( ae_req, Actionable.MODULATE, mySrc );
if ( ae_ext != null )
{
ItemStack extracted = ae_ext.getItemStack();
if ( extracted != null )
{
energySrc.extractAEPower( 1, Actionable.MODULATE, PowerMultiplier.CONFIG );
return extracted;
}
}
if ( aitems != null && (ae_req.isOre() || providedTemplate.hasTagCompound() || providedTemplate.isItemStackDamageable()) )
{
for (IAEItemStack x : aitems)
{
ItemStack sh = x.getItemStack();
if ( (Platform.isSameItemType( providedTemplate, sh ) || ae_req.sameOre( x )) && !Platform.isSameItem( sh, output ) )
{ // Platform.isSameItemType( sh, providedTemplate )
ItemStack cp = Platform.cloneItemStack( sh );
cp.stackSize = 1;
ci.setInventorySlotContents( slot, cp );
if ( r.matches( ci, w ) && Platform.isSameItem( r.getCraftingResult( ci ), output ) )
{
IAEItemStack ex = src.extractItems( AEItemStack.create( cp ), Actionable.MODULATE, mySrc );
if ( ex != null )
{
energySrc.extractAEPower( 1, Actionable.MODULATE, PowerMultiplier.CONFIG );
return ex.getItemStack();
}
}
ci.setInventorySlotContents( slot, providedTemplate );
}
}
}
}
return null;
}
=======
public static boolean canAccess(AENetworkProxy gridProxy, BaseActionSource src)
{
try
{
if ( src.isPlayer() )
{
return gridProxy.getSecurity().hasPermission( ((PlayerSource) src).player, SecurityPermissions.BUILD );
}
else if ( src.isMachine() )
{
IActionHost te = ((MachineSource) src).via;
int playerID = te.getActionableNode().getPlayerID();
return gridProxy.getSecurity().hasPermission( playerID, SecurityPermissions.BUILD );
}
else
return false;
}
catch (GridAccessException gae)
{
return false;
}
}
>>>>>>>
public static ItemStack extractItemsByRecipe(IEnergySource energySrc, BaseActionSource mySrc, IMEMonitor<IAEItemStack> src, World w, IRecipe r,
ItemStack output, InventoryCrafting ci, ItemStack providedTemplate, int slot, IItemList<IAEItemStack> aitems)
{
if ( energySrc.extractAEPower( 1, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > 0.9 )
{
if ( providedTemplate == null )
return null;
AEItemStack ae_req = AEItemStack.create( providedTemplate );
ae_req.setStackSize( 1 );
IAEItemStack ae_ext = src.extractItems( ae_req, Actionable.MODULATE, mySrc );
if ( ae_ext != null )
{
ItemStack extracted = ae_ext.getItemStack();
if ( extracted != null )
{
energySrc.extractAEPower( 1, Actionable.MODULATE, PowerMultiplier.CONFIG );
return extracted;
}
}
if ( aitems != null && (ae_req.isOre() || providedTemplate.hasTagCompound() || providedTemplate.isItemStackDamageable()) )
{
for (IAEItemStack x : aitems)
{
ItemStack sh = x.getItemStack();
if ( (Platform.isSameItemType( providedTemplate, sh ) || ae_req.sameOre( x )) && !Platform.isSameItem( sh, output ) )
{ // Platform.isSameItemType( sh, providedTemplate )
ItemStack cp = Platform.cloneItemStack( sh );
cp.stackSize = 1;
ci.setInventorySlotContents( slot, cp );
if ( r.matches( ci, w ) && Platform.isSameItem( r.getCraftingResult( ci ), output ) )
{
IAEItemStack ex = src.extractItems( AEItemStack.create( cp ), Actionable.MODULATE, mySrc );
if ( ex != null )
{
energySrc.extractAEPower( 1, Actionable.MODULATE, PowerMultiplier.CONFIG );
return ex.getItemStack();
}
}
ci.setInventorySlotContents( slot, providedTemplate );
}
}
}
}
return null;
}
public static boolean canAccess(AENetworkProxy gridProxy, BaseActionSource src)
{
try
{
if ( src.isPlayer() )
{
return gridProxy.getSecurity().hasPermission( ((PlayerSource) src).player, SecurityPermissions.BUILD );
}
else if ( src.isMachine() )
{
IActionHost te = ((MachineSource) src).via;
int playerID = te.getActionableNode().getPlayerID();
return gridProxy.getSecurity().hasPermission( playerID, SecurityPermissions.BUILD );
}
else
return false;
}
catch (GridAccessException gae)
{
return false;
}
} |
<<<<<<<
AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand( f1, f1, f1 );
MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept( vec3, vec31 );
=======
AxisAlignedBB boundingBox = entity1.boundingBox.expand( (double) f1, (double) f1, (double) f1 );
MovingObjectPosition movingObjectPosition = boundingBox.calculateIntercept( vec3, vec31 );
>>>>>>>
AxisAlignedBB boundingBox = entity1.boundingBox.expand( f1, f1, f1 );
MovingObjectPosition movingObjectPosition = boundingBox.calculateIntercept( vec3, vec31 );
<<<<<<<
AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand( f1, f1, f1 );
MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept( vec3, vec31 );
=======
AxisAlignedBB boundingBox = entity1.boundingBox.expand( (double) f1, (double) f1, (double) f1 );
MovingObjectPosition movingObjectPosition = boundingBox.calculateIntercept( vec3, vec31 );
>>>>>>>
AxisAlignedBB boundingBox = entity1.boundingBox.expand( f1, f1, f1 );
MovingObjectPosition movingObjectPosition = boundingBox.calculateIntercept( vec3, vec31 ); |
<<<<<<<
public static ItemStack getContainerItem(ItemStack stackInSlot)
{
if ( stackInSlot == null )
return null;
Item i = stackInSlot.getItem();
if ( i == null || !i.hasContainerItem( stackInSlot ) )
{
if ( stackInSlot.stackSize > 1 )
{
stackInSlot.stackSize--;
return stackInSlot;
}
return null;
}
ItemStack ci = i.getContainerItem( stackInSlot.copy() );
if ( ci.isItemStackDamageable() && ci.getItemDamage() == ci.getMaxDamage() )
ci = null;
return ci;
}
=======
public static void notifyBlocksOfNeighbors(World worldObj, int xCoord, int yCoord, int zCoord)
{
if ( !worldObj.isRemote )
TickHandler.instance.addCallable( worldObj, new BlockUpdate( worldObj, xCoord, yCoord, zCoord ) );
}
>>>>>>>
public static ItemStack getContainerItem(ItemStack stackInSlot)
{
if ( stackInSlot == null )
return null;
Item i = stackInSlot.getItem();
if ( i == null || !i.hasContainerItem( stackInSlot ) )
{
if ( stackInSlot.stackSize > 1 )
{
stackInSlot.stackSize--;
return stackInSlot;
}
return null;
}
ItemStack ci = i.getContainerItem( stackInSlot.copy() );
if ( ci.isItemStackDamageable() && ci.getItemDamage() == ci.getMaxDamage() )
ci = null;
return ci;
}
public static void notifyBlocksOfNeighbors(World worldObj, int xCoord, int yCoord, int zCoord)
{
if ( !worldObj.isRemote )
TickHandler.instance.addCallable( worldObj, new BlockUpdate( worldObj, xCoord, yCoord, zCoord ) );
} |
<<<<<<<
import com.beust.jcommander.*;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
=======
import com.beust.jcommander.*;
import org.opencb.biodata.models.variant.VariantSource;
import org.opencb.biodata.models.variant.VariantStudy;
>>>>>>>
import com.beust.jcommander.*;
import org.opencb.biodata.models.variant.VariantSource;
import org.opencb.biodata.models.variant.VariantStudy;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
<<<<<<<
interface Command {
}
class GeneralParameters implements Command {
@Parameter(names = { "--properties-path" }, description = "Properties path")
String propertiesPath = null;
@Parameter(names = { "--sm-name" }, description = "StorageManager class name. (Must be in the classpath)")
String storageManagerName;
@Parameter(names = { "-h", "--help" }, description = "Print this help", help = true)
boolean help;
@DynamicParameter(names = "-D", description = "Dynamic parameters go here", hidden = true)
private Map<String, String> params = new HashMap<String, String>();
@Override
public String toString() {
String paramsString = "{";
for(Map.Entry<String, String> e : params.entrySet()){
paramsString += e.getKey()+" = "+e.getValue() + ", ";
}
paramsString+="}";
return "GeneralParameters{" +
"propertiesPath='" + propertiesPath + '\'' +
", storageManagerName='" + storageManagerName + '\'' +
", help=" + help +
", params=" + paramsString +
'}';
}
}
@Parameters(commandNames = { "create-accessions" }, commandDescription = "Creates accession IDs for an input file")
=======
interface Command {
}
@Parameters(commandNames = {"create-accessions"}, commandDescription = "Creates accession IDs for an input file")
>>>>>>>
interface Command {
}
class GeneralParameters implements Command {
@Parameter(names = { "--properties-path" }, description = "Properties path")
String propertiesPath = null;
@Parameter(names = { "--sm-name" }, description = "StorageManager class name. (Must be in the classpath)")
String storageManagerName;
@Parameter(names = { "-h", "--help" }, description = "Print this help", help = true)
boolean help;
@DynamicParameter(names = "-D", description = "Dynamic parameters go here", hidden = true)
private Map<String, String> params = new HashMap<String, String>();
@Override
public String toString() {
String paramsString = "{";
for(Map.Entry<String, String> e : params.entrySet()){
paramsString += e.getKey()+" = "+e.getValue() + ", ";
}
paramsString+="}";
return "GeneralParameters{" +
"propertiesPath='" + propertiesPath + '\'' +
", storageManagerName='" + storageManagerName + '\'' +
", help=" + help +
", params=" + paramsString +
'}';
}
}
@Parameters(commandNames = {"create-accessions"}, commandDescription = "Creates accession IDs for an input file")
<<<<<<<
// @Parameter(names = {"--study-alias"}, description = "Unique ID for the study where the file is classified", required = true, arity = 1)
// String studyId;
// @Parameter(names = {"--plain"}, description = "Do not compress the output (optional)", required = false)
// boolean plain = false;
@Parameter(names = {"-b", "--backend"}, description = "Storage to save files into: hbase (default) or hive (pending)", required = false, arity = 1)
String backend = "hbase";
@Parameter(names = {"-c", "--credentials"}, description = "Path to the file where the backend credentials are stored", required = true, arity = 1)
String credentials;
@Parameter(names = {"--include-coverage"}, description = "Save coverage information (optional)", required = false, arity = 0)
boolean includeCoverage = false;
=======
@Parameter(names = {"-t", "--study-type"}, description = "Study type (optional)", arity = 1)
VariantStudy.StudyType studyType = VariantStudy.StudyType.CASE_CONTROL;
>>>>>>>
// @Parameter(names = {"--study-alias"}, description = "Unique ID for the study where the file is classified", required = true, arity = 1)
// String studyId;
// @Parameter(names = {"--plain"}, description = "Do not compress the output (optional)", required = false)
// boolean plain = false;
@Parameter(names = {"-b", "--backend"}, description = "Storage to save files into: hbase (default) or hive (pending)", required = false, arity = 1)
String backend = "hbase";
@Parameter(names = {"-c", "--credentials"}, description = "Path to the file where the backend credentials are stored", required = true, arity = 1)
String credentials;
@Parameter(names = {"--include-coverage"}, description = "Save coverage information (optional)", required = false, arity = 0)
boolean includeCoverage = false; |
<<<<<<<
import java.util.*;
=======
import java.util.Arrays;
import java.util.Collections;
import java.util.Map;
>>>>>>>
import java.util.*;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map; |
<<<<<<<
public OpenCGAResult<Long> count(Query query, String user, StudyAclEntry.StudyPermissions studyPermission) throws CatalogDBException {
=======
public QueryResult<Long> count(long studyUid, Query query, String user, StudyAclEntry.StudyPermissions studyPermission)
throws CatalogDBException {
>>>>>>>
public OpenCGAResult<Long> count(long studyUid, Query query, String user, StudyAclEntry.StudyPermissions studyPermission)
throws CatalogDBException {
<<<<<<<
public OpenCGAResult<User> get(Query query, QueryOptions options, String user) throws CatalogDBException {
=======
public QueryResult<User> get(long studyUid, Query query, QueryOptions options, String user) throws CatalogDBException {
>>>>>>>
public OpenCGAResult<User> get(long studyUid, Query query, QueryOptions options, String user) throws CatalogDBException {
<<<<<<<
public OpenCGAResult nativeGet(Query query, QueryOptions options, String user)
throws CatalogDBException, CatalogAuthorizationException {
=======
public QueryResult nativeGet(long studyUid, Query query, QueryOptions options, String user)
throws CatalogDBException, CatalogAuthorizationException {
>>>>>>>
public OpenCGAResult nativeGet(long studyUid, Query query, QueryOptions options, String user)
throws CatalogDBException, CatalogAuthorizationException { |
<<<<<<<
import org.opencb.biodata.models.variant.Variant;
=======
import org.opencb.biodata.models.variant.Variant;
import org.opencb.biodata.models.variant.VariantSource;
>>>>>>>
import org.opencb.biodata.models.variant.Variant;
import org.opencb.biodata.models.variant.VariantSource;
<<<<<<<
dbAdaptor = getVariantStorageManager().getDBAdaptor(DB_NAME);
URI stats = vsm.createStats(dbAdaptor, outputUri.resolve("cohort1.cohort2.stats"), cohorts, cohortIds, studyConfiguration,
options);
=======
URI stats = vsm.createStats(dbAdaptor, outputUri.resolve("cohort1.cohort2.stats"), cohorts, cohortIds, studyConfiguration, options);
>>>>>>>
dbAdaptor = getVariantStorageManager().getDBAdaptor(DB_NAME);
URI stats = vsm.createStats(dbAdaptor, outputUri.resolve("cohort1.cohort2.stats"), cohorts, cohortIds, studyConfiguration,
options);
<<<<<<<
queryResult = dbAdaptor.get(new Query(VariantDBAdaptor.VariantQueryParams.STATS_MAF.key(), "1000g:cohort2>0.2;1000g:cohort1<0.2")
, null);
assertEquals(75, queryResult.getNumResults());
=======
queryResult = dbAdaptor.get(new Query(VariantDBAdaptor.VariantQueryParams.STATS_MAF.key(), "1000g:cohort2>0.2;1000g:cohort1<0.2"), null);
assertEquals(74, queryResult.getNumResults());
>>>>>>>
queryResult = dbAdaptor.get(new Query(VariantDBAdaptor.VariantQueryParams.STATS_MAF.key(), "1000g:cohort2>0.2;1000g:cohort1<0.2")
, null);
queryResult = dbAdaptor.get(new Query(VariantDBAdaptor.VariantQueryParams.STATS_MAF.key(), "1000g:cohort2>0.2;1000g:cohort1<0.2"), null);
assertEquals(74, queryResult.getNumResults());
<<<<<<<
queryResult = dbAdaptor.get(new Query(VariantDBAdaptor.VariantQueryParams.STATS_MAF.key(), "1000g:cohort2>0.2,1000g:cohort1<0.2")
, null);
assertEquals(866, queryResult.getNumResults());
=======
queryResult = dbAdaptor.get(new Query(VariantDBAdaptor.VariantQueryParams.STATS_MAF.key(), "1000g:cohort2>0.2,1000g:cohort1<0.2"), null);
assertEquals(865, queryResult.getNumResults());
>>>>>>>
queryResult = dbAdaptor.get(new Query(VariantDBAdaptor.VariantQueryParams.STATS_MAF.key(), "1000g:cohort2>0.2,1000g:cohort1<0.2"), null);
assertEquals(865, queryResult.getNumResults()); |
<<<<<<<
configuration.setOpenRegister(true);
configuration.getAdmin().setPassword("demo");
CatalogDemo.createDemoDatabase(configuration, catalogCommandOptions.demoCatalogCommandOptions.force);
CatalogManager catalogManager = new CatalogManager(configuration);
sessionId = catalogManager.login("user1", "user1_pass", "localhost").first().getString("sessionId");
=======
catalogConfiguration.setOpenRegister(true);
catalogConfiguration.getAdmin().setPassword("demo");
CatalogDemo.createDemoDatabase(catalogConfiguration, catalogCommandOptions.demoCatalogCommandOptions.force);
CatalogManager catalogManager = new CatalogManager(catalogConfiguration);
sessionId = catalogManager.login("user1", "user1_pass", "localhost").first().getId();
>>>>>>>
configuration.setOpenRegister(true);
configuration.getAdmin().setPassword("demo");
CatalogDemo.createDemoDatabase(configuration, catalogCommandOptions.demoCatalogCommandOptions.force);
CatalogManager catalogManager = new CatalogManager(configuration);
sessionId = catalogManager.login("user1", "user1_pass", "localhost").first().getId(); |
<<<<<<<
import org.apache.commons.lang3.time.StopWatch;
=======
import org.apache.commons.lang3.StringUtils;
>>>>>>>
<<<<<<<
=======
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.util.StopWatch;
import org.opencb.commons.datastore.core.ObjectMap;
>>>>>>>
import org.apache.hadoop.util.StopWatch;
<<<<<<<
protected QueryResult<StudyConfiguration> getStudyConfiguration(int studyId, Long timeStamp, QueryOptions options) {
StopWatch watch = StopWatch.createStarted();
=======
protected QueryResult<StudyConfiguration> getStudyConfiguration(String studyName, Long timeStamp, QueryOptions options) {
StopWatch watch = new StopWatch().start();
>>>>>>>
protected QueryResult<StudyConfiguration> getStudyConfiguration(int studyId, Long timeStamp, QueryOptions options) {
StopWatch watch = new StopWatch().start();
<<<<<<<
logger.debug("Get StudyConfiguration {} from DB {}", studyId, tableName);
Get get = new Get(getStudyConfigurationRowKey(studyId));
// byte[] columnQualifier = Bytes.toBytes(studyName);
get.addColumn(genomeHelper.getColumnFamily(), getValueColumn());
=======
logger.debug("Get StudyConfiguration {} from DB {}", studyName, tableName);
if (StringUtils.isEmpty(studyName)) {
return new QueryResult<>("", (int) watch.now(TimeUnit.MILLISECONDS),
studyConfigurationList.size(), studyConfigurationList.size(), "", "", studyConfigurationList);
}
Get get = new Get(studiesRow);
byte[] columnQualifier = Bytes.toBytes(studyName);
get.addColumn(genomeHelper.getColumnFamily(), columnQualifier);
>>>>>>>
Get get = new Get(getStudyConfigurationRowKey(studyId));
get.addColumn(genomeHelper.getColumnFamily(), getValueColumn());
logger.debug("Get StudyConfiguration {} from DB {}", studyId, tableName); |
<<<<<<<
=======
import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
import org.junit.Assert;
import org.junit.Rule;
>>>>>>>
import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
<<<<<<<
=======
import org.opencb.datastore.core.QueryOptions;
import org.opencb.datastore.core.config.DataStoreConfiguration;
import org.opencb.datastore.mongodb.MongoDBCollection;
>>>>>>>
import org.opencb.datastore.core.QueryOptions;
import org.opencb.datastore.mongodb.MongoDBCollection; |
<<<<<<<
int getProjectId(String userId, String project);
String getProjectOwner(int projectId) throws CatalogManagerException;
=======
int getProjectId(String userId, String project) throws CatalogManagerException;
>>>>>>>
int getProjectId(String userId, String project) throws CatalogManagerException;
String getProjectOwner(int projectId) throws CatalogManagerException; |
<<<<<<<
OpenCGAResult<File> queryResult = fileDBAdaptor.get(finalQuery, options, userId);
auditManager.auditSearch(userId, Enums.Resource.FILE, study.getId(), study.getUuid(), auditParams,
=======
OpenCGAResult<File> queryResult = fileDBAdaptor.get(study.getUid(), finalQuery, options, userId);
auditManager.auditSearch(userId, AuditRecord.Resource.FILE, study.getId(), study.getUuid(), auditParams,
>>>>>>>
OpenCGAResult<File> queryResult = fileDBAdaptor.get(study.getUid(), finalQuery, options, userId);
auditManager.auditSearch(userId, Enums.Resource.FILE, study.getId(), study.getUuid(), auditParams,
<<<<<<<
OpenCGAResult<File> result = fileDBAdaptor.get(query, new QueryOptions(), userId);
auditManager.audit(userId, Enums.Action.UNLINK, Enums.Resource.FILE, file.getId(), file.getUuid(), study.getId(),
=======
OpenCGAResult<File> result = fileDBAdaptor.get(study.getUid(), query, new QueryOptions(), userId);
auditManager.audit(userId, AuditRecord.Action.UNLINK, AuditRecord.Resource.FILE, file.getId(), file.getUuid(), study.getId(),
>>>>>>>
OpenCGAResult<File> result = fileDBAdaptor.get(study.getUid(), query, new QueryOptions(), userId);
auditManager.audit(userId, Enums.Action.UNLINK, Enums.Resource.FILE, file.getId(), file.getUuid(), study.getId(), |
<<<<<<<
List<String> include = Arrays.asList("chromosome", "start", "end", "alternative", "reference", "sourceEntries");
iteratorQueryOptions.add("include", include); // add() does not overwrite in case a "include" was already specified
=======
List<String> include = Arrays.asList("chromosome", "start", "end", "alternate", "reference", "sourceEntries");
iteratorQueryOptions.add("include", include);
>>>>>>>
List<String> include = Arrays.asList("chromosome", "start", "end", "alternate", "reference", "sourceEntries");
iteratorQueryOptions.add("include", include); // add() does not overwrite in case a "include" was already specified |
<<<<<<<
sampleIndexQuery = SampleIndexQueryParser.parseSampleIndexQuery(query, metadataManager);
StudyMetadata studyMetadata = metadataManager.getStudyMetadata(sampleIndexQuery.getStudy());
=======
SampleIndexQuery sampleIndexQuery = sampleIndexDBAdaptor.getSampleIndexQueryParser().parse(query);
studyMetadata = metadataManager.getStudyMetadata(sampleIndexQuery.getStudy());
operation = sampleIndexQuery.getQueryOperation();
samples = sampleIndexQuery.getSamplesMap();
>>>>>>>
sampleIndexQuery = sampleIndexDBAdaptor.getSampleIndexQueryParser().parse(query);
StudyMetadata studyMetadata = metadataManager.getStudyMetadata(sampleIndexQuery.getStudy()); |
<<<<<<<
import org.opencb.opencga.catalog.exceptions.CatalogException;
import org.opencb.opencga.catalog.utils.Constants;
import org.opencb.opencga.catalog.utils.UUIDUtils;
import org.opencb.opencga.core.common.Entity;
=======
import org.opencb.opencga.catalog.exceptions.CatalogException;
>>>>>>>
import org.opencb.opencga.catalog.exceptions.CatalogException;
import org.opencb.opencga.catalog.utils.Constants;
import org.opencb.opencga.catalog.utils.UUIDUtils;
import org.opencb.opencga.core.common.Entity;
<<<<<<<
Object o = parameters.get(QueryParams.RELATED_FILES.key());
if (o instanceof List<?>) {
List<Document> relatedFiles = new ArrayList<>(((List<?>) o).size());
for (Object relatedFile : ((List<?>) o)) {
relatedFiles.add(getMongoDBDocument(relatedFile, "RelatedFile"));
}
document.getSet().put(QueryParams.RELATED_FILES.key(), relatedFiles);
}
=======
List<File.RelatedFile> relatedFiles = parameters.getAsList(QueryParams.RELATED_FILES.key(), File.RelatedFile.class);
List<Document> relatedFileDocument = fileConverter.convertRelatedFiles(relatedFiles);
fileParameters.put(QueryParams.RELATED_FILES.key(), relatedFileDocument);
>>>>>>>
List<File.RelatedFile> relatedFiles = parameters.getAsList(QueryParams.RELATED_FILES.key(), File.RelatedFile.class);
List<Document> relatedFileDocument = fileConverter.convertRelatedFiles(relatedFiles);
document.getSet().put(QueryParams.RELATED_FILES.key(), relatedFileDocument);
<<<<<<<
Query query = new Query()
.append(QueryParams.UID.key(), fileId)
.append(QueryParams.STUDY_UID.key(), getStudyIdByFileId(fileId));
return get(query, options);
=======
Query query = new Query(QueryParams.ID.key(), fileId);
QueryResult<File> fileQueryResult = get(query, options);
completeWithRelatedFiles(fileQueryResult.first(), null);
return fileQueryResult;
>>>>>>>
Query query = new Query()
.append(QueryParams.UID.key(), fileId)
.append(QueryParams.STUDY_UID.key(), getStudyIdByFileId(fileId));
return get(query, options); |
<<<<<<<
static class ObjectWrapperMap extends HashMap<String, ObjectWrapper> { }
=======
static class AbstractMapWrapper {
public AbstractMap<String, Integer> values;
}
>>>>>>>
static class ObjectWrapperMap extends HashMap<String, ObjectWrapper> { }
static class AbstractMapWrapper {
public AbstractMap<String, Integer> values;
} |
<<<<<<<
OpenCGAResult<ClinicalAnalysis> analysisDataResult = clinicalDBAdaptor.get(queryCopy, queryOptions, user);
if (analysisDataResult.getNumResults() == 0) {
analysisDataResult = clinicalDBAdaptor.get(queryCopy, queryOptions);
if (analysisDataResult.getNumResults() == 0) {
=======
QueryResult<ClinicalAnalysis> analysisQueryResult = clinicalDBAdaptor.get(studyUid, queryCopy, queryOptions, user);
if (analysisQueryResult.getNumResults() == 0) {
analysisQueryResult = clinicalDBAdaptor.get(queryCopy, queryOptions);
if (analysisQueryResult.getNumResults() == 0) {
>>>>>>>
OpenCGAResult<ClinicalAnalysis> analysisDataResult = clinicalDBAdaptor.get(studyUid, queryCopy, queryOptions, user);
if (analysisDataResult.getNumResults() == 0) {
analysisDataResult = clinicalDBAdaptor.get(queryCopy, queryOptions);
if (analysisDataResult.getNumResults() == 0) {
<<<<<<<
OpenCGAResult<ClinicalAnalysis> analysisDataResult = clinicalDBAdaptor.get(queryCopy, queryOptions, user);
=======
QueryResult<ClinicalAnalysis> analysisQueryResult = clinicalDBAdaptor.get(studyUid, queryCopy, queryOptions, user);
>>>>>>>
OpenCGAResult<ClinicalAnalysis> analysisDataResult = clinicalDBAdaptor.get(studyUid, queryCopy, queryOptions, user);
<<<<<<<
=======
public QueryResult<ClinicalAnalysis> get(String studyStr, Query query, QueryOptions options, String sessionId) throws CatalogException {
query = ParamUtils.defaultObject(query, Query::new);
options = ParamUtils.defaultObject(options, QueryOptions::new);
String userId = catalogManager.getUserManager().getUserId(sessionId);
Study study = catalogManager.getStudyManager().resolveId(studyStr, userId);
query.append(ClinicalAnalysisDBAdaptor.QueryParams.STUDY_UID.key(), study.getUid());
QueryResult<ClinicalAnalysis> queryResult = clinicalDBAdaptor.get(study.getUid(), query, options, userId);
if (queryResult.getNumResults() == 0 && query.containsKey(ClinicalAnalysisDBAdaptor.QueryParams.UID.key())) {
List<Long> analysisList = query.getAsLongList(ClinicalAnalysisDBAdaptor.QueryParams.UID.key());
for (Long analysisId : analysisList) {
authorizationManager.checkClinicalAnalysisPermission(study.getUid(), analysisId, userId,
ClinicalAnalysisAclEntry.ClinicalAnalysisPermissions.VIEW);
}
}
return queryResult;
}
@Override
>>>>>>>
<<<<<<<
OpenCGAResult<Individual> individuals =
individualDBAdaptor.get(query, QueryOptions.empty(), catalogManager.getUserManager().getUserId(sessionId));
finalFamily.setMembers(individuals.getResults());
=======
QueryResult<Individual> individuals = individualDBAdaptor.get(study.getUid(), query, QueryOptions.empty(),
catalogManager.getUserManager().getUserId(sessionId));
finalFamily.setMembers(individuals.getResult());
>>>>>>>
OpenCGAResult<Individual> individuals = individualDBAdaptor.get(study.getUid(), query, QueryOptions.empty(),
catalogManager.getUserManager().getUserId(sessionId));
finalFamily.setMembers(individuals.getResults());
<<<<<<<
OpenCGAResult<ClinicalAnalysis> queryResult = clinicalDBAdaptor.get(query, options, userId);
=======
QueryResult<ClinicalAnalysis> queryResult = clinicalDBAdaptor.get(study.getUid(), query, options, userId);
// authorizationManager.filterClinicalAnalysis(userId, studyId, queryResultAux.getResult());
>>>>>>>
OpenCGAResult<ClinicalAnalysis> queryResult = clinicalDBAdaptor.get(study.getUid(), query, options, userId);
<<<<<<<
@Override
public OpenCGAResult delete(String studyStr, List<String> ids, ObjectMap params, String token) throws CatalogException {
return null;
=======
query.append(ClinicalAnalysisDBAdaptor.QueryParams.STUDY_UID.key(), study.getUid());
QueryResult<Long> queryResultAux = clinicalDBAdaptor.count(study.getUid(), query, userId,
StudyAclEntry.StudyPermissions.VIEW_CLINICAL_ANALYSIS);
return new QueryResult<>("count", queryResultAux.getDbTime(), 0, queryResultAux.first(), queryResultAux.getWarningMsg(),
queryResultAux.getErrorMsg(), Collections.emptyList());
>>>>>>>
@Override
public OpenCGAResult delete(String studyStr, List<String> ids, ObjectMap params, String token) throws CatalogException {
return null;
<<<<<<<
OpenCGAResult queryResult = clinicalDBAdaptor.groupBy(query, fields, options, userId);
=======
QueryResult queryResult = clinicalDBAdaptor.groupBy(study.getUid(), query, fields, options, userId);
>>>>>>>
OpenCGAResult queryResult = clinicalDBAdaptor.groupBy(study.getUid(), query, fields, options, userId); |
<<<<<<<
import com.google.common.collect.BiMap;
import com.google.protobuf.InvalidProtocolBufferException;
=======
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.NavigableMap;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.commons.lang3.StringUtils;
>>>>>>>
import com.google.common.collect.BiMap;
import com.google.protobuf.InvalidProtocolBufferException;
import org.apache.commons.lang3.StringUtils;
<<<<<<<
List<Variant> archPreviousFiles = loadArchivePreviousFiles(context, varPosMissing, sliceKey);
=======
List<Variant> archPreviousFiles = loadArchivePreviousFiles(context, varPosMissing,sliceKey, fileIds);
>>>>>>>
List<Variant> archPreviousFiles = loadArchivePreviousFiles(context, varPosMissing, sliceKey, fileIds);
<<<<<<<
* @param sliceKey Rowkey
=======
* @param sliceKey Rowkey
* @param currFileIds
>>>>>>>
* @param sliceKey Rowkey
* @param currFileIds currFileIds
<<<<<<<
List<Variant> var = new ArrayList<>();
Get get = new Get(Bytes.toBytes(sliceKey));
=======
>>>>>>>
<<<<<<<
Map<Variant, Map<String, List<Integer>>> gtIdx = archMissing.stream()
.collect(Collectors.toMap(v -> v, v -> createGenotypeIndex(v)));
Map<Variant, ByteArray> rowkeyIdx = archMissing.stream()
.collect(Collectors.toMap(v -> v, v -> new ByteArray(getHelper().generateVariantRowKey(v))));
for (Integer pos : targetPos) {
List<Variant> varCovingPos = archMissing.stream().filter(v -> variantCoveringPosition(v, pos)).collect(Collectors.toList());
List<Variant> varTargetPos =
=======
for(Integer pos : targetPos){
boolean debug = pos.equals(10433);
List<Variant> varCovingPos = archMissing.stream().filter(v -> variantCoveringPosition(v, pos)).collect(Collectors.toList());
List<Variant> varTargetPos =
>>>>>>>
Map<Variant, Map<String, List<Integer>>> gtIdx = archMissing.stream()
.collect(Collectors.toMap(v -> v, v -> createGenotypeIndex(v)));
Map<Variant, ByteArray> rowkeyIdx = archMissing.stream()
.collect(Collectors.toMap(v -> v, v -> new ByteArray(getHelper().generateVariantRowKey(v))));
for (Integer pos : targetPos) {
boolean debug = pos.equals(10433);
List<Variant> varCovingPos = archMissing.stream().filter(v -> variantCoveringPosition(v, pos)).collect(Collectors.toList());
List<Variant> varTargetPos =
<<<<<<<
.filter(v -> v.getStart().equals(pos))
.collect(Collectors.toList());
for (Variant var : varTargetPos) {
=======
.filter(v -> v.getStart().equals(pos))
.collect(Collectors.toList());
if(debug) {
List<String> col = varCovingPos.stream().map(v -> v.getStart()+"-"+v.getType()).collect(Collectors.toList());
getLog().info(String.format("varCovingPos size: %s using %s",
varTargetPos.size(),
StringUtils.join(col,';')));
col = varTargetPos.stream().map(v -> v.getStart()+"-"+v.getType()).collect(Collectors.toList());
getLog().info(String.format("varTargetPos size: %s using %s",
varTargetPos.size(),
StringUtils.join(col,';')));
}
for(Variant var : varTargetPos){ // For each Variant with a SNP (Target type)
>>>>>>>
.filter(v -> v.getStart().equals(pos))
.collect(Collectors.toList());
if (debug) {
List<String> col = varCovingPos.stream().map(v -> v.getStart() + "-" + v.getType()).collect(Collectors.toList());
getLog().info(String.format("varCovingPos size: %s using %s",
varTargetPos.size(),
StringUtils.join(col, ';')));
col = varTargetPos.stream().map(v -> v.getStart() + "-" + v.getType()).collect(Collectors.toList());
getLog().info(String.format("varTargetPos size: %s using %s",
varTargetPos.size(),
StringUtils.join(col, ';')));
}
for (Variant var : varTargetPos) { // For each Variant with a SNP (Target type)
<<<<<<<
ByteArray currRowKey = new ByteArray(row.generateRowKey(getHelper()));
if (newVar.containsKey(currRowKey)) {
=======
ByteArray currRowKey = rowkeyIdx.get(var);
if(newVar.containsKey(currRowKey)){
>>>>>>>
ByteArray currRowKey = rowkeyIdx.get(var);
if (newVar.containsKey(currRowKey)) {
<<<<<<<
context.getCounter("OPENCGA.HBASE", "VCF_VARIANT-row-new").increment(1);
Set<Integer> homRefs = new HashSet<>();
for (Variant other : varCovingPos) { // also includes the current target variant
=======
context.getCounter("OPENCGA.HBASE", "VCF_VARIANT-row-new-added").increment(1);
Set<Integer> homRefs = new HashSet<Integer>();
for(Variant other : varCovingPos){ // also includes the current target variant
>>>>>>>
context.getCounter("OPENCGA.HBASE", "VCF_VARIANT-row-new-added").increment(1);
Set<Integer> homRefs = new HashSet<Integer>();
for (Variant other : varCovingPos) { // also includes the current target variant
<<<<<<<
for (VariantTableStudyRow row : variants.values()) {
getLog().info(String.format("Submit %s: hr: %s; 0/1: %s", row.getPos(), row.getHomRefCount(), Arrays.toString(row
.getSampleIds("0/1").toArray())));
=======
for(VariantTableStudyRow row : variants.values()){
getLog().info(row.toSummaryString());
>>>>>>>
for (VariantTableStudyRow row : variants.values()) {
getLog().info(row.toSummaryString()); |
<<<<<<<
+ '.' + DocumentToStudyVariantEntryConverter.FILEID_FIELD, files, studyBuilder, QueryOperation.AND,
queryOperation, t -> t);
=======
+ '.' + DocumentToStudyVariantEntryConverter.FILEID_FIELD, files, builder, QueryOperation.AND,
QueryOperation.AND, t -> t);
>>>>>>>
+ '.' + DocumentToStudyVariantEntryConverter.FILEID_FIELD, files, builder, QueryOperation.AND,
queryOperation, t -> t); |
<<<<<<<
// assertEquals(1, annotationSetQueryResult.getNumResults());
Map<String, Object> map = sampleQueryResult.first().getAnnotationSets().get(0).getAnnotations();
assertEquals(4, map.size());
=======
// assertEquals(1, annotationSetDataResult.getNumResults());
Map<String, Object> map = sampleDataResult.first().getAnnotationSets().get(0).getAnnotations();
assertEquals(3, map.size());
>>>>>>>
// assertEquals(1, annotationSetQueryResult.getNumResults());
Map<String, Object> map = sampleDataResult.first().getAnnotationSets().get(0).getAnnotations();
assertEquals(4, map.size()); |
<<<<<<<
Entity.FAMILY);
=======
allFamilyPermissions, collectionName);
>>>>>>>
allFamilyPermissions, Entity.FAMILY); |
<<<<<<<
=======
import org.opencb.opencga.analysis.variant.VariantExportTool;
import org.opencb.opencga.analysis.variant.operations.VariantFileDeleteOperationTool;
>>>>>>>
import org.opencb.opencga.analysis.variant.operations.VariantFileDeleteOperationTool; |
<<<<<<<
return AnalysisJobExecutor.createJob(catalogManager, studyId, jobName,
AnalysisFileIndexer.OPENCGA_ANALYSIS_BIN_NAME, jobDescription, outDir, inputFiles,
=======
return jobFactory.createJob(studyId, jobName,
AnalysisFileIndexer.OPENCGA_ANALYSIS_BIN_NAME, jobDescription, outDir, Collections.emptyList(),
>>>>>>>
return jobFactory.createJob(studyId, jobName,
AnalysisFileIndexer.OPENCGA_ANALYSIS_BIN_NAME, jobDescription, outDir, inputFiles, |
<<<<<<<
import org.opencb.opencga.storage.hadoop.variant.archive.ArchiveTableHelper;
import org.opencb.opencga.storage.hadoop.variant.mr.AbstractHBaseVariantMapper;
import org.opencb.opencga.storage.hadoop.variant.mr.AnalysisTableMapReduceHelper;
=======
>>>>>>>
import org.opencb.opencga.storage.hadoop.variant.archive.ArchiveTableHelper;
import org.opencb.opencga.storage.hadoop.variant.mr.AbstractHBaseVariantMapper;
import org.opencb.opencga.storage.hadoop.variant.mr.AnalysisTableMapReduceHelper;
<<<<<<<
public Set<Integer> getFileIdsInResult() {
return fileIdsInResult;
}
=======
public Set<Integer> getFileIds() {
return fileIds;
}
>>>>>>>
public Set<Integer> getFileIdsInResult() {
return fileIdsInResult;
} |
<<<<<<<
public OpenCGAResult<Panel> get(Query query, QueryOptions options, String user)
throws CatalogDBException, CatalogAuthorizationException {
return get(null, query, options, user);
}
OpenCGAResult<Panel> get(ClientSession clientSession, Query query, QueryOptions options, String user)
=======
public QueryResult<Panel> get(long studyUid, Query query, QueryOptions options, String user)
>>>>>>>
public OpenCGAResult<Panel> get(long studyUid, Query query, QueryOptions options, String user)
throws CatalogDBException, CatalogAuthorizationException {
return get(null, studyUid, query, options, user);
}
OpenCGAResult<Panel> get(ClientSession clientSession, long studyUid, Query query, QueryOptions options, String user)
<<<<<<<
public OpenCGAResult<Long> count(final Query query, final String user, final StudyAclEntry.StudyPermissions studyPermissions)
=======
public QueryResult<Long> count(long studyUid, final Query query, final String user,
final StudyAclEntry.StudyPermissions studyPermissions)
>>>>>>>
public OpenCGAResult<Long> count(long studyUid, final Query query, final String user,
final StudyAclEntry.StudyPermissions studyPermissions)
<<<<<<<
Query studyQuery = new Query(StudyDBAdaptor.QueryParams.UID.key(), query.getLong(QueryParams.STUDY_UID.key()));
OpenCGAResult queryResult = dbAdaptorFactory.getCatalogStudyDBAdaptor().nativeGet(clientSession, studyQuery, QueryOptions.empty());
=======
Query studyQuery = new Query(StudyDBAdaptor.QueryParams.UID.key(), studyUid);
QueryResult queryResult = dbAdaptorFactory.getCatalogStudyDBAdaptor().nativeGet(studyQuery, QueryOptions.empty());
>>>>>>>
Query studyQuery = new Query(StudyDBAdaptor.QueryParams.UID.key(), studyUid);
OpenCGAResult queryResult = dbAdaptorFactory.getCatalogStudyDBAdaptor().nativeGet(clientSession, studyQuery, QueryOptions.empty());
<<<<<<<
return iterator(null, query, options, user);
}
DBIterator<Panel> iterator(ClientSession clientSession, Query query, QueryOptions options, String user)
throws CatalogDBException, CatalogAuthorizationException {
Document studyDocument = getStudyDocument(query);
MongoCursor<Document> mongoCursor = getMongoCursor(clientSession, query, options, studyDocument, user);
=======
Document studyDocument = getStudyDocument(studyUid);
MongoCursor<Document> mongoCursor = getMongoCursor(query, options, studyDocument, user);
>>>>>>>
return iterator(null, studyUid, query, options, user);
}
DBIterator<Panel> iterator(ClientSession clientSession, long studyUid, Query query, QueryOptions options, String user)
throws CatalogDBException, CatalogAuthorizationException {
Document studyDocument = getStudyDocument(null, studyUid);
MongoCursor<Document> mongoCursor = getMongoCursor(clientSession, query, options, studyDocument, user);
<<<<<<<
Document studyDocument = getStudyDocument(query);
MongoCursor<Document> mongoCursor = getMongoCursor(null, query, queryOptions, studyDocument, user);
=======
Document studyDocument = getStudyDocument(studyUid);
MongoCursor<Document> mongoCursor = getMongoCursor(query, queryOptions, studyDocument, user);
>>>>>>>
Document studyDocument = getStudyDocument(null, studyUid);
MongoCursor<Document> mongoCursor = getMongoCursor(null, query, queryOptions, studyDocument, user);
<<<<<<<
Query studyQuery = new Query(StudyDBAdaptor.QueryParams.UID.key(), query.getLong(QueryParams.STUDY_UID.key()));
OpenCGAResult<Document> queryResult = dbAdaptorFactory.getCatalogStudyDBAdaptor().nativeGet(studyQuery, QueryOptions.empty());
=======
Query studyQuery = new Query(StudyDBAdaptor.QueryParams.UID.key(), studyUid);
QueryResult<Document> queryResult = dbAdaptorFactory.getCatalogStudyDBAdaptor().nativeGet(studyQuery, QueryOptions.empty());
>>>>>>>
Query studyQuery = new Query(StudyDBAdaptor.QueryParams.UID.key(), studyUid);
OpenCGAResult queryResult = dbAdaptorFactory.getCatalogStudyDBAdaptor().nativeGet(clientSession, studyQuery, QueryOptions.empty()); |
<<<<<<<
=======
import org.opencb.commons.datastore.core.QueryResult;
import org.opencb.opencga.catalog.db.api.CatalogFileDBAdaptor;
import org.opencb.opencga.catalog.managers.CatalogManager;
>>>>>>>
import org.opencb.commons.datastore.core.QueryResult; |
<<<<<<<
import org.opencb.opencga.storage.core.variant.adaptors.VariantQueryParam;
import org.opencb.opencga.storage.core.variant.adaptors.iterators.VariantDBIterator;
=======
import org.opencb.opencga.storage.core.variant.adaptors.VariantQueryUtils;
>>>>>>>
import org.opencb.opencga.storage.core.variant.adaptors.VariantQueryParam;
import org.opencb.opencga.storage.core.variant.adaptors.VariantQueryUtils;
import org.opencb.opencga.storage.core.variant.adaptors.iterators.VariantDBIterator;
<<<<<<<
import org.opencb.opencga.storage.core.variant.search.solr.VariantSearchManager;
=======
import org.opencb.opencga.storage.core.variant.search.solr.VariantSearchLoadListener;
import org.opencb.opencga.storage.core.variant.search.solr.VariantSearchLoadResult;
>>>>>>>
import org.opencb.opencga.storage.core.variant.search.solr.VariantSearchLoadListener;
import org.opencb.opencga.storage.core.variant.search.solr.VariantSearchLoadResult;
import org.opencb.opencga.storage.core.variant.search.solr.VariantSearchManager;
<<<<<<<
import org.opencb.opencga.storage.hadoop.variant.index.sample.SampleIndexConsolidationDrive;
import org.opencb.opencga.storage.hadoop.variant.index.sample.SampleIndexConverter;
import org.opencb.opencga.storage.hadoop.variant.index.sample.SampleIndexDBAdaptor;
import org.opencb.opencga.storage.hadoop.variant.index.sample.SampleIndexQuery;
import org.opencb.opencga.storage.hadoop.variant.io.HadoopVariantExporter;
import org.opencb.opencga.storage.hadoop.variant.metadata.HBaseVariantStorageMetadataDBAdaptorFactory;
=======
import org.opencb.opencga.storage.hadoop.variant.metadata.HBaseStudyConfigurationDBAdaptor;
import org.opencb.opencga.storage.hadoop.variant.search.HadoopVariantSearchLoadListener;
>>>>>>>
import org.opencb.opencga.storage.hadoop.variant.index.sample.SampleIndexConsolidationDrive;
import org.opencb.opencga.storage.hadoop.variant.index.sample.SampleIndexConverter;
import org.opencb.opencga.storage.hadoop.variant.index.sample.SampleIndexDBAdaptor;
import org.opencb.opencga.storage.hadoop.variant.index.sample.SampleIndexQuery;
import org.opencb.opencga.storage.hadoop.variant.io.HadoopVariantExporter;
import org.opencb.opencga.storage.hadoop.variant.metadata.HBaseVariantStorageMetadataDBAdaptorFactory;
import org.opencb.opencga.storage.hadoop.variant.search.HadoopVariantSearchLoadListener;
<<<<<<<
String sampleIndexTable = getTableNameGenerator().getSampleIndexTableName(studyId);
=======
String hadoopRoute = options.getString(HADOOP_BIN, "hadoop");
String jar = getJarWithDependencies(options);
options.put(DeleteHBaseColumnDriver.DELETE_HBASE_COLUMN_MAPPER_CLASS, MyDeleteHBaseColumnMapper.class.getName());
Class execClass = DeleteHBaseColumnDriver.class;
String executable = hadoopRoute + " jar " + jar + ' ' + execClass.getName();
>>>>>>>
String sampleIndexTable = getTableNameGenerator().getSampleIndexTableName(studyId);
options.put(DeleteHBaseColumnDriver.DELETE_HBASE_COLUMN_MAPPER_CLASS, MyDeleteHBaseColumnMapper.class.getName());
<<<<<<<
=======
/**
* Created on 23/04/18.
*
* @author Jacobo Coll <[email protected]>
*/
public static class MyDeleteHBaseColumnMapper extends DeleteHBaseColumnDriver.DeleteHBaseColumnMapper {
private byte[] columnFamily;
@Override
protected void setup(Context context) throws IOException, InterruptedException {
super.setup(context);
columnFamily = new GenomeHelper(context.getConfiguration()).getColumnFamily();
}
@Override
protected void map(ImmutableBytesWritable key, Result result, Context context) throws IOException, InterruptedException {
super.map(key, result, context);
// context.write(key, HadoopVariantSearchIndexUtils.addUnknownSyncStatus(new Put(result.getRow()), columnFamily));
}
}
>>>>>>>
/**
* Created on 23/04/18.
*
* @author Jacobo Coll <[email protected]>
*/
public static class MyDeleteHBaseColumnMapper extends DeleteHBaseColumnDriver.DeleteHBaseColumnMapper {
private byte[] columnFamily;
@Override
protected void setup(Context context) throws IOException, InterruptedException {
super.setup(context);
columnFamily = new GenomeHelper(context.getConfiguration()).getColumnFamily();
}
@Override
protected void map(ImmutableBytesWritable key, Result result, Context context) throws IOException, InterruptedException {
super.map(key, result, context);
// context.write(key, HadoopVariantSearchIndexUtils.addUnknownSyncStatus(new Put(result.getRow()), columnFamily));
}
} |
<<<<<<<
// @Deprecated
// INCLUDE_SRC("include.src", false), //Include original source file on the transformed file and the final db
=======
EXTRA_GENOTYPE_FIELDS_TYPE("include.extra-fields-format", ""), //Other sample information format (String, Integer, Float)
EXTRA_GENOTYPE_FIELDS_COMPRESS("extra-fields.compress", true), //Compress with gzip other sample information
@Deprecated
INCLUDE_SRC ("include.src", false), //Include original source file on the transformed file and the final db
>>>>>>>
EXTRA_GENOTYPE_FIELDS_TYPE("include.extra-fields-format", ""), //Other sample information format (String, Integer, Float)
EXTRA_GENOTYPE_FIELDS_COMPRESS("extra-fields.compress", true), //Compress with gzip other sample information
// @Deprecated
// INCLUDE_SRC("include.src", false), //Include original source file on the transformed file and the final db
<<<<<<<
taskSupplier = () -> new VariantAvroTransformTask(header, headerVersion, finalSource, finalOutputMetaFile,
statsCalculator);
=======
taskSupplier = () -> new VariantAvroTransformTask(header, headerVersion, finalSource, finalOutputMetaFile, statsCalculator, includeSrc);
>>>>>>>
taskSupplier = () -> new VariantAvroTransformTask(header, headerVersion, finalSource, finalOutputMetaFile,
statsCalculator, includeSrc);
<<<<<<<
VariantJsonTransformTask variantJsonTransformTask =
new VariantJsonTransformTask(factory, finalSource, finalOutputFileJsonFile);
// variantJsonTransformTask.setIncludeSrc(includeSrc);
=======
>>>>>>>
<<<<<<<
=======
if (studyConfiguration.getIndexedFiles().isEmpty()) {
// First indexed file
// Use the EXCLUDE_GENOTYPES value from CLI. Write in StudyConfiguration.attributes
boolean excludeGenotypes =
options.getBoolean(Options.EXCLUDE_GENOTYPES.key(), Options.EXCLUDE_GENOTYPES.defaultValue());
studyConfiguration.getAttributes().put(Options.EXCLUDE_GENOTYPES.key(), excludeGenotypes);
boolean compressExtraFields =
options.getBoolean(Options.EXTRA_GENOTYPE_FIELDS_COMPRESS.key(), Options.EXTRA_GENOTYPE_FIELDS_COMPRESS.defaultValue());
studyConfiguration.getAttributes().put(Options.EXTRA_GENOTYPE_FIELDS_COMPRESS.key(), compressExtraFields);
} else {
// Not first indexed file
// Use the EXCLUDE_GENOTYPES value from StudyConfiguration. Ignore CLI value
boolean excludeGenotypes = studyConfiguration.getAttributes()
.getBoolean(Options.EXCLUDE_GENOTYPES.key(), Options.EXCLUDE_GENOTYPES.defaultValue());
options.put(Options.EXCLUDE_GENOTYPES.key(), excludeGenotypes);
}
>>>>>>>
if (studyConfiguration.getIndexedFiles().isEmpty()) {
// First indexed file
// Use the EXCLUDE_GENOTYPES value from CLI. Write in StudyConfiguration.attributes
boolean excludeGenotypes =
options.getBoolean(Options.EXCLUDE_GENOTYPES.key(), Options.EXCLUDE_GENOTYPES.defaultValue());
studyConfiguration.getAttributes().put(Options.EXCLUDE_GENOTYPES.key(), excludeGenotypes);
boolean compressExtraFields =
options.getBoolean(Options.EXTRA_GENOTYPE_FIELDS_COMPRESS.key(), Options.EXTRA_GENOTYPE_FIELDS_COMPRESS.defaultValue());
studyConfiguration.getAttributes().put(Options.EXTRA_GENOTYPE_FIELDS_COMPRESS.key(), compressExtraFields);
} else {
// Not first indexed file
// Use the EXCLUDE_GENOTYPES value from StudyConfiguration. Ignore CLI value
boolean excludeGenotypes = studyConfiguration.getAttributes()
.getBoolean(Options.EXCLUDE_GENOTYPES.key(), Options.EXCLUDE_GENOTYPES.defaultValue());
options.put(Options.EXCLUDE_GENOTYPES.key(), excludeGenotypes);
} |
<<<<<<<
import org.opencb.opencga.analysis.storage.OpenCGATestExternalResource;
import org.opencb.opencga.storage.core.variant.VariantStorageEngine;
=======
import org.opencb.opencga.storage.core.manager.OpenCGATestExternalResource;
import org.opencb.opencga.storage.core.variant.VariantStorageOptions;
>>>>>>>
import org.opencb.opencga.storage.core.variant.VariantStorageOptions; |
<<<<<<<
=======
import org.opencb.opencga.storage.core.variant.adaptors.VariantQueryUtils;
import org.opencb.opencga.storage.core.variant.annotation.DefaultVariantAnnotationManager;
>>>>>>>
import org.opencb.opencga.storage.core.variant.adaptors.VariantQueryUtils;
<<<<<<<
import org.opencb.opencga.storage.mongodb.annotation.MongoDBVariantAnnotationManager;
=======
import org.opencb.opencga.storage.core.variant.io.db.VariantAnnotationDBWriter;
import org.opencb.opencga.storage.core.variant.search.solr.VariantSearchManager;
>>>>>>>
import org.opencb.opencga.storage.core.variant.search.solr.VariantSearchManager;
import org.opencb.opencga.storage.mongodb.annotation.MongoDBVariantAnnotationManager; |
<<<<<<<
long projectId = catalogManager.getStudyManager().getProjectId(study.getUid());
dataStore = getDataStoreByProjectId(catalogManager, projectId, bioformat, sessionId);
=======
long projectId = catalogManager.getStudyManager().getProjectId(study.getId());
dataStore = getDataStoreByProjectId(catalogManager, String.valueOf(projectId), bioformat, sessionId);
>>>>>>>
long projectId = catalogManager.getStudyManager().getProjectId(study.getUid());
dataStore = getDataStoreByProjectId(catalogManager, String.valueOf(projectId), bioformat, sessionId);
<<<<<<<
Arrays.asList(ProjectDBAdaptor.QueryParams.ID.key(), ProjectDBAdaptor.QueryParams.DATASTORES.key()));
Project project = catalogManager.getProjectManager().get(String.valueOf((Long) projectId), queryOptions, sessionId).first();
=======
Arrays.asList(ProjectDBAdaptor.QueryParams.ALIAS.key(), ProjectDBAdaptor.QueryParams.DATASTORES.key()));
Project project = catalogManager.getProjectManager().get(projectStr, queryOptions, sessionId).first();
>>>>>>>
Arrays.asList(ProjectDBAdaptor.QueryParams.ID.key(), ProjectDBAdaptor.QueryParams.DATASTORES.key()));
Project project = catalogManager.getProjectManager().get(projectStr, queryOptions, sessionId).first(); |
<<<<<<<
OpenCGAResult<Individual> individualDataResult = individualDBAdaptor.get(queryCopy, queryOptions, user);
if (individualDataResult.getNumResults() == 0) {
individualDataResult = individualDBAdaptor.get(queryCopy, queryOptions);
if (individualDataResult.getNumResults() == 0) {
=======
// QueryOptions options = new QueryOptions(QueryOptions.INCLUDE, Arrays.asList(
// IndividualDBAdaptor.QueryParams.UUID.key(), IndividualDBAdaptor.QueryParams.UID.key(),
// IndividualDBAdaptor.QueryParams.STUDY_UID.key(), IndividualDBAdaptor.QueryParams.ID.key(),
// IndividualDBAdaptor.QueryParams.RELEASE.key(), IndividualDBAdaptor.QueryParams.VERSION.key(),
// IndividualDBAdaptor.QueryParams.STATUS.key(), IndividualDBAdaptor.QueryParams.FATHER.key(),
// IndividualDBAdaptor.QueryParams.MOTHER.key(), IndividualDBAdaptor.QueryParams.MULTIPLES.key(),
// IndividualDBAdaptor.QueryParams.SEX.key()));
QueryResult<Individual> individualQueryResult = individualDBAdaptor.get(studyUid, queryCopy, queryOptions, user);
if (individualQueryResult.getNumResults() == 0) {
individualQueryResult = individualDBAdaptor.get(queryCopy, queryOptions);
if (individualQueryResult.getNumResults() == 0) {
>>>>>>>
OpenCGAResult<Individual> individualDataResult = individualDBAdaptor.get(studyUid, queryCopy, queryOptions, user);
if (individualDataResult.getNumResults() == 0) {
individualDataResult = individualDBAdaptor.get(queryCopy, queryOptions);
if (individualDataResult.getNumResults() == 0) {
<<<<<<<
OpenCGAResult<Individual> individualDataResult = individualDBAdaptor.get(queryCopy, queryOptions, user);
=======
QueryResult<Individual> individualQueryResult = individualDBAdaptor.get(studyUid, queryCopy, queryOptions, user);
>>>>>>>
OpenCGAResult<Individual> individualDataResult = individualDBAdaptor.get(studyUid, queryCopy, queryOptions, user);
<<<<<<<
=======
public QueryResult<Individual> get(String studyStr, Query query, QueryOptions options, String sessionId) throws CatalogException {
query = ParamUtils.defaultObject(query, Query::new);
options = ParamUtils.defaultObject(options, QueryOptions::new);
String userId = userManager.getUserId(sessionId);
Study study = studyManager.resolveId(studyStr, userId, new QueryOptions(QueryOptions.INCLUDE,
StudyDBAdaptor.QueryParams.VARIABLE_SET.key()));
// Fix query if it contains any annotation
AnnotationUtils.fixQueryAnnotationSearch(study, query);
AnnotationUtils.fixQueryOptionAnnotation(options);
fixQuery(study, query, userId);
query.append(IndividualDBAdaptor.QueryParams.STUDY_UID.key(), study.getUid());
QueryResult<Individual> individualQueryResult = individualDBAdaptor.get(study.getUid(), query, options, userId);
if (individualQueryResult.getNumResults() == 0 && query.containsKey(IndividualDBAdaptor.QueryParams.UID.key())) {
List<Long> idList = query.getAsLongList(IndividualDBAdaptor.QueryParams.UID.key());
for (Long myId : idList) {
authorizationManager.checkIndividualPermission(study.getUid(), myId, userId, IndividualAclEntry.IndividualPermissions.VIEW);
}
}
return individualQueryResult;
}
public QueryResult<Individual> get(long studyId, Query query, QueryOptions options, String sessionId) throws CatalogException {
return get(String.valueOf(studyId), query, options, sessionId);
}
@Override
>>>>>>>
<<<<<<<
OpenCGAResult<Individual> queryResult = individualDBAdaptor.get(finalQuery, options, userId);
auditManager.auditSearch(userId, AuditRecord.Resource.INDIVIDUAL, study.getId(), study.getUuid(), auditParams,
new AuditRecord.Status(AuditRecord.Status.Result.SUCCESS));
=======
QueryResult<Individual> queryResult = individualDBAdaptor.get(study.getUid(), finalQuery, options, userId);
// authorizationManager.filterIndividuals(userId, studyId, queryResultAux.getResult());
>>>>>>>
OpenCGAResult<Individual> queryResult = individualDBAdaptor.get(study.getUid(), finalQuery, options, userId);
auditManager.auditSearch(userId, AuditRecord.Resource.INDIVIDUAL, study.getId(), study.getUuid(), auditParams,
new AuditRecord.Status(AuditRecord.Status.Result.SUCCESS));
<<<<<<<
auditManager.auditDelete(operationUuid, userId, AuditRecord.Resource.INDIVIDUAL, individual.getId(), individual.getUuid(),
study.getId(), study.getUuid(), auditParams, new AuditRecord.Status(AuditRecord.Status.Result.SUCCESS));
} catch (CatalogException e) {
String errorMsg = "Cannot delete individual " + individualId + ": " + e.getMessage();
Event event = new Event(Event.Type.ERROR, individualId, e.getMessage());
result.getEvents().add(event);
logger.error(errorMsg, e);
auditManager.auditDelete(operationUuid, userId, AuditRecord.Resource.INDIVIDUAL, individualId, individualUuid,
study.getId(), study.getUuid(), auditParams, new AuditRecord.Status(AuditRecord.Status.Result.ERROR, e.getError()));
}
}
return endResult(result, ignoreException);
=======
finalQuery.append(IndividualDBAdaptor.QueryParams.STUDY_UID.key(), study.getUid());
QueryResult<Long> queryResultAux = individualDBAdaptor.count(study.getUid(), finalQuery, userId,
StudyAclEntry.StudyPermissions.VIEW_INDIVIDUALS);
return new QueryResult<>("count", queryResultAux.getDbTime(), 0, queryResultAux.first(), queryResultAux.getWarningMsg(),
queryResultAux.getErrorMsg(), Collections.emptyList());
>>>>>>>
auditManager.auditDelete(operationUuid, userId, AuditRecord.Resource.INDIVIDUAL, individual.getId(), individual.getUuid(),
study.getId(), study.getUuid(), auditParams, new AuditRecord.Status(AuditRecord.Status.Result.SUCCESS));
} catch (CatalogException e) {
String errorMsg = "Cannot delete individual " + individualId + ": " + e.getMessage();
Event event = new Event(Event.Type.ERROR, individualId, e.getMessage());
result.getEvents().add(event);
logger.error(errorMsg, e);
auditManager.auditDelete(operationUuid, userId, AuditRecord.Resource.INDIVIDUAL, individualId, individualUuid,
study.getId(), study.getUuid(), auditParams, new AuditRecord.Status(AuditRecord.Status.Result.ERROR, e.getError()));
}
}
return endResult(result, ignoreException);
<<<<<<<
iterator = individualDBAdaptor.iterator(finalQuery, INCLUDE_INDIVIDUAL_IDS, userId);
=======
iterator = individualDBAdaptor.iterator(study.getUid(), finalQuery, QueryOptions.empty(), userId);
>>>>>>>
iterator = individualDBAdaptor.iterator(study.getUid(), finalQuery, INCLUDE_INDIVIDUAL_IDS, userId);
<<<<<<<
OpenCGAResult queryResult = individualDBAdaptor.groupBy(finalQuery, fields, options, userId);
=======
QueryResult queryResult = individualDBAdaptor.groupBy(study.getUid(), finalQuery, fields, options, userId);
>>>>>>>
OpenCGAResult queryResult = individualDBAdaptor.groupBy(study.getUid(), finalQuery, fields, options, userId); |
<<<<<<<
Job job = new Job(name, userId, toolName, description, commandLine, outDir, inputFiles);
=======
Job job = new Job(name, userId, toolName, description, commandLine, outDir.getId(), inputFiles,
catalogManager.getStudyManager().getCurrentRelease(studyId));
>>>>>>>
Job job = new Job(name, userId, toolName, description, commandLine, outDir, inputFiles,
catalogManager.getStudyManager().getCurrentRelease(studyId));
<<<<<<<
Job job = new Job(jobName, userId, executable, type, input, output, outDir, params)
=======
Job job = new Job(jobName, userId, executable, type, input, output, outDirId, params,
catalogManager.getStudyManager().getCurrentRelease(studyId))
>>>>>>>
Job job = new Job(jobName, userId, executable, type, input, output, outDir, params,
catalogManager.getStudyManager().getCurrentRelease(studyId)) |
<<<<<<<
import org.opencb.commons.datastore.core.ObjectMap;
import org.opencb.commons.datastore.core.Query;
import org.opencb.commons.datastore.core.QueryOptions;
import org.opencb.commons.datastore.core.QueryResult;
=======
import org.opencb.biodata.tools.variant.stats.VariantAggregatedStatsCalculator;
>>>>>>>
import org.opencb.commons.datastore.core.ObjectMap;
import org.opencb.commons.datastore.core.Query;
import org.opencb.commons.datastore.core.QueryOptions;
import org.opencb.commons.datastore.core.QueryResult;
import org.opencb.biodata.tools.variant.stats.VariantAggregatedStatsCalculator;
<<<<<<<
import org.opencb.opencga.catalog.db.api.CatalogFileDBAdaptor;
import org.opencb.opencga.catalog.db.api.CatalogJobDBAdaptor;
import org.opencb.opencga.catalog.db.api.CatalogSampleDBAdaptor;
=======
import org.opencb.opencga.catalog.CatalogManager;
>>>>>>>
import org.opencb.opencga.catalog.db.api.CatalogFileDBAdaptor;
import org.opencb.opencga.catalog.db.api.CatalogJobDBAdaptor;
import org.opencb.opencga.catalog.db.api.CatalogSampleDBAdaptor;
import org.opencb.opencga.catalog.CatalogManager; |
<<<<<<<
.enableDefaultTyping(NoCheckSubTypeValidator.instance,
DefaultTyping.NON_FINAL)
=======
.activateDefaultTyping(NoCheckSubTypeValidator.instance,
ObjectMapper.DefaultTyping.NON_FINAL)
>>>>>>>
.activateDefaultTyping(NoCheckSubTypeValidator.instance,
DefaultTyping.NON_FINAL) |
<<<<<<<
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
=======
import java.net.URI;
import java.nio.file.Path;
>>>>>>>
import java.io.IOException;
import java.net.URI;
import java.nio.file.Path;
import java.util.ArrayList;
<<<<<<<
public void loadVariantAnnotation(URI uri, ObjectMap params) throws IOException, StorageEngineException {
super.loadVariantAnnotation(uri, params);
VariantStorageMetadataManager metadataManager = dbAdaptor.getMetadataManager();
SampleIndexAnnotationLoader indexAnnotationLoader = new SampleIndexAnnotationLoader(
dbAdaptor.getGenomeHelper(),
dbAdaptor.getHBaseManager(),
dbAdaptor.getTableNameGenerator(),
metadataManager);
// TODO: Do not update all samples
for (Integer studyId : metadataManager.getStudyIds(null)) {
StudyConfiguration sc = metadataManager.getStudyConfiguration(studyId, null).first();
Set<Integer> indexedSamples = sc.getIndexedFiles()
.stream()
.flatMap(fileId -> sc.getSamplesInFiles().get(fileId).stream())
.collect(Collectors.toSet());
if (!indexedSamples.isEmpty()) {
indexAnnotationLoader.updateSampleAnnotation(studyId, new ArrayList<>(indexedSamples));
}
}
}
@Override
=======
public URI createAnnotation(Path outDir, String fileName, Query query, ObjectMap params) throws VariantAnnotatorException {
// Do not allow FILE filter when annotating.
query.remove(VariantQueryParam.FILE.key());
return super.createAnnotation(outDir, fileName, query, params);
}
@Override
>>>>>>>
public URI createAnnotation(Path outDir, String fileName, Query query, ObjectMap params) throws VariantAnnotatorException {
// Do not allow FILE filter when annotating.
query.remove(VariantQueryParam.FILE.key());
return super.createAnnotation(outDir, fileName, query, params);
}
@Override
public void loadVariantAnnotation(URI uri, ObjectMap params) throws IOException, StorageEngineException {
super.loadVariantAnnotation(uri, params);
VariantStorageMetadataManager metadataManager = dbAdaptor.getMetadataManager();
SampleIndexAnnotationLoader indexAnnotationLoader = new SampleIndexAnnotationLoader(
dbAdaptor.getGenomeHelper(),
dbAdaptor.getHBaseManager(),
dbAdaptor.getTableNameGenerator(),
metadataManager);
// TODO: Do not update all samples
for (Integer studyId : metadataManager.getStudyIds(null)) {
StudyConfiguration sc = metadataManager.getStudyConfiguration(studyId, null).first();
Set<Integer> indexedSamples = sc.getIndexedFiles()
.stream()
.flatMap(fileId -> sc.getSamplesInFiles().get(fileId).stream())
.collect(Collectors.toSet());
if (!indexedSamples.isEmpty()) {
indexAnnotationLoader.updateSampleAnnotation(studyId, new ArrayList<>(indexedSamples));
}
}
}
@Override |
<<<<<<<
// This separator is not valid at Bytes.toStringBinary
private static final String REGION_SEPARATOR = "\\\\";
=======
public static final String DELETE_HBASE_COLUMN_MAPPER_CLASS = "delete.hbase.column.mapper.class";
private String table;
private List<String> columns;
@Override
public int run(String[] args) throws Exception {
Configuration conf = getConf();
HBaseConfiguration.addHbaseResources(conf);
getConf().setClassLoader(DeleteHBaseColumnDriver.class.getClassLoader());
configFromArgs(args);
// int maxKeyValueSize = conf.getInt(HadoopVariantStorageEngine.MAPREDUCE_HBASE_KEYVALUE_SIZE_MAX, 10485760); // 10MB
// logger.info("HBASE: set " + ConnectionConfiguration.MAX_KEYVALUE_SIZE_KEY + " to " + maxKeyValueSize);
// conf.setInt(ConnectionConfiguration.MAX_KEYVALUE_SIZE_KEY, maxKeyValueSize); // always overwrite server default (usually 1MB)
/* -------------------------------*/
// JOB setup
Job job = Job.getInstance(getConf(), "opencga: delete columns from table '" + table + '\'');
job.getConfiguration().set("mapreduce.job.user.classpath.first", "true");
job.setJarByClass(DeleteHBaseColumnMapper.class); // class that contains mapper
// // Increase the ScannerTimeoutPeriod to avoid ScannerTimeoutExceptions
// // See opencb/opencga#352 for more info.
// int scannerTimeout = getConf().getInt(MAPREDUCE_HBASE_SCANNER_TIMEOUT,
// getConf().getInt(HConstants.HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD, HConstants.DEFAULT_HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD));
// logger.info("Set Scanner timeout to " + scannerTimeout + " ...");
// job.getConfiguration().setInt(HConstants.HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD, scannerTimeout);
setupJob(job, table, columns);
boolean succeed = executeJob(job);
if (!succeed) {
LOGGER.error("error with job!");
}
>>>>>>>
// This separator is not valid at Bytes.toStringBinary
private static final String REGION_SEPARATOR = "\\\\";
public static final String DELETE_HBASE_COLUMN_MAPPER_CLASS = "delete.hbase.column.mapper.class";
<<<<<<<
Delete delete = new Delete(result.getRow());
if (deleteAllColumns) {
context.getCounter("DeleteColumn", "delete").increment(1);
context.write(key, delete);
} else {
for (Cell cell : result.rawCells()) {
byte[] family = CellUtil.cloneFamily(cell);
byte[] qualifier = CellUtil.cloneQualifier(cell);
String c = Bytes.toString(family) + ':' + Bytes.toString(qualifier);
if (columnsToDelete.contains(c)) {
delete.addColumn(family, qualifier);
if (columnsToCount.contains(c)) {
context.getCounter("DeleteColumn", c).increment(1);
}
}
}
if (!delete.isEmpty()) {
context.getCounter("DeleteColumn", "delete").increment(1);
context.write(key, delete);
=======
Delete delete = new Delete(result.getRow());
for (Cell cell : result.rawCells()) {
byte[] family = CellUtil.cloneFamily(cell);
byte[] qualifier = CellUtil.cloneQualifier(cell);
delete.addColumn(family, qualifier);
if (!columnsToCount.isEmpty()) {
String c = Bytes.toString(family) + ":" + Bytes.toString(qualifier);
if (columnsToCount.contains(c)) {
context.getCounter("DeleteColumn", c).increment(1);
}
>>>>>>>
Delete delete = new Delete(result.getRow());
if (deleteAllColumns) {
context.getCounter("DeleteColumn", "delete").increment(1);
context.write(key, delete);
} else {
for (Cell cell : result.rawCells()) {
byte[] family = CellUtil.cloneFamily(cell);
byte[] qualifier = CellUtil.cloneQualifier(cell);
String c = Bytes.toString(family) + ':' + Bytes.toString(qualifier);
if (columnsToDelete.contains(c)) {
delete.addColumn(family, qualifier);
if (columnsToCount.contains(c)) {
context.getCounter("DeleteColumn", c).increment(1);
}
}
}
if (!delete.isEmpty()) {
context.getCounter("DeleteColumn", "delete").increment(1);
context.write(key, delete); |
<<<<<<<
for (VariantAnnotation annotation : variantStorageEngine.getAnnotation("v2", null, new QueryOptions(QueryOptions.EXCLUDE, consequenceTypes)).getResult()) {
assertThat(annotation.getConsequenceTypes(), VariantMatchers.isEmpty());
=======
for (VariantAnnotation annotation : variantStorageEngine.getAnnotation("v2", null, new QueryOptions(QueryOptions.EXCLUDE, consequenceTypes)).getResults()) {
assertTrue(annotation.getConsequenceTypes() == null || annotation.getConsequenceTypes().isEmpty());
>>>>>>>
for (VariantAnnotation annotation : variantStorageEngine.getAnnotation("v2", null, new QueryOptions(QueryOptions.EXCLUDE, consequenceTypes)).getResults()) {
assertThat(annotation.getConsequenceTypes(), VariantMatchers.isEmpty()); |
<<<<<<<
Cohort cohort = new Cohort(name, type, TimeUtils.getTime(), description, samples, annotationSetList, attributes);
=======
Cohort cohort = new Cohort(name, type, TimeUtils.getTime(), description, sampleIds, annotationSetList,
catalogManager.getStudyManager().getCurrentRelease(studyId), attributes);
>>>>>>>
Cohort cohort = new Cohort(name, type, TimeUtils.getTime(), description, samples, annotationSetList,
catalogManager.getStudyManager().getCurrentRelease(studyId), attributes); |
<<<<<<<
individualDataResult = individualDBAdaptor.nativeGet(query, queryOptions, user);
=======
individualQueryResult = individualDBAdaptor.nativeGet(studyUid, query, queryOptions, user);
>>>>>>>
individualDataResult = individualDBAdaptor.nativeGet(studyUid, query, queryOptions, user);
<<<<<<<
sampleList = sampleDBAdaptor.nativeGet(query, sampleQueryOptions, user).getResults();
=======
sampleList = sampleDBAdaptor.nativeGet(studyUid, query, sampleQueryOptions, user).getResult();
>>>>>>>
sampleList = sampleDBAdaptor.nativeGet(studyUid, query, sampleQueryOptions, user).getResults(); |
<<<<<<<
=======
import static org.opencb.opencga.storage.core.variant.VariantStorageEngine.Options.RELEASE;
import static org.opencb.opencga.storage.core.variant.VariantStorageEngine.Options.SEARCH_INDEX_LAST_TIMESTAMP;
>>>>>>>
import static org.opencb.opencga.storage.core.variant.VariantStorageEngine.Options.SEARCH_INDEX_LAST_TIMESTAMP;
<<<<<<<
addVariantIdFilter(scan, variant);
=======
regionOrVariant = variant;
byte[] rowKey = VariantPhoenixKeyFactory.generateVariantRowKey(variant);
scan.setStartRow(rowKey);
scan.setStopRow(rowKey);
>>>>>>>
addVariantIdFilter(scan, variant);
regionOrVariant = variant;
<<<<<<<
if (isValidParam(query, VariantHadoopDBAdaptor.ANNOT_NAME)) {
int id = query.getInt(VariantHadoopDBAdaptor.ANNOT_NAME.key());
scan.addColumn(family, Bytes.toBytes(VariantPhoenixHelper.getAnnotationSnapshotColumn(id)));
} else {
scan.addColumn(family, FULL_ANNOTATION.bytes());
scan.addColumn(family, ANNOTATION_ID.bytes());
// Only return RELEASE when reading current annotation
int release = studyConfigurationManager.getProjectMetadata().first().getRelease();
for (int i = 1; i <= release; i++) {
scan.addColumn(family, VariantPhoenixHelper.buildReleaseColumnKey(i));
}
=======
scan.addColumn(family, FULL_ANNOTATION.bytes());
int release = selectElements.getStudyConfigurations().values().stream().map(sc -> sc.getAttributes()
.getInt(RELEASE.key(), RELEASE.defaultValue()))
.max(Integer::compareTo)
.orElse(10);
for (int i = 1; i <= release; i++) {
scan.addColumn(genomeHelper.getColumnFamily(), VariantPhoenixHelper.buildReleaseColumnKey(i));
>>>>>>>
if (isValidParam(query, VariantHadoopDBAdaptor.ANNOT_NAME)) {
int id = query.getInt(VariantHadoopDBAdaptor.ANNOT_NAME.key());
scan.addColumn(family, Bytes.toBytes(VariantPhoenixHelper.getAnnotationSnapshotColumn(id)));
} else {
scan.addColumn(family, FULL_ANNOTATION.bytes());
scan.addColumn(family, ANNOTATION_ID.bytes());
// Only return RELEASE when reading current annotation
int release = studyConfigurationManager.getProjectMetadata().first().getRelease();
for (int i = 1; i <= release; i++) {
scan.addColumn(family, VariantPhoenixHelper.buildReleaseColumnKey(i));
} |
<<<<<<<
import org.apache.commons.collections4.CollectionUtils;
=======
import org.apache.commons.collections.CollectionUtils;
import org.apache.hadoop.hbase.Cell;
>>>>>>>
import org.apache.commons.collections4.CollectionUtils;
import org.apache.hadoop.hbase.Cell; |
<<<<<<<
User user = parseUser(result);
return endQuery("get user", startTime, Arrays.asList(user));
=======
User user;
List<User> users = new LinkedList<>();
try {
if (result.getNumResults() != 0) {
user = jsonUserReader.readValue(result.getResult().get(0).toString()); // TODO fill with jobs and files
users.add(user);
}
} catch (IOException e) {
throw new CatalogManagerException("Fail to parse mongo : " + e.getMessage());
}
return endQuery("get user", startTime, users);
>>>>>>>
User user = parseUser(result);
return endQuery("get user", startTime, Arrays.asList(user));
<<<<<<<
User user = parseUser(queryResult);
queryResult.setResult(user.getProjects());
return queryResult;
}
@Override
public QueryResult deleteProject(int projecetId) throws CatalogManagerException {
return null;
=======
User user;
try {
if (queryResult.getNumResults() != 0) {
user = jsonUserReader.readValue(queryResult.getResult().get(0).toString());
queryResult.setResult(user.getProjects());
} else {
queryResult.setResult(Collections.<Project>emptyList());
}
return queryResult;
} catch (IOException e) {
e.printStackTrace();
throw new CatalogManagerException("Failed to parse mongo schema : " + e.getMessage());
}
>>>>>>>
User user = parseUser(queryResult);
queryResult.setResult(user.getProjects());
return queryResult;
}
@Override
public QueryResult deleteProject(int projecetId) throws CatalogManagerException {
return null;
<<<<<<<
DBObject projection = new BasicDBObject("projects", true); projection.put("_id", false);
QueryResult result = userCollection.find(
query,
null,
null, //projectListConverter
projection);
User user = parseUser(result);
return endQuery(
"User projects list", startTime,
user.getProjects());
=======
DBObject projection = new BasicDBObject("projects", true);
projection.put("_id", false);
QueryResult result = userCollection.find(query, null, null, projection);
User user;
try {
List<Project> projects;
if (result.getNumResults() != 0) {
user = jsonUserReader.readValue(result.getResult().get(0).toString());
projects = user.getProjects();
} else {
projects = Collections.<Project>emptyList();
}
return endQuery("User projects list", startTime, projects);
} catch (IOException e) {
e.printStackTrace();
throw new CatalogManagerException("Fail to parse mongo : " + e.getMessage());
}
>>>>>>>
DBObject projection = new BasicDBObject("projects", true);
projection.put("_id", false);
QueryResult result = userCollection.find(query, null, null, projection);
User user = parseUser(result);
return endQuery(
"User projects list", startTime,
user.getProjects());
<<<<<<<
if (study != null) {
study.setDiskUsage(getDiskUsageByStudy(study.getId()));
}
// TODO study.setAnalysis
// TODO study.setfiles
studies = new LinkedList<>();
studies.add(study);
=======
>>>>>>> |
<<<<<<<
OpenCGAResult<Sample> sampleDataResult = sampleDBAdaptor.get(queryCopy, queryOptions, user);
if (sampleDataResult.getNumResults() == 0) {
sampleDataResult = sampleDBAdaptor.get(queryCopy, queryOptions);
if (sampleDataResult.getNumResults() == 0) {
=======
QueryResult<Sample> sampleQueryResult = sampleDBAdaptor.get(studyUid, queryCopy, queryOptions, user);
if (sampleQueryResult.getNumResults() == 0) {
sampleQueryResult = sampleDBAdaptor.get(queryCopy, queryOptions);
if (sampleQueryResult.getNumResults() == 0) {
>>>>>>>
OpenCGAResult<Sample> sampleDataResult = sampleDBAdaptor.get(studyUid, queryCopy, queryOptions, user);
if (sampleDataResult.getNumResults() == 0) {
sampleDataResult = sampleDBAdaptor.get(queryCopy, queryOptions);
if (sampleDataResult.getNumResults() == 0) {
<<<<<<<
OpenCGAResult<Sample> sampleDataResult = sampleDBAdaptor.get(queryCopy, queryOptions, user);
=======
QueryResult<Sample> sampleQueryResult = sampleDBAdaptor.get(studyUid, queryCopy, queryOptions, user);
>>>>>>>
OpenCGAResult<Sample> sampleDataResult = sampleDBAdaptor.get(studyUid, queryCopy, queryOptions, user);
<<<<<<<
validateNewSample(study, sample, userId);
=======
QueryResult<Sample> sampleQueryResult = sampleDBAdaptor.get(study.getUid(), query, options, userId);
>>>>>>>
validateNewSample(study, sample, userId);
<<<<<<<
query.append(SampleDBAdaptor.QueryParams.STUDY_UID.key(), study.getUid());
OpenCGAResult<Sample> queryResult = sampleDBAdaptor.get(query, options, userId);
auditManager.auditSearch(userId, AuditRecord.Resource.SAMPLE, study.getId(), study.getUuid(), auditParams,
new AuditRecord.Status(AuditRecord.Status.Result.SUCCESS));
return queryResult;
} catch (CatalogException e) {
auditManager.auditSearch(userId, AuditRecord.Resource.SAMPLE, study.getId(), study.getUuid(), auditParams,
new AuditRecord.Status(AuditRecord.Status.Result.ERROR, e.getError()));
throw e;
}
=======
query.append(SampleDBAdaptor.QueryParams.STUDY_UID.key(), study.getUid());
QueryResult<Sample> queryResult = sampleDBAdaptor.get(study.getUid(), query, options, userId);
return queryResult;
>>>>>>>
query.append(SampleDBAdaptor.QueryParams.STUDY_UID.key(), study.getUid());
OpenCGAResult<Sample> queryResult = sampleDBAdaptor.get(study.getUid(), query, options, userId);
auditManager.auditSearch(userId, AuditRecord.Resource.SAMPLE, study.getId(), study.getUuid(), auditParams,
new AuditRecord.Status(AuditRecord.Status.Result.SUCCESS));
return queryResult;
} catch (CatalogException e) {
auditManager.auditSearch(userId, AuditRecord.Resource.SAMPLE, study.getId(), study.getUuid(), auditParams,
new AuditRecord.Status(AuditRecord.Status.Result.ERROR, e.getError()));
throw e;
}
<<<<<<<
ObjectMap auditParams = new ObjectMap()
.append("study", studyStr)
.append("sampleIds", sampleIds)
.append("params", params)
.append("ignoreException", ignoreException)
.append("token", token);
boolean checkPermissions;
try {
// If the user is the owner or the admin, we won't check if he has permissions for every single entry
checkPermissions = !authorizationManager.checkIsOwnerOrAdmin(study.getUid(), userId);
} catch (CatalogException e) {
auditManager.auditDelete(operationId, userId, AuditRecord.Resource.SAMPLE, "", "", study.getId(), study.getUuid(),
auditParams, new AuditRecord.Status(AuditRecord.Status.Result.ERROR, e.getError()));
throw e;
}
OpenCGAResult result = OpenCGAResult.empty();
for (String id : sampleIds) {
String sampleId = id;
String sampleUuid = "";
try {
OpenCGAResult<Sample> internalResult = internalGet(study.getUid(), id, INCLUDE_SAMPLE_IDS, userId);
if (internalResult.getNumResults() == 0) {
throw new CatalogException("Sample '" + id + "' not found");
}
Sample sample = internalResult.first();
// We set the proper values for the audit
sampleId = sample.getId();
sampleUuid = sample.getUuid();
if (checkPermissions) {
authorizationManager.checkSamplePermission(study.getUid(), sample.getUid(), userId,
SampleAclEntry.SamplePermissions.DELETE);
}
// Check if the sample can be deleted
checkSampleCanBeDeleted(study.getUid(), sample, params.getBoolean(Constants.FORCE, false));
result.append(sampleDBAdaptor.delete(sample));
auditManager.auditDelete(operationId, userId, AuditRecord.Resource.SAMPLE, sample.getId(), sample.getUuid(),
study.getId(), study.getUuid(), auditParams, new AuditRecord.Status(AuditRecord.Status.Result.SUCCESS));
} catch (CatalogException e) {
String errorMsg = "Cannot delete sample " + sampleId + ": " + e.getMessage();
Event event = new Event(Event.Type.ERROR, sampleId, e.getMessage());
result.getEvents().add(event);
logger.error(errorMsg);
auditManager.auditDelete(operationId, userId, AuditRecord.Resource.SAMPLE, sampleId, sampleUuid,
study.getId(), study.getUuid(), auditParams, new AuditRecord.Status(AuditRecord.Status.Result.ERROR, e.getError()));
}
}
return endResult(result, ignoreException);
=======
query.append(SampleDBAdaptor.QueryParams.STUDY_UID.key(), study.getUid());
QueryResult<Long> queryResultAux = sampleDBAdaptor.count(study.getUid(), query, userId,
StudyAclEntry.StudyPermissions.VIEW_SAMPLES);
return new QueryResult<>("count", queryResultAux.getDbTime(), 0, queryResultAux.first(), queryResultAux.getWarningMsg(),
queryResultAux.getErrorMsg(), Collections.emptyList());
>>>>>>>
ObjectMap auditParams = new ObjectMap()
.append("study", studyStr)
.append("sampleIds", sampleIds)
.append("params", params)
.append("ignoreException", ignoreException)
.append("token", token);
boolean checkPermissions;
try {
// If the user is the owner or the admin, we won't check if he has permissions for every single entry
checkPermissions = !authorizationManager.checkIsOwnerOrAdmin(study.getUid(), userId);
} catch (CatalogException e) {
auditManager.auditDelete(operationId, userId, AuditRecord.Resource.SAMPLE, "", "", study.getId(), study.getUuid(),
auditParams, new AuditRecord.Status(AuditRecord.Status.Result.ERROR, e.getError()));
throw e;
}
OpenCGAResult result = OpenCGAResult.empty();
for (String id : sampleIds) {
String sampleId = id;
String sampleUuid = "";
try {
OpenCGAResult<Sample> internalResult = internalGet(study.getUid(), id, INCLUDE_SAMPLE_IDS, userId);
if (internalResult.getNumResults() == 0) {
throw new CatalogException("Sample '" + id + "' not found");
}
Sample sample = internalResult.first();
// We set the proper values for the audit
sampleId = sample.getId();
sampleUuid = sample.getUuid();
if (checkPermissions) {
authorizationManager.checkSamplePermission(study.getUid(), sample.getUid(), userId,
SampleAclEntry.SamplePermissions.DELETE);
}
// Check if the sample can be deleted
checkSampleCanBeDeleted(study.getUid(), sample, params.getBoolean(Constants.FORCE, false));
result.append(sampleDBAdaptor.delete(sample));
auditManager.auditDelete(operationId, userId, AuditRecord.Resource.SAMPLE, sample.getId(), sample.getUuid(),
study.getId(), study.getUuid(), auditParams, new AuditRecord.Status(AuditRecord.Status.Result.SUCCESS));
} catch (CatalogException e) {
String errorMsg = "Cannot delete sample " + sampleId + ": " + e.getMessage();
Event event = new Event(Event.Type.ERROR, sampleId, e.getMessage());
result.getEvents().add(event);
logger.error(errorMsg);
auditManager.auditDelete(operationId, userId, AuditRecord.Resource.SAMPLE, sampleId, sampleUuid,
study.getId(), study.getUuid(), auditParams, new AuditRecord.Status(AuditRecord.Status.Result.ERROR, e.getError()));
}
}
return endResult(result, ignoreException);
<<<<<<<
iterator = sampleDBAdaptor.iterator(finalQuery, INCLUDE_SAMPLE_IDS, userId);
=======
iterator = sampleDBAdaptor.iterator(study.getUid(), finalQuery, QueryOptions.empty(), userId);
>>>>>>>
iterator = sampleDBAdaptor.iterator(study.getUid(), finalQuery, INCLUDE_SAMPLE_IDS, userId);
<<<<<<<
OpenCGAResult queryResult = sampleDBAdaptor.groupBy(query, fields, options, userId);
=======
QueryResult queryResult = sampleDBAdaptor.groupBy(study.getUid(), query, fields, options, userId);
>>>>>>>
OpenCGAResult queryResult = sampleDBAdaptor.groupBy(study.getUid(), query, fields, options, userId);
<<<<<<<
=======
public DBIterator<Sample> indexSolr(Query query) throws CatalogException {
return sampleDBAdaptor.iterator(query, null);
}
>>>>>>> |
<<<<<<<
return new Enums.ExecutionStatus(Enums.ExecutionStatus.ERROR, "File '" + resultJson + "' seems corrupted.");
=======
if (Files.exists(resultJson)) {
logger.warn("File '" + resultJson + "' seems corrupted.");
} else {
logger.warn("Could not find file '" + resultJson + "'.");
}
// return new Job.JobStatus(Job.JobStatus.ERROR, "File '" + resultJson + "' seems corrupted.");
>>>>>>>
if (Files.exists(resultJson)) {
logger.warn("File '" + resultJson + "' seems corrupted.");
} else {
logger.warn("Could not find file '" + resultJson + "'.");
} |
<<<<<<<
* Panel search.
* @param params Map containing any additional optional parameters.
* @return a RestResponse object.
* @throws ClientException ClientException if there is any server error.
*/
public RestResponse<Panel> search(ObjectMap params) throws ClientException {
params = params != null ? params : new ObjectMap();
return execute("panels", null, null, null, "search", params, GET, Panel.class);
}
/**
=======
* Panel search.
* @param params Map containing any of the following optional parameters.
* include: Fields included in the response, whole JSON path must be provided.
* exclude: Fields excluded in the response, whole JSON path must be provided.
* limit: Number of results to be returned.
* skip: Number of results to skip.
* count: Get the total number of results matching the query. Deactivated by default.
* study: Study [[user@]project:]study where study and project can be either the ID or UUID.
* name: Panel name.
* phenotypes: Panel phenotypes.
* variants: Panel variants.
* genes: Panel genes.
* regions: Panel regions.
* categories: Panel categories.
* tags: Panel tags.
* description: Panel description.
* author: Panel author.
* deleted: Boolean to retrieve deleted panels.
* creationDate: Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805.
* modificationDate: Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805.
* global: Boolean indicating which panels are queried (installation or study specific panels).
* release: Release value (Current release from the moment the samples were first created).
* snapshot: Snapshot value (Latest version of samples in the specified release).
* @return a RestResponse object.
* @throws ClientException ClientException if there is any server error.
*/
public RestResponse<Panel> search(ObjectMap params) throws ClientException {
params = params != null ? params : new ObjectMap();
return execute("panels", null, null, null, "search", params, GET, Panel.class);
}
/**
>>>>>>>
* Panel search.
* @param params Map containing any of the following optional parameters.
* include: Fields included in the response, whole JSON path must be provided.
* exclude: Fields excluded in the response, whole JSON path must be provided.
* limit: Number of results to be returned.
* skip: Number of results to skip.
* count: Get the total number of results matching the query. Deactivated by default.
* study: Study [[user@]project:]study where study and project can be either the ID or UUID.
* name: Panel name.
* phenotypes: Panel phenotypes.
* variants: Panel variants.
* genes: Panel genes.
* regions: Panel regions.
* categories: Panel categories.
* tags: Panel tags.
* description: Panel description.
* author: Panel author.
* deleted: Boolean to retrieve deleted panels.
* creationDate: Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805.
* modificationDate: Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805.
* global: Boolean indicating which panels are queried (installation or study specific panels).
* release: Release value (Current release from the moment the samples were first created).
* snapshot: Snapshot value (Latest version of samples in the specified release).
* @return a RestResponse object.
* @throws ClientException ClientException if there is any server error.
*/
public RestResponse<Panel> search(ObjectMap params) throws ClientException {
params = params != null ? params : new ObjectMap();
return execute("panels", null, null, null, "search", params, GET, Panel.class);
}
/**
<<<<<<<
=======
* @param params Map containing any of the following optional parameters.
* study: Study [[user@]project:]study where study and project can be either the ID or UUID.
* panels: Comma separated list of panel ids.
* @return a RestResponse object.
* @throws ClientException ClientException if there is any server error.
*/
public RestResponse<Panel> delete(String panels, ObjectMap params) throws ClientException {
params = params != null ? params : new ObjectMap();
return execute("panels", panels, null, null, "delete", params, DELETE, Panel.class);
}
/**
* Create a panel.
>>>>>>>
* @param data Panel parameters.
* @param params Map containing any of the following optional parameters.
* study: Study [[user@]project:]study where study and project can be either the ID or UUID.
* panels: Comma separated list of panel ids.
* incVersion: Create a new version of panel.
* @return a RestResponse object.
* @throws ClientException ClientException if there is any server error.
*/
public RestResponse<Panel> update(String panels, PanelUpdateParams data, ObjectMap params) throws ClientException {
params = params != null ? params : new ObjectMap();
params.put("body", data);
return execute("panels", panels, null, null, "update", params, POST, Panel.class);
}
/**
* Delete existing panels.
* @param panels Comma separated list of panel ids.
* @param params Map containing any of the following optional parameters.
* study: Study [[user@]project:]study where study and project can be either the ID or UUID.
* panels: Comma separated list of panel ids.
* @return a RestResponse object.
* @throws ClientException ClientException if there is any server error.
*/
public RestResponse<Panel> delete(String panels, ObjectMap params) throws ClientException {
params = params != null ? params : new ObjectMap();
return execute("panels", panels, null, null, "delete", params, DELETE, Panel.class);
}
/**
* Create a panel.
<<<<<<<
* @param params Map containing any additional optional parameters.
=======
* @param data Panel parameters.
* @param params Map containing any of the following optional parameters.
* study: Study [[user@]project:]study where study and project can be either the ID or UUID.
* panels: Comma separated list of panel ids.
* incVersion: Create a new version of panel.
>>>>>>>
* @param params Map containing any of the following optional parameters.
* study: Study [[user@]project:]study where study and project can be either the ID or UUID.
* panels: Comma separated list of panel ids.
<<<<<<<
/**
* Create a panel.
* @param data Panel parameters.
* @param params Map containing any additional optional parameters.
* @return a RestResponse object.
* @throws ClientException ClientException if there is any server error.
*/
public RestResponse<Panel> create(PanelCreateParams data, ObjectMap params) throws ClientException {
params = params != null ? params : new ObjectMap();
params.put("body", data);
return execute("panels", null, null, null, "create", params, POST, Panel.class);
}
=======
>>>>>>>
/**
* Create a panel.
* @param data Panel parameters.
* @param params Map containing any of the following optional parameters.
* study: Study [[user@]project:]study where study and project can be either the ID or UUID.
* import: Comma separated list of installation panel ids to be imported. To import them all at once, write the special word
* 'ALL_GLOBAL_PANELS'.
* @return a RestResponse object.
* @throws ClientException ClientException if there is any server error.
*/
public RestResponse<Panel> create(PanelCreateParams data, ObjectMap params) throws ClientException {
params = params != null ? params : new ObjectMap();
params.put("body", data);
return execute("panels", null, null, null, "create", params, POST, Panel.class);
} |
<<<<<<<
OpenCGAResult<Panel> panelDataResult = panelDBAdaptor.get(queryCopy, queryOptions, user);
if (panelDataResult.getNumResults() == 0) {
panelDataResult = panelDBAdaptor.get(queryCopy, queryOptions);
if (panelDataResult.getNumResults() == 0) {
=======
QueryResult<Panel> panelQueryResult = panelDBAdaptor.get(studyUid, queryCopy, queryOptions, user);
if (panelQueryResult.getNumResults() == 0) {
panelQueryResult = panelDBAdaptor.get(queryCopy, queryOptions);
if (panelQueryResult.getNumResults() == 0) {
>>>>>>>
OpenCGAResult<Panel> panelDataResult = panelDBAdaptor.get(studyUid, queryCopy, queryOptions, user);
if (panelDataResult.getNumResults() == 0) {
panelDataResult = panelDBAdaptor.get(queryCopy, queryOptions);
if (panelDataResult.getNumResults() == 0) {
<<<<<<<
OpenCGAResult<Panel> panelDataResult = panelDBAdaptor.get(queryCopy, queryOptions, user);
if (ignoreException || panelDataResult.getNumResults() >= uniqueList.size()) {
return keepOriginalOrder(uniqueList, panelStringFunction, panelDataResult, ignoreException,
=======
QueryResult<Panel> panelQueryResult = panelDBAdaptor.get(studyUid, queryCopy, queryOptions, user);
if (silent || panelQueryResult.getNumResults() >= uniqueList.size()) {
return keepOriginalOrder(uniqueList, panelStringFunction, panelQueryResult, silent,
>>>>>>>
OpenCGAResult<Panel> panelDataResult = panelDBAdaptor.get(studyUid, queryCopy, queryOptions, user);
if (ignoreException || panelDataResult.getNumResults() >= uniqueList.size()) {
return keepOriginalOrder(uniqueList, panelStringFunction, panelDataResult, ignoreException,
<<<<<<<
auditManager.auditSearch(userId, AuditRecord.Resource.PANEL, study.getId(), study.getUuid(), auditParams,
new AuditRecord.Status(AuditRecord.Status.Result.SUCCESS));
return result;
} catch (CatalogException e) {
auditManager.auditSearch(userId, AuditRecord.Resource.PANEL, study.getId(), study.getUuid(), auditParams,
new AuditRecord.Status(AuditRecord.Status.Result.ERROR, e.getError()));
throw e;
=======
// Here permissions will be checked
return panelDBAdaptor.get(studyUid, query, options, userId);
>>>>>>>
auditManager.auditSearch(userId, AuditRecord.Resource.PANEL, study.getId(), study.getUuid(), auditParams,
new AuditRecord.Status(AuditRecord.Status.Result.SUCCESS));
return result;
} catch (CatalogException e) {
auditManager.auditSearch(userId, AuditRecord.Resource.PANEL, study.getId(), study.getUuid(), auditParams,
new AuditRecord.Status(AuditRecord.Status.Result.ERROR, e.getError()));
throw e;
<<<<<<<
ObjectMap auditParams = new ObjectMap()
.append("studyId", studyId)
.append("query", new Query(query))
.append("token", token);
try {
OpenCGAResult<Long> queryResultAux;
if (studyId.equals(INSTALLATION_PANELS)) {
query.append(PanelDBAdaptor.QueryParams.STUDY_UID.key(), -1);
// Here view permissions won't be checked
queryResultAux = panelDBAdaptor.count(query);
} else {
query.append(PanelDBAdaptor.QueryParams.STUDY_UID.key(), study.getUid());
// Here view permissions will be checked
queryResultAux = panelDBAdaptor.count(query, userId, StudyAclEntry.StudyPermissions.VIEW_PANELS);
}
auditManager.auditCount(userId, AuditRecord.Resource.PANEL, study.getId(), study.getUuid(), auditParams,
new AuditRecord.Status(AuditRecord.Status.Result.SUCCESS));
return new OpenCGAResult<>(queryResultAux.getTime(), queryResultAux.getEvents(), 0, Collections.emptyList(),
queryResultAux.first());
} catch (CatalogException e) {
auditManager.auditCount(userId, AuditRecord.Resource.PANEL, study.getId(), study.getUuid(), auditParams,
new AuditRecord.Status(AuditRecord.Status.Result.ERROR, e.getError()));
throw e;
=======
// Here view permissions will be checked
queryResultAux = panelDBAdaptor.count(studyUid, query, userId, StudyAclEntry.StudyPermissions.VIEW_PANELS);
>>>>>>>
ObjectMap auditParams = new ObjectMap()
.append("studyId", studyId)
.append("query", new Query(query))
.append("token", token);
try {
OpenCGAResult<Long> queryResultAux;
if (studyId.equals(INSTALLATION_PANELS)) {
query.append(PanelDBAdaptor.QueryParams.STUDY_UID.key(), -1);
// Here view permissions won't be checked
queryResultAux = panelDBAdaptor.count(query);
} else {
query.append(PanelDBAdaptor.QueryParams.STUDY_UID.key(), study.getUid());
// Here view permissions will be checked
queryResultAux = panelDBAdaptor.count(study.getUid(), query, userId, StudyAclEntry.StudyPermissions.VIEW_PANELS);
}
auditManager.auditCount(userId, AuditRecord.Resource.PANEL, study.getId(), study.getUuid(), auditParams,
new AuditRecord.Status(AuditRecord.Status.Result.SUCCESS));
return new OpenCGAResult<>(queryResultAux.getTime(), queryResultAux.getEvents(), 0, Collections.emptyList(),
queryResultAux.first());
} catch (CatalogException e) {
auditManager.auditCount(userId, AuditRecord.Resource.PANEL, study.getId(), study.getUuid(), auditParams,
new AuditRecord.Status(AuditRecord.Status.Result.ERROR, e.getError()));
throw e;
<<<<<<<
iterator = panelDBAdaptor.iterator(finalQuery, INCLUDE_PANEL_IDS, userId);
=======
iterator = panelDBAdaptor.iterator(study.getUid(), finalQuery, QueryOptions.empty(), userId);
>>>>>>>
iterator = panelDBAdaptor.iterator(study.getUid(), finalQuery, INCLUDE_PANEL_IDS, userId);
<<<<<<<
OpenCGAResult queryResult = sampleDBAdaptor.groupBy(query, fields, options, userId);
return ParamUtils.defaultObject(queryResult, OpenCGAResult::new);
=======
QueryResult queryResult = sampleDBAdaptor.groupBy(study.getUid(), query, fields, options, userId);
return ParamUtils.defaultObject(queryResult, QueryResult::new);
>>>>>>>
OpenCGAResult queryResult = sampleDBAdaptor.groupBy(study.getUid(), query, fields, options, userId);
return ParamUtils.defaultObject(queryResult, OpenCGAResult::new); |
<<<<<<<
import org.apache.commons.lang3.StringUtils;
import org.opencb.biodata.models.commons.Software;
=======
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
>>>>>>>
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.opencb.biodata.models.commons.Software;
<<<<<<<
import java.util.*;
=======
import java.util.Collections;
import java.util.List;
import java.util.Map;
>>>>>>>
import java.util.*; |
<<<<<<<
public final SampleEligibilityCommandOptions sampleEligibilityCommandOptions;
=======
public final MutationalSignatureCommandOptions mutationalSignatureCommandOptions;
>>>>>>>
public final SampleEligibilityCommandOptions sampleEligibilityCommandOptions;
public final MutationalSignatureCommandOptions mutationalSignatureCommandOptions;
<<<<<<<
this.sampleEligibilityCommandOptions = new SampleEligibilityCommandOptions();
=======
this.mutationalSignatureCommandOptions = new MutationalSignatureCommandOptions();
>>>>>>>
this.sampleEligibilityCommandOptions = new SampleEligibilityCommandOptions();
this.mutationalSignatureCommandOptions = new MutationalSignatureCommandOptions();
<<<<<<<
@Parameters(commandNames = SampleEligibilityCommandOptions.SAMPLE_ELIGIBILITY_RUN_COMMAND, commandDescription = SampleEligibilityAnalysis.DESCRIPTION)
public class SampleEligibilityCommandOptions {
public static final String SAMPLE_ELIGIBILITY_RUN_COMMAND = "sample-eligibility-run";
@ParametersDelegate
public GeneralCliOptions.CommonCommandOptions commonOptions = commonCommandOptions;
@ParametersDelegate
public Object jobOptions = commonJobOptionsObject;
@Parameter(names = {"--study"}, description = ParamConstants.STUDY_DESCRIPTION)
public String study;
@Parameter(names = {"-o", "--outdir"}, description = "Output directory.", arity = 1, required = false)
public String outdir;
@Parameter(names = {"--query"}, description = "Election query. e.g. ((gene=A AND ct=lof) AND (NOT (gene=B AND ct=lof)))")
public String query;
@Parameter(names = {"--index"}, description = "Create a cohort with the resulting set of samples (if any)")
public boolean index;
@Parameter(names = {"--cohort-id"}, description = "The name of the cohort to be created")
public String cohortId;
}
=======
@Parameters(commandNames = MutationalSignatureCommandOptions.MUTATIONAL_SIGNATURE_RUN_COMMAND, commandDescription = MutationalSignatureAnalysis.DESCRIPTION)
public class MutationalSignatureCommandOptions {
public static final String MUTATIONAL_SIGNATURE_RUN_COMMAND = "mutational-signature-run";
@ParametersDelegate
public GeneralCliOptions.CommonCommandOptions commonOptions = commonCommandOptions;
@Parameter(names = {"--study"}, description = "Study where all the samples belong to.")
public String study;
@Parameter(names = {"--sample"}, description = "Sample name.")
public String sample;
@Parameter(names = {"-o", "--outdir"}, description = "Output directory.", arity = 1, required = false)
public String outdir;
}
>>>>>>>
@Parameters(commandNames = SampleEligibilityCommandOptions.SAMPLE_ELIGIBILITY_RUN_COMMAND, commandDescription = SampleEligibilityAnalysis.DESCRIPTION)
public class SampleEligibilityCommandOptions {
public static final String SAMPLE_ELIGIBILITY_RUN_COMMAND = "sample-eligibility-run";
@ParametersDelegate
public GeneralCliOptions.CommonCommandOptions commonOptions = commonCommandOptions;
@ParametersDelegate
public Object jobOptions = commonJobOptionsObject;
@Parameter(names = {"--study"}, description = ParamConstants.STUDY_DESCRIPTION)
public String study;
@Parameter(names = {"-o", "--outdir"}, description = "Output directory.", arity = 1, required = false)
public String outdir;
@Parameter(names = {"--query"}, description = "Election query. e.g. ((gene=A AND ct=lof) AND (NOT (gene=B AND ct=lof)))")
public String query;
@Parameter(names = {"--index"}, description = "Create a cohort with the resulting set of samples (if any)")
public boolean index;
@Parameter(names = {"--cohort-id"}, description = "The name of the cohort to be created")
public String cohortId;
}
@Parameters(commandNames = MutationalSignatureCommandOptions.MUTATIONAL_SIGNATURE_RUN_COMMAND, commandDescription = MutationalSignatureAnalysis.DESCRIPTION)
public class MutationalSignatureCommandOptions {
public static final String MUTATIONAL_SIGNATURE_RUN_COMMAND = "mutational-signature-run";
@ParametersDelegate
public GeneralCliOptions.CommonCommandOptions commonOptions = commonCommandOptions;
@Parameter(names = {"--study"}, description = "Study where all the samples belong to.")
public String study;
@Parameter(names = {"--sample"}, description = "Sample name.")
public String sample;
@Parameter(names = {"-o", "--outdir"}, description = "Output directory.", arity = 1, required = false)
public String outdir;
} |
<<<<<<<
=======
import org.opencb.hpg.bigdata.analysis.exceptions.AnalysisException;
>>>>>>> |
<<<<<<<
// .append(" --study-id ").append(studyId)
.append(" --database ").append(dbName)
=======
.append(" --study-id ").append(studyId)
.append(" --database ").append(dataStore.getDbName())
>>>>>>>
// .append(" --study-id ").append(studyId)
.append(" --database ").append(dataStore.getDbName()) |
<<<<<<<
public OpenCGAResult<Long> count(final Query query, final String user, final StudyAclEntry.StudyPermissions studyPermissions)
=======
public QueryResult<Long> count(long studyUid, final Query query, final String user,
final StudyAclEntry.StudyPermissions studyPermissions)
>>>>>>>
public OpenCGAResult<Long> count(long studyUid, final Query query, final String user,
final StudyAclEntry.StudyPermissions studyPermissions)
<<<<<<<
Query studyQuery = new Query(StudyDBAdaptor.QueryParams.UID.key(), query.getLong(QueryParams.STUDY_UID.key()));
DataResult queryResult = dbAdaptorFactory.getCatalogStudyDBAdaptor().nativeGet(studyQuery, QueryOptions.empty());
=======
Query studyQuery = new Query(StudyDBAdaptor.QueryParams.UID.key(), studyUid);
QueryResult queryResult = dbAdaptorFactory.getCatalogStudyDBAdaptor().nativeGet(studyQuery, QueryOptions.empty());
>>>>>>>
Query studyQuery = new Query(StudyDBAdaptor.QueryParams.UID.key(), studyUid);
DataResult queryResult = dbAdaptorFactory.getCatalogStudyDBAdaptor().nativeGet(studyQuery, QueryOptions.empty());
<<<<<<<
return new ClinicalAnalysisMongoDBIterator<>(mongoCursor, clinicalConverter, dbAdaptorFactory, query.getLong(PRIVATE_STUDY_UID),
null, options);
=======
return new ClinicalAnalysisMongoDBIterator<>(mongoCursor, clinicalConverter, dbAdaptorFactory, options);
>>>>>>>
return new ClinicalAnalysisMongoDBIterator<>(mongoCursor, clinicalConverter, dbAdaptorFactory, options);
<<<<<<<
return new ClinicalAnalysisMongoDBIterator(mongoCursor, null, dbAdaptorFactory, query.getLong(PRIVATE_STUDY_UID), null,
options);
=======
return new ClinicalAnalysisMongoDBIterator(mongoCursor, null, dbAdaptorFactory, options);
>>>>>>>
return new ClinicalAnalysisMongoDBIterator(mongoCursor, null, dbAdaptorFactory, options);
<<<<<<<
return new ClinicalAnalysisMongoDBIterator(mongoCursor, clinicalConverter, dbAdaptorFactory, query.getLong(PRIVATE_STUDY_UID), user,
options);
=======
return new ClinicalAnalysisMongoDBIterator(mongoCursor, clinicalConverter, dbAdaptorFactory, studyUid, user, options);
>>>>>>>
return new ClinicalAnalysisMongoDBIterator(mongoCursor, clinicalConverter, dbAdaptorFactory, studyUid, user, options);
<<<<<<<
return new ClinicalAnalysisMongoDBIterator(mongoCursor, null, dbAdaptorFactory, query.getLong(PRIVATE_STUDY_UID), user, options);
=======
return new ClinicalAnalysisMongoDBIterator(mongoCursor, null, dbAdaptorFactory, studyUid, user, options);
>>>>>>>
return new ClinicalAnalysisMongoDBIterator(mongoCursor, null, dbAdaptorFactory, studyUid, user, options);
<<<<<<<
Query studyQuery = new Query(StudyDBAdaptor.QueryParams.UID.key(), query.getLong(QueryParams.STUDY_UID.key()));
DataResult<Document> queryResult = dbAdaptorFactory.getCatalogStudyDBAdaptor().nativeGet(studyQuery, QueryOptions.empty());
=======
Query studyQuery = new Query(StudyDBAdaptor.QueryParams.UID.key(), studyUid);
QueryResult<Document> queryResult = dbAdaptorFactory.getCatalogStudyDBAdaptor().nativeGet(studyQuery, QueryOptions.empty());
>>>>>>>
Query studyQuery = new Query(StudyDBAdaptor.QueryParams.UID.key(), studyUid);
DataResult<Document> queryResult = dbAdaptorFactory.getCatalogStudyDBAdaptor().nativeGet(studyQuery, QueryOptions.empty());
<<<<<<<
public OpenCGAResult groupBy(Query query, String field, QueryOptions options, String user)
=======
public QueryResult groupBy(long studyUid, Query query, String field, QueryOptions options, String user)
>>>>>>>
public OpenCGAResult groupBy(long studyUid, Query query, String field, QueryOptions options, String user)
<<<<<<<
public OpenCGAResult groupBy(Query query, List<String> fields, QueryOptions options, String user)
=======
public QueryResult groupBy(long studyUid, Query query, List<String> fields, QueryOptions options, String user)
>>>>>>>
public OpenCGAResult groupBy(long studyUid, Query query, List<String> fields, QueryOptions options, String user)
<<<<<<<
public OpenCGAResult<ClinicalAnalysis> get(Query query, QueryOptions options, String user)
=======
public QueryResult<ClinicalAnalysis> get(long studyUid, Query query, QueryOptions options, String user)
>>>>>>>
public OpenCGAResult<ClinicalAnalysis> get(long studyUid, Query query, QueryOptions options, String user) |
<<<<<<<
=======
import org.opencb.opencga.storage.core.variant.VariantStorageEngine;
>>>>>>>
<<<<<<<
for (Integer studyId : studies.keySet()) {
StudyEntry studyEntry = studies.get(studyId);
stats.getOrDefault(studyId, Collections.emptyMap()).forEach((cohortId, variantStats) -> {
studyEntry.setStats(cohortId.toString(), variantStats);
});
=======
if (!rowsMap.isEmpty()) {
studyIds = rowsMap.keySet();
} else if (fullSamplesData != null && !fullSamplesData.isEmpty()) {
studyIds = fullSamplesData.keySet();
} else if (failOnEmptyVariants) {
throw new IllegalStateException("No Studies supplied for row " + variant);
} else {
studyIds = Collections.emptySet();
}
for (Integer studyId : studyIds) {
Map<String, String> attributesMap = new HashMap<>();
QueryResult<StudyConfiguration> queryResult = scm.getStudyConfiguration(studyId, scmOptions);
if (queryResult.getResult().isEmpty()) {
throw new IllegalStateException("No study found for study ID: " + studyId);
}
StudyConfiguration studyConfiguration = queryResult.first();
LinkedHashMap<String, Integer> returnedSamplesPosition = getReturnedSamplesPosition(studyConfiguration);
if (mutableSamplesPosition) {
returnedSamplesPosition = new LinkedHashMap<>(returnedSamplesPosition);
}
// Do not throw any exception. It may happen that the study is not loaded yet or no samples are required!
// if (returnedSamplesPosition.isEmpty()) {
// throw new IllegalStateException("No samples found for study!!!");
// }
BiMap<String, Integer> loadedSamples = StudyConfiguration.getIndexedSamples(studyConfiguration);
List<String> format;
List<String> expectedFormat;
if (fullSamplesData == null) {
// Only GT and FT available.
format = Arrays.asList(VariantMerger.GT_KEY, VariantMerger.GENOTYPE_FILTER_KEY);
} else {
format = getFormat(studyConfiguration);
}
int[] formatsMap;
if (this.expectedFormat != null && !this.expectedFormat.equals(format)) {
expectedFormat = this.expectedFormat;
formatsMap = new int[expectedFormat.size()];
for (int i = 0; i < expectedFormat.size(); i++) {
formatsMap[i] = format.indexOf(expectedFormat.get(i));
}
} else {
formatsMap = null;
expectedFormat = format;
}
int gtIdx = format.indexOf(VariantMerger.GT_KEY);
int ftIdx = format.indexOf(VariantMerger.GENOTYPE_FILTER_KEY);
int loadedSamplesSize = loadedSamples.size();
// Load Secondary Index
List<AlternateCoordinate> secAltArr = getAlternateCoordinates(variant, studyId,
studyConfiguration.getVariantHeader(), format, rowsMap, fullSamplesData);
Integer nSamples = returnedSamplesPosition.size();
@SuppressWarnings("unchecked")
List<String>[] samplesDataArray = new List[nSamples];
BiMap<Integer, String> mapSampleIds = studyConfiguration.getSampleIds().inverse();
// Read values from sample columns
if (fullSamplesData != null) {
Map<Integer, List<String>> studySampleData = fullSamplesData.getOrDefault(studyId, Collections.emptyMap());
for (Entry<Integer, List<String>> entry : studySampleData.entrySet()) {
Integer sampleId = entry.getKey();
List<String> sampleData = entry.getValue();
String sampleName = mapSampleIds.get(sampleId);
if (sampleData.size() != format.size()) {
throw new IllegalStateException();
}
Integer samplePosition = returnedSamplesPosition.get(sampleName);
if (samplePosition != null) {
if (simpleGenotypes && gtIdx >= 0) {
String simpleGenotype = getSimpleGenotype(sampleData.get(gtIdx));
sampleData.set(gtIdx, simpleGenotype);
}
if (formatsMap != null) {
List<String> filteredSampleData = new ArrayList<>(formatsMap.length);
for (int i : formatsMap) {
if (i < 0) {
filteredSampleData.add(VCFConstants.MISSING_VALUE_v4);
} else {
filteredSampleData.add(sampleData.get(i));
}
}
sampleData = filteredSampleData;
}
samplesDataArray[samplePosition] = sampleData;
} else {
logger.warn("ResultSet containing unwanted samples data returnedSamples: "
+ returnedSamplesPosition + " sample: " + sampleName + " id: " + sampleId);
}
}
List<String> defaultSampleData = new ArrayList<>(expectedFormat.size());
for (String f : expectedFormat) {
if (f.equals(VariantMerger.GT_KEY)) {
String defaultGenotype = getDefaultGenotype(studyConfiguration);
defaultSampleData.add(defaultGenotype); // Read from default genotype
} else {
defaultSampleData.add(VCFConstants.MISSING_VALUE_v4);
}
}
for (int i = 0; i < samplesDataArray.length; i++) {
if (samplesDataArray[i] == null) {
samplesDataArray[i] = defaultSampleData;
}
}
} else {
VariantTableStudyRow row = rowsMap.get(studyId);
calculatePassCallRates(row, attributesMap, loadedSamplesSize);
Set<Integer> sampleWithVariant = new HashSet<>();
for (String genotype : row.getGenotypes()) {
sampleWithVariant.addAll(row.getSampleIds(genotype));
if (genotype.equals(VariantTableStudyRow.OTHER)) {
continue; // skip OTHER -> see Complex type
}
for (Integer sampleId : row.getSampleIds(genotype)) {
String sampleName = mapSampleIds.get(sampleId);
Integer sampleIdx = returnedSamplesPosition.get(sampleName);
if (sampleIdx == null) {
continue; //Sample may not be required. Ignore this sample.
}
List<String> lst = Arrays.asList(genotype, VariantMerger.PASS_VALUE);
samplesDataArray[sampleIdx] = lst;
}
}
// Load complex genotypes
for (Entry<Integer, String> entry : row.getComplexVariant().getSampleToGenotypeMap().entrySet()) {
sampleWithVariant.add(entry.getKey());
Integer samplePosition = getSamplePosition(returnedSamplesPosition, mapSampleIds, entry.getKey());
if (samplePosition == null) {
continue; //Sample may not be required. Ignore this sample.
}
String genotype = entry.getValue();
String returnedGenotype;
// FIXME: Decide what to do with lists of genotypes
if (simpleGenotypes) {
returnedGenotype = getSimpleGenotype(genotype);
logger.debug("Return simplified genotype: {} -> {}", genotype, returnedGenotype);
} else {
returnedGenotype = genotype;
}
samplesDataArray[samplePosition] = Arrays.asList(returnedGenotype, VariantMerger.PASS_VALUE);
}
// Fill gaps (with HOM_REF)
int gapCounter = 0;
for (int i = 0; i < samplesDataArray.length; i++) {
if (samplesDataArray[i] == null) {
++gapCounter;
samplesDataArray[i] = Arrays.asList(VariantTableStudyRow.HOM_REF, VariantMerger.PASS_VALUE);
}
}
// Check homRef count
int homRefCount = loadedSamplesSize;
homRefCount -= sampleWithVariant.size();
if (homRefCount != row.getHomRefCount()) {
String message = "Wrong number of HomRef samples for variant " + variant + ". Got " + homRefCount + ", expect "
+ row.getHomRefCount() + ". Samples number: " + samplesDataArray.length + " , ";
message += "'" + VariantTableStudyRow.HOM_REF + "':" + row.getHomRefCount() + " , ";
for (String studyColumn : VariantTableStudyRow.GENOTYPE_COLUMNS) {
message += "'" + studyColumn + "':" + row.getSampleIds(studyColumn) + " , ";
}
wrongVariant(message);
}
// Set pass field
int passCount = loadedSamplesSize;
for (Entry<String, SampleList> entry : row.getComplexFilter().getFilterNonPass().entrySet()) {
String filterString = entry.getKey();
passCount -= entry.getValue().getSampleIdsCount();
for (Integer id : entry.getValue().getSampleIdsList()) {
Integer samplePosition = getSamplePosition(returnedSamplesPosition, mapSampleIds, id);
if (samplePosition == null) {
continue; // Sample may not be required. Ignore this sample.
}
samplesDataArray[samplePosition].set(ftIdx, filterString);
}
}
// Check pass count
if (passCount != row.getPassCount()) {
String message = String.format(
"Error parsing variant %s. Pass count %s does not match filter fill count: %s using %s loaded samples.",
row.toString(), row.getPassCount(), passCount, loadedSamplesSize);
wrongVariant(message);
}
}
List<List<String>> samplesData = Arrays.asList(samplesDataArray);
StudyEntry studyEntry;
if (studyNameAsStudyId) {
studyEntry = new StudyEntry(studyConfiguration.getStudyName());
} else {
studyEntry = new StudyEntry(Integer.toString(studyConfiguration.getStudyId()));
}
studyEntry.setSortedSamplesPosition(returnedSamplesPosition);
studyEntry.setSamplesData(samplesData);
studyEntry.setFormat(expectedFormat);
studyEntry.setFiles(Collections.singletonList(new FileEntry("", "", attributesMap)));
studyEntry.setSecondaryAlternates(secAltArr);
Map<Integer, VariantStats> convertedStatsMap = stats.get(studyConfiguration.getStudyId());
if (convertedStatsMap != null) {
Map<String, VariantStats> statsMap = new HashMap<>(convertedStatsMap.size());
for (Entry<Integer, VariantStats> entry : convertedStatsMap.entrySet()) {
String cohortName = studyConfiguration.getCohortIds().inverse().get(entry.getKey());
statsMap.put(cohortName, entry.getValue());
}
studyEntry.setStats(statsMap);
}
>>>>>>>
for (Integer studyId : studies.keySet()) {
StudyEntry studyEntry = studies.get(studyId);
stats.getOrDefault(studyId, Collections.emptyMap()).forEach((cohortId, variantStats) -> {
studyEntry.setStats(cohortId.toString(), variantStats);
});
<<<<<<<
// private List<AlternateCoordinate> getAlternateCoordinates(Variant variant, Integer studyId, VariantStudyMetadata variantMetadata,
// List<String> format, Map<Integer, VariantTableStudyRow> rowsMap,
// Map<Integer, Map<Integer, List<String>>> fullSamplesData) {
// List<AlternateCoordinate> secAltArr;
// if (rowsMap.containsKey(studyId)) {
// VariantTableStudyRow row = rowsMap.get(studyId);
// secAltArr = getAlternateCoordinates(variant, row);
// } else {
// secAltArr = samplesDataConverter.extractSecondaryAlternates(variant, variantMetadata, format, fullSamplesData.get(studyId));
// }
// return secAltArr;
// }
=======
private String getDefaultGenotype(StudyConfiguration studyConfiguration) {
String defaultGenotype;
if (VariantStorageEngine.MergeMode.from(studyConfiguration.getAttributes()).equals(VariantStorageEngine.MergeMode.ADVANCED)) {
defaultGenotype = "0/0";
} else {
defaultGenotype = unknownGenotype;
}
return defaultGenotype;
}
private List<AlternateCoordinate> getAlternateCoordinates(Variant variant, Integer studyId, VariantFileHeader variantMetadata,
List<String> format, Map<Integer, VariantTableStudyRow> rowsMap,
Map<Integer, Map<Integer, List<String>>> fullSamplesData) {
List<AlternateCoordinate> secAltArr;
if (rowsMap.containsKey(studyId)) {
VariantTableStudyRow row = rowsMap.get(studyId);
secAltArr = getAlternateCoordinates(variant, row);
} else {
secAltArr = samplesDataConverter.extractSecondaryAlternates(variant, variantMetadata, format, fullSamplesData.get(studyId));
}
return secAltArr;
}
>>>>>>>
// private List<AlternateCoordinate> getAlternateCoordinates(Variant variant, Integer studyId, VariantFileHeader variantMetadata,
// List<String> format, Map<Integer, VariantTableStudyRow> rowsMap,
// Map<Integer, Map<Integer, List<String>>> fullSamplesData) {
// List<AlternateCoordinate> secAltArr;
// if (rowsMap.containsKey(studyId)) {
// VariantTableStudyRow row = rowsMap.get(studyId);
// secAltArr = getAlternateCoordinates(variant, row);
// } else {
// secAltArr = samplesDataConverter.extractSecondaryAlternates(variant, variantMetadata, format, fullSamplesData.get(studyId));
// }
// return secAltArr;
// } |
<<<<<<<
if (hBaseManager.act(connection, tableName, (table, admin) -> admin.tableExists(table.getName()))) {
studyConfigurationList = hBaseManager.act(connection, tableName, table -> {
=======
if (!hBaseManager.act(getConnection(), credentials.getTable(), (table, admin) -> admin.tableExists(table.getName()))) {
studyConfigurationList = hBaseManager.act(getConnection(), credentials.getTable(), table -> {
>>>>>>>
if (hBaseManager.act(getConnection(), tableName, (table, admin) -> admin.tableExists(table.getName()))) {
studyConfigurationList = hBaseManager.act(getConnection(), tableName, table -> {
<<<<<<<
hBaseManager.act(connection, tableName, table -> {
=======
hBaseManager.act(getConnection(), credentials.getTable(), table -> {
>>>>>>>
hBaseManager.act(getConnection(), tableName, table -> {
<<<<<<<
if (!hBaseManager.act(connection, tableName, (table, admin) -> admin.tableExists(table.getName()))) {
=======
if (!hBaseManager.act(getConnection(), credentials.getTable(), (table, admin) -> admin.tableExists(table.getName()))) {
>>>>>>>
if (!hBaseManager.act(getConnection(), tableName, (table, admin) -> admin.tableExists(table.getName()))) {
<<<<<<<
return hBaseManager.act(connection, tableName, table -> {
=======
return hBaseManager.act(getConnection(), credentials.getTable(), table -> {
>>>>>>>
return hBaseManager.act(getConnection(), tableName, table -> {
<<<<<<<
try(Table table = connection.getTable(TableName.valueOf(tableName))) {
=======
try(Table table = getConnection().getTable(TableName.valueOf(credentials.getTable()))) {
>>>>>>>
try(Table table = getConnection().getTable(TableName.valueOf(tableName))) {
<<<<<<<
return hBaseManager.act(connection, tableName, (table, admin) -> {
=======
return hBaseManager.act(getConnection(), credentials.getTable(), (table, admin) -> {
>>>>>>>
return hBaseManager.act(getConnection(), tableName, (table, admin) -> { |
<<<<<<<
OUT_DIR("outDir", TEXT_ARRAY, ""),
OUT_DIR_ID("outDir.id", INTEGER, ""),
=======
RELEASE("release", INTEGER, ""),
OUT_DIR_ID("outDirId", INTEGER_ARRAY, ""),
>>>>>>>
RELEASE("release", INTEGER, ""),
OUT_DIR("outDir", TEXT_ARRAY, ""),
OUT_DIR_ID("outDir.id", INTEGER, ""), |
<<<<<<<
import org.opencb.opencga.storage.core.search.SearchManager;
=======
import org.opencb.opencga.storage.core.metadata.StudyConfigurationManager;
>>>>>>>
import org.opencb.opencga.storage.core.metadata.StudyConfigurationManager;
import org.opencb.opencga.storage.core.search.SearchManager; |
<<<<<<<
taskSupplier = () -> new VariantAvroTransformTask(header, headerVersion, finalSource, finalOutputMetaFile,
statsCalculator);
=======
taskSupplier = () -> new VariantAvroTransformTask(header, headerVersion, finalSource, finalOutputMetaFile, statsCalculator, includeSrc);
>>>>>>>
taskSupplier = () -> new VariantAvroTransformTask(header, headerVersion, finalSource, finalOutputMetaFile,
statsCalculator, includeSrc);
<<<<<<<
VariantJsonTransformTask variantJsonTransformTask =
new VariantJsonTransformTask(factory, finalSource, finalOutputFileJsonFile);
// variantJsonTransformTask.setIncludeSrc(includeSrc);
=======
>>>>>>> |
<<<<<<<
import org.opencb.opencga.storage.core.variant.VariantStorageOptions;
import org.opencb.opencga.storage.core.variant.adaptors.*;
=======
import org.opencb.opencga.storage.core.variant.adaptors.VariantDBAdaptorTest;
import org.opencb.opencga.storage.core.variant.adaptors.VariantQueryParam;
>>>>>>>
import org.opencb.opencga.storage.core.variant.VariantStorageOptions;
import org.opencb.opencga.storage.core.variant.adaptors.VariantDBAdaptorTest;
import org.opencb.opencga.storage.core.variant.adaptors.VariantQueryParam;
<<<<<<<
@Test
public void testQueryFileIndex() throws Exception {
testQueryFileIndex(new Query(TYPE.key(), "SNV"));
testQueryFileIndex(new Query(TYPE.key(), "INDEL"));
}
@Test
public void testQueryAnnotationIndex() throws Exception {
testQueryAnnotationIndex(new Query(ANNOT_BIOTYPE.key(), "protein_coding"));
testQueryAnnotationIndex(new Query(ANNOT_CONSEQUENCE_TYPE.key(), "missense_variant"));
testQueryAnnotationIndex(new Query(ANNOT_CONSEQUENCE_TYPE.key(), "stop_lost"));
testQueryAnnotationIndex(new Query(ANNOT_CONSEQUENCE_TYPE.key(), "stop_lost").append(ANNOT_TRANSCRIPT_FLAG.key(), "basic"));
testQueryAnnotationIndex(new Query(ANNOT_CONSEQUENCE_TYPE.key(), "missense_variant,stop_lost").append(ANNOT_TRANSCRIPT_FLAG.key(), "basic"));
testQueryAnnotationIndex(new Query(ANNOT_CONSEQUENCE_TYPE.key(), "stop_gained"));
testQueryAnnotationIndex(new Query(ANNOT_PROTEIN_SUBSTITUTION.key(), "sift=tolerated"));
testQueryAnnotationIndex(new Query(ANNOT_POPULATION_ALTERNATE_FREQUENCY.key(), "1kG_phase3:ALL<0.001"));
}
public void testQueryAnnotationIndex(Query annotationQuery) throws Exception {
assertFalse(testQueryIndex(annotationQuery).emptyAnnotationIndex());
}
public void testQueryFileIndex(Query annotationQuery) throws Exception {
testQueryIndex(annotationQuery);
}
public SampleIndexQuery testQueryIndex(Query annotationQuery) throws Exception {
return testQueryIndex(annotationQuery, new Query()
.append(STUDY.key(), STUDY_NAME)
.append(SAMPLE.key(), "NA19600"));
}
public SampleIndexQuery testQueryIndex(Query annotationQuery, Query query) throws Exception {
// System.out.println("----------------------------------------------------------");
// queryResult = query(query, new QueryOptions());
// int numResultsSample = queryResult.getNumResults();
// System.out.println("Sample query: " + numResultsSample);
// Query DBAdaptor
System.out.println("Query DBAdaptor");
query.putAll(annotationQuery);
queryResult = query(new Query(query), new QueryOptions());
int onlyDBAdaptor = queryResult.getNumResults();
// Query SampleIndex
System.out.println("Query SampleIndex");
SampleIndexQuery indexQuery = SampleIndexQueryParser.parseSampleIndexQuery(new Query(query), variantStorageEngine.getMetadataManager());
// int onlyIndex = (int) ((HadoopVariantStorageEngine) variantStorageEngine).getSampleIndexDBAdaptor()
// .count(indexQuery, "NA19600");
int onlyIndex = ((HadoopVariantStorageEngine) variantStorageEngine).getSampleIndexDBAdaptor()
.iterator(indexQuery).toDataResult().getNumResults();
// Query SampleIndex+DBAdaptor
System.out.println("Query SampleIndex+DBAdaptor");
VariantQueryResult<Variant> queryResult = variantStorageEngine.get(query, new QueryOptions());
int indexAndDBAdaptor = queryResult.getNumResults();
System.out.println("queryResult.source = " + queryResult.getSource());
System.out.println("----------------------------------------------------------");
System.out.println("query = " + annotationQuery.toJson());
System.out.println("annotationIndex = " + IndexUtils.byteToString(indexQuery.getAnnotationIndexMask()));
for (String sample : indexQuery.getSamplesMap().keySet()) {
System.out.println("fileIndex("+sample+") = " + IndexUtils.maskToString(indexQuery.getFileIndexMask(sample), indexQuery.getFileIndex(sample)));
}
System.out.println("Query ONLY_INDEX = " + onlyIndex);
System.out.println("Query NO_INDEX = " + onlyDBAdaptor);
System.out.println("Query INDEX = " + indexAndDBAdaptor);
if (onlyDBAdaptor != indexAndDBAdaptor) {
queryResult = variantStorageEngine.get(query, new QueryOptions());
List<String> indexAndDB = queryResult.getResults().stream().map(Variant::toString).sorted().collect(Collectors.toList());
queryResult = query(query, new QueryOptions());
List<String> noIndex = queryResult.getResults().stream().map(Variant::toString).sorted().collect(Collectors.toList());
for (String s : indexAndDB) {
if (!noIndex.contains(s)) {
System.out.println("From IndexAndDB, not in NoIndex = " + s);
}
}
for (String s : noIndex) {
if (!indexAndDB.contains(s)) {
System.out.println("From NoIndex, not in IndexAndDB = " + s);
}
}
}
assertEquals(onlyDBAdaptor, indexAndDBAdaptor);
assertThat(queryResult, numResults(lte(onlyIndex)));
assertThat(queryResult, numResults(gt(0)));
return indexQuery;
}
@Test
public void testSampleIndexSkipIntersect() throws StorageEngineException {
Query query = new Query(VariantQueryParam.SAMPLE.key(), sampleNames.get(0)).append(VariantQueryParam.STUDY.key(), studyMetadata.getName());
VariantQueryResult<Variant> result = variantStorageEngine.get(query, new QueryOptions(QueryOptions.INCLUDE, VariantField.ID).append(QueryOptions.LIMIT, 1));
assertEquals("sample_index_table", result.getSource());
query.append(VariantQueryParam.ANNOT_CONSEQUENCE_TYPE.key(), String.join(",", new ArrayList<>(VariantQueryUtils.LOF_SET)));
result = variantStorageEngine.get(query, new QueryOptions(QueryOptions.INCLUDE, VariantField.ID).append(QueryOptions.LIMIT, 1));
assertEquals("sample_index_table", result.getSource());
query.append(VariantQueryParam.ANNOT_CONSEQUENCE_TYPE.key(), String.join(",", new ArrayList<>(VariantQueryUtils.LOF_EXTENDED_SET))).append(TYPE.key(), VariantType.INDEL);
result = variantStorageEngine.get(query, new QueryOptions(QueryOptions.INCLUDE, VariantField.ID).append(QueryOptions.LIMIT, 1));
assertEquals("sample_index_table", result.getSource());
query.append(VariantQueryParam.ANNOT_CONSEQUENCE_TYPE.key(), new ArrayList<>(VariantQueryUtils.LOF_EXTENDED_SET)
.subList(2, 4)
.stream()
.collect(Collectors.joining(",")));
result = variantStorageEngine.get(query, new QueryOptions(QueryOptions.INCLUDE, VariantField.ID).append(QueryOptions.LIMIT, 1));
assertNotEquals("sample_index_table", result.getSource());
}
=======
>>>>>>> |
<<<<<<<
import org.opencb.commons.datastore.core.DataResponse;
=======
import org.opencb.biodata.tools.alignment.stats.AlignmentGlobalStats;
>>>>>>>
<<<<<<<
private DataResponse<File> statsQuery() throws IOException {
AlignmentCommandOptions.StatsQueryAlignmentCommandOptions cliOptions = alignmentCommandOptions.statsQueryAlignmentCommandOptions;
=======
private RestResponse coverage() throws CatalogException, IOException {
>>>>>>>
private RestResponse<File> statsQuery() throws IOException {
AlignmentCommandOptions.StatsQueryAlignmentCommandOptions cliOptions = alignmentCommandOptions.statsQueryAlignmentCommandOptions;
<<<<<<<
private DataResponse<RegionCoverage> coverageLog2Ratio() throws IOException {
AlignmentCommandOptions.CoverageLog2RatioAlignmentCommandOptions cliOptions = alignmentCommandOptions.coverageLog2RatioAlignmentCommandOptions;
=======
OpenCGAClient openCGAClient = new OpenCGAClient(clientConfiguration);
RestResponse<RegionCoverage> globalStats = openCGAClient.getAlignmentClient()
.coverage(alignmentCommandOptions.coverageAlignmentCommandOptions.fileId, objectMap);
>>>>>>>
private RestResponse<RegionCoverage> coverageLog2Ratio() throws IOException {
AlignmentCommandOptions.CoverageLog2RatioAlignmentCommandOptions cliOptions = alignmentCommandOptions.coverageLog2RatioAlignmentCommandOptions; |
<<<<<<<
study.setFiles(dbAdaptorFactory.getCatalogFileDBAdaptor().get(query, options, user).getResults());
=======
study.setFiles(dbAdaptorFactory.getCatalogFileDBAdaptor().get(studyId, query, options, user).getResult());
>>>>>>>
study.setFiles(dbAdaptorFactory.getCatalogFileDBAdaptor().get(studyId, query, options, user).getResults());
<<<<<<<
study.setJobs(dbAdaptorFactory.getCatalogJobDBAdaptor().get(query, options, user).getResults());
=======
study.setJobs(dbAdaptorFactory.getCatalogJobDBAdaptor().get(studyId, query, options, user).getResult());
>>>>>>>
study.setJobs(dbAdaptorFactory.getCatalogJobDBAdaptor().get(studyId, query, options, user).getResults());
<<<<<<<
study.setSamples(dbAdaptorFactory.getCatalogSampleDBAdaptor().get(query, options, user).getResults());
=======
study.setSamples(dbAdaptorFactory.getCatalogSampleDBAdaptor().get(studyId, query, options, user).getResult());
>>>>>>>
study.setSamples(dbAdaptorFactory.getCatalogSampleDBAdaptor().get(studyId, query, options, user).getResults());
<<<<<<<
study.setIndividuals(dbAdaptorFactory.getCatalogIndividualDBAdaptor().get(query, options, user).getResults());
=======
study.setIndividuals(dbAdaptorFactory.getCatalogIndividualDBAdaptor().get(studyId, query, options, user).getResult());
>>>>>>>
study.setIndividuals(dbAdaptorFactory.getCatalogIndividualDBAdaptor().get(studyId, query, options, user).getResults()); |
<<<<<<<
/**
* Tool methods
* ***************************
*/
@Override
public QueryResult<Tool> createTool(String userId, Tool tool) throws CatalogManagerException {
long startTime = startQuery();
if (!userExists(userId)) {
throw new CatalogManagerException("User {id:" + userId + "} does not exist");
}
// Check if tools.alias already exists.
DBObject countQuery = BasicDBObjectBuilder
.start("id", userId)
.append("tools.alias", tool.getAlias())
.get();
QueryResult<Long> count = userCollection.count(countQuery);
if(count.getResult().get(0) != 0){
throw new CatalogManagerException( "Tool {alias:\"" + tool.getAlias() + "\"} already exists in this user");
}
tool.setId(getNewToolId());
DBObject toolObject;
try {
toolObject = (DBObject) JSON.parse(jsonObjectWriter.writeValueAsString(tool));
} catch (JsonProcessingException e) {
throw new CatalogManagerException("tool " + tool + " could not be parsed into json", e);
}
DBObject query = new BasicDBObject("id", userId);
query.put("tools.alias", new BasicDBObject("$ne", tool.getAlias()));
DBObject update = new BasicDBObject("$push", new BasicDBObject ("tools", toolObject));
//Update object
QueryResult<WriteResult> queryResult = userCollection.update(query, update, false, false);
if (queryResult.getResult().get(0).getN() == 0) { // Check if the project has been inserted
throw new CatalogManagerException("Tool {alias:\"" + tool.getAlias() + "\"} already exists in this user");
}
return endQuery("Create Job", startTime, getTool(tool.getId()).getResult());
}
public QueryResult<Tool> getTool(int id) throws CatalogManagerException {
long startTime = startQuery();
DBObject query = new BasicDBObject("tools.id", id);
DBObject projection = new BasicDBObject("tools",
new BasicDBObject("$elemMatch",
new BasicDBObject("id", id)
)
);
QueryResult queryResult = userCollection.find(query, new QueryOptions("include", Arrays.asList("tools")), null, projection);
if(queryResult.getNumResults() != 1 ) {
throw new CatalogManagerException("Tool {id:" + id + "} no exists");
}
User user = parseUser(queryResult);
return endQuery("Get tool", startTime, user.getTools());
}
@Override
public int getToolId(String userId, String toolAlias) throws CatalogManagerException {
DBObject query = BasicDBObjectBuilder
.start("id", userId)
.append("tools.alias", toolAlias).get();
DBObject projection = new BasicDBObject("tools",
new BasicDBObject("$elemMatch",
new BasicDBObject("alias", toolAlias)
)
);
QueryResult queryResult = userCollection.find(query, null, null, projection);
if(queryResult.getNumResults() != 1 ) {
throw new CatalogManagerException("Tool {alias:" + toolAlias + "} no exists");
}
User user = parseUser(queryResult);
return user.getTools().get(0).getId();
}
// @Override
// public QueryResult<Tool> searchTool(QueryOptions query, QueryOptions options) {
// long startTime = startQuery();
//
// QueryResult queryResult = userCollection.find(new BasicDBObject(options),
// new QueryOptions("include", Arrays.asList("tools")), null);
//
// User user = parseUser(queryResult);
//
// return endQuery("Get tool", startTime, user.getTools());
// }
=======
@Override
public QueryResult<Job> searchJob(QueryOptions options) throws CatalogManagerException {
long startTime = startQuery();
DBObject query = new BasicDBObject();
if(options.containsKey("unfinished")) {
if(options.getBoolean("unfinished")) {
query.put("state", new BasicDBObject("$ne", Job.RUNNING));
} else {
query.put("state", Job.RUNNING);
}
options.remove("unfinished");
}
query.putAll(options);
QueryResult queryResult = jobCollection.find(query, null, null);
return endQuery("Search job", startTime);
}
>>>>>>>
@Override
public QueryResult<Job> searchJob(QueryOptions options) throws CatalogManagerException {
long startTime = startQuery();
DBObject query = new BasicDBObject();
if(options.containsKey("unfinished")) {
if(options.getBoolean("unfinished")) {
query.put("state", new BasicDBObject("$ne", Job.RUNNING));
} else {
query.put("state", Job.RUNNING);
}
options.remove("unfinished");
}
query.putAll(options);
QueryResult queryResult = jobCollection.find(query, null, null);
return endQuery("Search job", startTime);
}
/**
* Tool methods
* ***************************
*/
@Override
public QueryResult<Tool> createTool(String userId, Tool tool) throws CatalogManagerException {
long startTime = startQuery();
if (!userExists(userId)) {
throw new CatalogManagerException("User {id:" + userId + "} does not exist");
}
// Check if tools.alias already exists.
DBObject countQuery = BasicDBObjectBuilder
.start("id", userId)
.append("tools.alias", tool.getAlias())
.get();
QueryResult<Long> count = userCollection.count(countQuery);
if(count.getResult().get(0) != 0){
throw new CatalogManagerException( "Tool {alias:\"" + tool.getAlias() + "\"} already exists in this user");
}
tool.setId(getNewToolId());
DBObject toolObject;
try {
toolObject = (DBObject) JSON.parse(jsonObjectWriter.writeValueAsString(tool));
} catch (JsonProcessingException e) {
throw new CatalogManagerException("tool " + tool + " could not be parsed into json", e);
}
DBObject query = new BasicDBObject("id", userId);
query.put("tools.alias", new BasicDBObject("$ne", tool.getAlias()));
DBObject update = new BasicDBObject("$push", new BasicDBObject ("tools", toolObject));
//Update object
QueryResult<WriteResult> queryResult = userCollection.update(query, update, false, false);
if (queryResult.getResult().get(0).getN() == 0) { // Check if the project has been inserted
throw new CatalogManagerException("Tool {alias:\"" + tool.getAlias() + "\"} already exists in this user");
}
return endQuery("Create Job", startTime, getTool(tool.getId()).getResult());
}
public QueryResult<Tool> getTool(int id) throws CatalogManagerException {
long startTime = startQuery();
DBObject query = new BasicDBObject("tools.id", id);
DBObject projection = new BasicDBObject("tools",
new BasicDBObject("$elemMatch",
new BasicDBObject("id", id)
)
);
QueryResult queryResult = userCollection.find(query, new QueryOptions("include", Arrays.asList("tools")), null, projection);
if(queryResult.getNumResults() != 1 ) {
throw new CatalogManagerException("Tool {id:" + id + "} no exists");
}
User user = parseUser(queryResult);
return endQuery("Get tool", startTime, user.getTools());
}
@Override
public int getToolId(String userId, String toolAlias) throws CatalogManagerException {
DBObject query = BasicDBObjectBuilder
.start("id", userId)
.append("tools.alias", toolAlias).get();
DBObject projection = new BasicDBObject("tools",
new BasicDBObject("$elemMatch",
new BasicDBObject("alias", toolAlias)
)
);
QueryResult queryResult = userCollection.find(query, null, null, projection);
if(queryResult.getNumResults() != 1 ) {
throw new CatalogManagerException("Tool {alias:" + toolAlias + "} no exists");
}
User user = parseUser(queryResult);
return user.getTools().get(0).getId();
}
// @Override
// public QueryResult<Tool> searchTool(QueryOptions query, QueryOptions options) {
// long startTime = startQuery();
//
// QueryResult queryResult = userCollection.find(new BasicDBObject(options),
// new QueryOptions("include", Arrays.asList("tools")), null);
//
// User user = parseUser(queryResult);
//
// return endQuery("Get tool", startTime, user.getTools());
// } |
<<<<<<<
OpenCGAResult<File> pathDataResult = fileDBAdaptor.get(queryCopy, queryOptions, user);
if (pathDataResult.getNumResults() > 1) {
=======
QueryResult<File> pathQueryResult = fileDBAdaptor.get(studyUid, queryCopy, queryOptions, user);
if (pathQueryResult.getNumResults() > 1) {
>>>>>>>
OpenCGAResult<File> pathDataResult = fileDBAdaptor.get(studyUid, queryCopy, queryOptions, user);
if (pathDataResult.getNumResults() > 1) {
<<<<<<<
OpenCGAResult<File> nameDataResult = fileDBAdaptor.get(queryCopy, queryOptions, user);
if (nameDataResult.getNumResults() > 1) {
=======
QueryResult<File> nameQueryResult = fileDBAdaptor.get(studyUid, queryCopy, queryOptions, user);
if (nameQueryResult.getNumResults() > 1) {
>>>>>>>
OpenCGAResult<File> nameDataResult = fileDBAdaptor.get(studyUid, queryCopy, queryOptions, user);
if (nameDataResult.getNumResults() > 1) {
<<<<<<<
OpenCGAResult<File> fileDataResult = fileDBAdaptor.get(queryCopy, queryOptions, user);
if (fileDataResult.getNumResults() != correctedFileList.size() && idQueryParam == FileDBAdaptor.QueryParams.PATH
=======
QueryResult<File> fileQueryResult = fileDBAdaptor.get(studyUid, queryCopy, queryOptions, user);
if (fileQueryResult.getNumResults() != correctedFileList.size() && idQueryParam == FileDBAdaptor.QueryParams.PATH
>>>>>>>
OpenCGAResult<File> fileDataResult = fileDBAdaptor.get(studyUid, queryCopy, queryOptions, user);
if (fileDataResult.getNumResults() != correctedFileList.size() && idQueryParam == FileDBAdaptor.QueryParams.PATH
<<<<<<<
OpenCGAResult<File> nameDataResult = fileDBAdaptor.get(queryCopy, queryOptions, user);
if (nameDataResult.getNumResults() > fileDataResult.getNumResults()) {
fileDataResult = nameDataResult;
=======
QueryResult<File> nameQueryResult = fileDBAdaptor.get(studyUid, queryCopy, queryOptions, user);
if (nameQueryResult.getNumResults() > fileQueryResult.getNumResults()) {
fileQueryResult = nameQueryResult;
>>>>>>>
OpenCGAResult<File> nameDataResult = fileDBAdaptor.get(studyUid, queryCopy, queryOptions, user);
if (nameDataResult.getNumResults() > fileDataResult.getNumResults()) {
fileDataResult = nameDataResult;
<<<<<<<
fileDataResult = fileDBAdaptor.get(query, options, userId);
fileDataResult.getEvents().add(new Event(Event.Type.WARNING, path, "Folder already existed"));
=======
fileQueryResult = fileDBAdaptor.get(study.getUid(), query, options, userId);
fileQueryResult.setWarningMsg("Folder was already created");
>>>>>>>
fileDataResult = fileDBAdaptor.get(study.getUid(), query, options, userId);
fileDataResult.getEvents().add(new Event(Event.Type.WARNING, path, "Folder already existed"));
<<<<<<<
auditManager.auditCreate(userId, AuditRecord.Action.UPLOAD, AuditRecord.Resource.FILE, file.getId(), file.getUuid(),
study.getId(), study.getUuid(), auditParams, new AuditRecord.Status(AuditRecord.Status.Result.SUCCESS));
=======
QueryResult<File> fileQueryResult = fileDBAdaptor.get(study.getUid(), query, options, userId);
>>>>>>>
auditManager.auditCreate(userId, AuditRecord.Action.UPLOAD, AuditRecord.Resource.FILE, file.getId(), file.getUuid(),
study.getId(), study.getUuid(), auditParams, new AuditRecord.Status(AuditRecord.Status.Result.SUCCESS));
<<<<<<<
OpenCGAResult<File> queryResult = fileDBAdaptor.get(finalQuery, options, userId);
auditManager.auditSearch(userId, AuditRecord.Resource.FILE, study.getId(), study.getUuid(), auditParams,
new AuditRecord.Status(AuditRecord.Status.Result.SUCCESS));
=======
QueryResult<File> queryResult = fileDBAdaptor.get(study.getUid(), query, options, userId);
>>>>>>>
OpenCGAResult<File> queryResult = fileDBAdaptor.get(study.getUid(), finalQuery, options, userId);
auditManager.auditSearch(userId, AuditRecord.Resource.FILE, study.getId(), study.getUuid(), auditParams,
new AuditRecord.Status(AuditRecord.Status.Result.SUCCESS));
<<<<<<<
ObjectMap auditParams = new ObjectMap()
.append("study", studyStr)
.append("fileIds", fileIds)
.append("params", params)
.append("ignoreException", ignoreException)
.append("token", token);
boolean checkPermissions;
try {
// If the user is the owner or the admin, we won't check if he has permissions for every single entry
checkPermissions = !authorizationManager.checkIsOwnerOrAdmin(study.getUid(), userId);
} catch (CatalogException e) {
auditManager.auditDelete(operationUuid, userId, AuditRecord.Resource.FILE, "", "", study.getId(), study.getUuid(),
auditParams, new AuditRecord.Status(AuditRecord.Status.Result.ERROR, e.getError()));
throw e;
}
// We need to avoid processing subfolders or subfiles of an already processed folder independently
Set<String> processedPaths = new HashSet<>();
boolean physicalDelete = params.getBoolean(SKIP_TRASH, false) || params.getBoolean(DELETE_EXTERNAL_FILES, false);
OpenCGAResult<File> result = OpenCGAResult.empty();
for (String id : fileIds) {
String fileId = id;
String fileUuid = "";
try {
OpenCGAResult<File> internalResult = internalGet(study.getUid(), id, INCLUDE_FILE_IDS, userId);
if (internalResult.getNumResults() == 0) {
throw new CatalogException("File '" + id + "' not found");
}
File file = internalResult.first();
// We set the proper values for the audit
fileId = file.getId();
fileUuid = file.getUuid();
if (subpathInPath(file.getPath(), processedPaths)) {
// We skip this folder because it is a subfolder or subfile within an already processed folder
continue;
}
OpenCGAResult updateResult = delete(study, file, params, checkPermissions, physicalDelete, userId);
result.append(updateResult);
// We store the processed path as is
if (file.getType() == File.Type.DIRECTORY) {
processedPaths.add(file.getPath());
}
auditManager.auditDelete(operationUuid, userId, AuditRecord.Resource.FILE, file.getId(), file.getUuid(), study.getId(),
study.getUuid(), auditParams, new AuditRecord.Status(AuditRecord.Status.Result.SUCCESS));
} catch (CatalogException e) {
Event event = new Event(Event.Type.ERROR, fileId, e.getMessage());
result.getEvents().add(event);
logger.error("Could not delete file {}: {}", fileId, e.getMessage(), e);
auditManager.auditDelete(operationUuid, userId, AuditRecord.Resource.FILE, fileId, fileUuid, study.getId(),
study.getUuid(), auditParams, new AuditRecord.Status(AuditRecord.Status.Result.ERROR, e.getError()));
}
}
return endResult(result, ignoreException);
=======
query.append(FileDBAdaptor.QueryParams.STUDY_UID.key(), study.getUid());
QueryResult<Long> queryResultAux = fileDBAdaptor.count(study.getUid(), query, userId, StudyAclEntry.StudyPermissions.VIEW_FILES);
return new QueryResult<>("count", queryResultAux.getDbTime(), 0, queryResultAux.first(), queryResultAux.getWarningMsg(),
queryResultAux.getErrorMsg(), Collections.emptyList());
>>>>>>>
ObjectMap auditParams = new ObjectMap()
.append("study", studyStr)
.append("fileIds", fileIds)
.append("params", params)
.append("ignoreException", ignoreException)
.append("token", token);
boolean checkPermissions;
try {
// If the user is the owner or the admin, we won't check if he has permissions for every single entry
checkPermissions = !authorizationManager.checkIsOwnerOrAdmin(study.getUid(), userId);
} catch (CatalogException e) {
auditManager.auditDelete(operationUuid, userId, AuditRecord.Resource.FILE, "", "", study.getId(), study.getUuid(),
auditParams, new AuditRecord.Status(AuditRecord.Status.Result.ERROR, e.getError()));
throw e;
}
// We need to avoid processing subfolders or subfiles of an already processed folder independently
Set<String> processedPaths = new HashSet<>();
boolean physicalDelete = params.getBoolean(SKIP_TRASH, false) || params.getBoolean(DELETE_EXTERNAL_FILES, false);
OpenCGAResult<File> result = OpenCGAResult.empty();
for (String id : fileIds) {
String fileId = id;
String fileUuid = "";
try {
OpenCGAResult<File> internalResult = internalGet(study.getUid(), id, INCLUDE_FILE_IDS, userId);
if (internalResult.getNumResults() == 0) {
throw new CatalogException("File '" + id + "' not found");
}
File file = internalResult.first();
// We set the proper values for the audit
fileId = file.getId();
fileUuid = file.getUuid();
if (subpathInPath(file.getPath(), processedPaths)) {
// We skip this folder because it is a subfolder or subfile within an already processed folder
continue;
}
OpenCGAResult updateResult = delete(study, file, params, checkPermissions, physicalDelete, userId);
result.append(updateResult);
// We store the processed path as is
if (file.getType() == File.Type.DIRECTORY) {
processedPaths.add(file.getPath());
}
auditManager.auditDelete(operationUuid, userId, AuditRecord.Resource.FILE, file.getId(), file.getUuid(), study.getId(),
study.getUuid(), auditParams, new AuditRecord.Status(AuditRecord.Status.Result.SUCCESS));
} catch (CatalogException e) {
Event event = new Event(Event.Type.ERROR, fileId, e.getMessage());
result.getEvents().add(event);
logger.error("Could not delete file {}: {}", fileId, e.getMessage(), e);
auditManager.auditDelete(operationUuid, userId, AuditRecord.Resource.FILE, fileId, fileUuid, study.getId(),
study.getUuid(), auditParams, new AuditRecord.Status(AuditRecord.Status.Result.ERROR, e.getError()));
}
}
return endResult(result, ignoreException);
<<<<<<<
fileIterator = fileDBAdaptor.iterator(finalQuery, INCLUDE_FILE_IDS, userId);
=======
fileIterator = fileDBAdaptor.iterator(study.getUid(), finalQuery, QueryOptions.empty(), userId);
>>>>>>>
fileIterator = fileDBAdaptor.iterator(study.getUid(), finalQuery, INCLUDE_FILE_IDS, userId);
<<<<<<<
Query query = new Query()
.append(FileDBAdaptor.QueryParams.UID.key(), file.getUid())
.append(FileDBAdaptor.QueryParams.STUDY_UID.key(), study.getUid());
OpenCGAResult<File> result = fileDBAdaptor.get(query, new QueryOptions(), userId);
auditManager.audit(userId, AuditRecord.Action.UNLINK, AuditRecord.Resource.FILE, file.getId(), file.getUuid(), study.getId(),
study.getUuid(), auditParams, new AuditRecord.Status(AuditRecord.Status.Result.SUCCESS));
return result;
} catch (CatalogException e) {
auditManager.audit(userId, AuditRecord.Action.UNLINK, AuditRecord.Resource.FILE, fileId, "", study.getId(), study.getUuid(),
auditParams, new AuditRecord.Status(AuditRecord.Status.Result.ERROR, e.getError()));
throw e;
}
=======
Query query = new Query()
.append(FileDBAdaptor.QueryParams.UID.key(), fileUid)
.append(FileDBAdaptor.QueryParams.STUDY_UID.key(), studyUid)
.append(FileDBAdaptor.QueryParams.STATUS_NAME.key(), Constants.ALL_STATUS);
return fileDBAdaptor.get(studyUid, query, new QueryOptions(), userId);
>>>>>>>
Query query = new Query()
.append(FileDBAdaptor.QueryParams.UID.key(), file.getUid())
.append(FileDBAdaptor.QueryParams.STUDY_UID.key(), study.getUid());
OpenCGAResult<File> result = fileDBAdaptor.get(study.getUid(), query, new QueryOptions(), userId);
auditManager.audit(userId, AuditRecord.Action.UNLINK, AuditRecord.Resource.FILE, file.getId(), file.getUuid(), study.getId(),
study.getUuid(), auditParams, new AuditRecord.Status(AuditRecord.Status.Result.SUCCESS));
return result;
} catch (CatalogException e) {
auditManager.audit(userId, AuditRecord.Action.UNLINK, AuditRecord.Resource.FILE, fileId, "", study.getId(), study.getUuid(),
auditParams, new AuditRecord.Status(AuditRecord.Status.Result.ERROR, e.getError()));
throw e;
}
<<<<<<<
OpenCGAResult queryResult = fileDBAdaptor.groupBy(query, fields, options, userId);
=======
QueryResult queryResult = fileDBAdaptor.groupBy(study.getUid(), query, fields, options, userId);
>>>>>>>
OpenCGAResult queryResult = fileDBAdaptor.groupBy(study.getUid(), query, fields, options, userId); |
<<<<<<<
=======
query.putIfNotEmpty(IndividualDBAdaptor.QueryParams.ANNOTATION_SET_NAME.key(),
individualsCommandOptions.searchCommandOptions.annotationSetName);
query.putAll(individualsCommandOptions.searchCommandOptions.commonOptions.params);
>>>>>>>
query.putAll(individualsCommandOptions.searchCommandOptions.commonOptions.params); |
<<<<<<<
void setToMembers(List<Long> resourceIds, List<String> members, List<String> permissions, Entity entry) throws CatalogDBException;
=======
void setToMembers(List<Long> resourceIds, List<String> members, List<String> permissions, List<String> allPermissions, String entity)
throws CatalogDBException;
>>>>>>>
void setToMembers(List<Long> resourceIds, List<String> members, List<String> permissions, List<String> allPermissions, Entity entity)
throws CatalogDBException; |
<<<<<<<
private static void printAnnotationIndexTable(VariantHadoopDBAdaptor dbAdaptor, Path outDir) throws IOException {
String tableName = dbAdaptor.getTableNameGenerator().getAnnotationIndexTableName();
if (dbAdaptor.getHBaseManager().tableExists(tableName)) {
AnnotationIndexDBAdaptor annotationIndexDBAdaptor = new AnnotationIndexDBAdaptor(dbAdaptor.getHBaseManager(), tableName);
try (PrintStream out = new PrintStream(new FileOutputStream(outDir.resolve("annotation_index.txt").toFile()))) {
annotationIndexDBAdaptor.iterator().forEachRemaining(pair -> {
out.println(pair.getKey() + " -> " + AnnotationIndexConverter.maskToString(pair.getValue()));
});
}
}
}
private static void printVcf(StudyConfiguration studyConfiguration, VariantHadoopDBAdaptor dbAdaptor, Path outDir) throws IOException {
try (OutputStream os = new FileOutputStream(outDir.resolve("variant." + studyConfiguration.getStudyName() + ".vcf").toFile())) {
Query query = new Query(VariantQueryParam.STUDY.key(), studyConfiguration.getStudyName()).append(VariantQueryParam.UNKNOWN_GENOTYPE.key(), ".");
=======
private static void printVcf(StudyMetadata studyMetadata, VariantHadoopDBAdaptor dbAdaptor, Path outDir) throws IOException {
try (OutputStream os = new FileOutputStream(outDir.resolve("variant." + studyMetadata.getName() + ".vcf").toFile())) {
Query query = new Query(VariantQueryParam.STUDY.key(), studyMetadata.getName()).append(VariantQueryParam.UNKNOWN_GENOTYPE.key(), ".");
>>>>>>>
private static void printAnnotationIndexTable(VariantHadoopDBAdaptor dbAdaptor, Path outDir) throws IOException {
String tableName = dbAdaptor.getTableNameGenerator().getAnnotationIndexTableName();
if (dbAdaptor.getHBaseManager().tableExists(tableName)) {
AnnotationIndexDBAdaptor annotationIndexDBAdaptor = new AnnotationIndexDBAdaptor(dbAdaptor.getHBaseManager(), tableName);
try (PrintStream out = new PrintStream(new FileOutputStream(outDir.resolve("annotation_index.txt").toFile()))) {
annotationIndexDBAdaptor.iterator().forEachRemaining(pair -> {
out.println(pair.getKey() + " -> " + AnnotationIndexConverter.maskToString(pair.getValue()));
});
}
}
}
private static void printVcf(StudyMetadata studyMetadata, VariantHadoopDBAdaptor dbAdaptor, Path outDir) throws IOException {
try (OutputStream os = new FileOutputStream(outDir.resolve("variant." + studyMetadata.getName() + ".vcf").toFile())) {
Query query = new Query(VariantQueryParam.STUDY.key(), studyMetadata.getName()).append(VariantQueryParam.UNKNOWN_GENOTYPE.key(), "."); |
<<<<<<<
import org.apache.solr.common.SolrException;
import org.opencb.biodata.models.core.Region;
=======
>>>>>>>
import org.apache.solr.common.SolrException; |
<<<<<<<
AnnotatedMethodCollector(AnnotationIntrospector intr, MixInResolver mixins)
=======
/**
* @since 2.11
*/
private final boolean _collectAnnotations;
AnnotatedMethodCollector(AnnotationIntrospector intr,
MixInResolver mixins, boolean collectAnnotations)
>>>>>>>
private final boolean _collectAnnotations;
AnnotatedMethodCollector(AnnotationIntrospector intr,
MixInResolver mixins, boolean collectAnnotations)
<<<<<<<
TypeResolutionContext tc, MixInResolver mixins, TypeFactory typeFactory,
JavaType type, List<JavaType> superTypes, Class<?> primaryMixIn)
=======
TypeResolutionContext tc,
MixInResolver mixins, TypeFactory types,
JavaType type, List<JavaType> superTypes, Class<?> primaryMixIn,
boolean collectAnnotations)
>>>>>>>
TypeResolutionContext tc, MixInResolver mixins, TypeFactory typeFactory,
JavaType type, List<JavaType> superTypes, Class<?> primaryMixIn,
boolean collectAnnotations)
<<<<<<<
return new AnnotatedMethodCollector(intr, mixins)
.collect(tc, typeFactory, type, superTypes, primaryMixIn);
=======
return new AnnotatedMethodCollector(intr, mixins, collectAnnotations)
.collect(types, tc, type, superTypes, primaryMixIn);
>>>>>>>
return new AnnotatedMethodCollector(intr, mixins, collectAnnotations)
.collect(tc, typeFactory, type, superTypes, primaryMixIn); |
<<<<<<<
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import org.opencb.biodata.formats.io.FileFormatException;
=======
import org.opencb.biodata.formats.pedigree.io.PedigreePedReader;
import org.opencb.biodata.formats.pedigree.io.PedigreeReader;
import org.opencb.biodata.formats.variant.io.VariantReader;
import org.opencb.biodata.formats.variant.io.VariantWriter;
>>>>>>>
import org.opencb.biodata.formats.io.FileFormatException;
<<<<<<<
import org.opencb.biodata.models.variant.VariantSource;
=======
import org.opencb.biodata.models.variant.*;
import org.opencb.commons.containers.list.SortedList;
>>>>>>>
import org.opencb.biodata.models.variant.*;
<<<<<<<
import org.opencb.opencga.app.cli.OptionsParser.CommandLoadAlignments;
import org.opencb.opencga.app.cli.OptionsParser.CommandTransformAlignments;
import org.opencb.opencga.app.cli.OptionsParser.CommandDownloadAlignments;
import org.opencb.opencga.lib.auth.IllegalOpenCGACredentialsException;
=======
import org.opencb.opencga.lib.auth.IllegalOpenCGACredentialsException;
import org.opencb.opencga.lib.auth.MongoCredentials;
import org.opencb.opencga.lib.auth.OpenCGACredentials;
>>>>>>>
import org.opencb.opencga.app.cli.OptionsParser.CommandLoadAlignments;
import org.opencb.opencga.app.cli.OptionsParser.CommandTransformAlignments;
import org.opencb.opencga.app.cli.OptionsParser.CommandDownloadAlignments;
import org.opencb.opencga.lib.auth.IllegalOpenCGACredentialsException;
<<<<<<<
=======
VariantSource source = new VariantSource(variantsPath.getFileName().toString(), c.fileId, c.studyId, c.study, c.studyType, c.aggregated);
indexVariants("transform", source, variantsPath, pedigreePath, outdir, "json", null, c.includeEffect, c.includeStats, c.includeSamples);
} else if (command instanceof CommandLoadVariants) {
CommandLoadVariants c = (CommandLoadVariants) command;
Path variantsPath = Paths.get(c.input + ".variants.json.gz");
Path filePath = Paths.get(c.input + ".file.json.gz");
VariantStudy.StudyType st = c.studyType;
// TODO Right now it doesn't matter if the file is aggregated or not to save it to the database
VariantSource source = new VariantSource(variantsPath.getFileName().toString(), null, null, null, st, VariantSource.Aggregation.NONE);
indexVariants("load", source, variantsPath, filePath, null, c.backend, Paths.get(c.credentials), c.includeEffect, c.includeStats, c.includeSamples);
>>>>>>>
<<<<<<<
/* @Deprecated
=======
>>>>>>>
/* @Deprecated |
<<<<<<<
.append(VariantQueryParam.INCLUDE_FILE.key(), "1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz");
queryResult = query(query, options);
=======
.append(VariantQueryParam.INCLUDE_FILE.key(), file12877);
queryResult = dbAdaptor.get(query, options);
>>>>>>>
.append(VariantQueryParam.INCLUDE_FILE.key(), file12877);
queryResult = query(query, options);
<<<<<<<
queryResult = query(query, options);
assertThat(queryResult, everyResult(allVariants, withStudy("S_1", allOf(withFileId("12877"), withSampleData("NA12877", "GT", anyOf(is("1/1"), is("2/2")))))));
=======
queryResult = dbAdaptor.get(query, options);
assertThat(queryResult, everyResult(allVariants, withStudy("S_1", allOf(withFileId(file12877), withSampleData("NA12877", "GT", anyOf(is("1/1"), is("2/2")))))));
>>>>>>>
queryResult = query(query, options);
assertThat(queryResult, everyResult(allVariants, withStudy("S_1", allOf(withFileId(file12877), withSampleData("NA12877", "GT", anyOf(is("1/1"), is("2/2")))))));
<<<<<<<
queryResult = query(query, options);
assertThat(queryResult, everyResult(allVariants, withStudy("S_1", allOf(withFileId("12877"), withSampleData("NA12877", "GT", anyOf(is("0/1"), is("0/2")))))));
=======
queryResult = dbAdaptor.get(query, options);
assertThat(queryResult, everyResult(allVariants, withStudy("S_1", allOf(withFileId(file12877), withSampleData("NA12877", "GT", anyOf(is("0/1"), is("0/2")))))));
>>>>>>>
queryResult = query(query, options);
assertThat(queryResult, everyResult(allVariants, withStudy("S_1", allOf(withFileId(file12877), withSampleData("NA12877", "GT", anyOf(is("0/1"), is("0/2")))))));
<<<<<<<
queryResult = query(query, options);
assertThat(queryResult, everyResult(allVariants, withStudy("S_1", allOf(withFileId("12877"), withSampleData("NA12877", "GT", anyOf(is("1/2"), is("2/3")))))));
=======
queryResult = dbAdaptor.get(query, options);
assertThat(queryResult, everyResult(allVariants, withStudy("S_1", allOf(withFileId(file12877), withSampleData("NA12877", "GT", anyOf(is("1/2"), is("2/3")))))));
>>>>>>>
queryResult = query(query, options);
assertThat(queryResult, everyResult(allVariants, withStudy("S_1", allOf(withFileId(file12877), withSampleData("NA12877", "GT", anyOf(is("1/2"), is("2/3")))))));
<<<<<<<
.append(VariantQueryParam.FILE.key(), "1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz");
queryResult = query(query, options);
=======
.append(VariantQueryParam.FILE.key(), file12877);
queryResult = dbAdaptor.get(query, options);
>>>>>>>
.append(VariantQueryParam.FILE.key(), file12877);
queryResult = query(query, options);
<<<<<<<
"1K.end.platinum-genomes-vcf-NA12878_S1.genome.vcf.gz");
queryResult = query(query, options);
=======
file12878);
queryResult = dbAdaptor.get(query, options);
>>>>>>>
file12878);
queryResult = query(query, options);
<<<<<<<
"1K.end.platinum-genomes-vcf-NA12878_S1.genome.vcf.gz");
queryResult = query(query, options);
=======
file12878);
queryResult = dbAdaptor.get(query, options);
>>>>>>>
file12878);
queryResult = query(query, options);
<<<<<<<
.append(VariantQueryParam.INCLUDE_FILE.key(), "1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz");
queryResult = query(query, options);
=======
.append(VariantQueryParam.INCLUDE_FILE.key(), file12877);
queryResult = dbAdaptor.get(query, options);
>>>>>>>
.append(VariantQueryParam.INCLUDE_FILE.key(), file12877);
queryResult = query(query, options);
<<<<<<<
"1K.end.platinum-genomes-vcf-NA12882_S1.genome.vcf.gz");
queryResult = query(query, options);
=======
file12882);
queryResult = dbAdaptor.get(query, options);
>>>>>>>
file12882);
queryResult = query(query, options);
<<<<<<<
"1K.end.platinum-genomes-vcf-NA12882_S1.genome.vcf.gz");
queryResult = query(query, options);
=======
file12882);
queryResult = dbAdaptor.get(query, options);
>>>>>>>
file12882);
queryResult = query(query, options);
<<<<<<<
"1K.end.platinum-genomes-vcf-NA12882_S1.genome.vcf.gz");
queryResult = query(query, options);
=======
file12882);
queryResult = dbAdaptor.get(query, options);
>>>>>>>
file12882);
queryResult = query(query, options);
<<<<<<<
"1K.end.platinum-genomes-vcf-NA12882_S1.genome.vcf.gz");
queryResult = query(query, options);
=======
file12882);
queryResult = dbAdaptor.get(query, options);
>>>>>>>
file12882);
queryResult = query(query, options);
<<<<<<<
.append(VariantQueryParam.FILE.key(), "1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz");
queryResult = query(query, options);
=======
.append(VariantQueryParam.FILE.key(), file12877);
queryResult = dbAdaptor.get(query, options);
>>>>>>>
.append(VariantQueryParam.FILE.key(), file12877);
queryResult = query(query, options);
<<<<<<<
.append(VariantQueryParam.FILE.key(), "1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz");
queryResult = query(query, options);
=======
.append(VariantQueryParam.FILE.key(), file12877);
queryResult = dbAdaptor.get(query, options);
>>>>>>>
.append(VariantQueryParam.FILE.key(), file12877);
queryResult = query(query, options);
<<<<<<<
.append(VariantQueryParam.FILE.key(), "1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz");
queryResult = query(query, options);
=======
.append(VariantQueryParam.FILE.key(), file12877);
queryResult = dbAdaptor.get(query, options);
>>>>>>>
.append(VariantQueryParam.FILE.key(), file12877);
queryResult = query(query, options);
<<<<<<<
.append(VariantQueryParam.FILE.key(), "1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz");
queryResult = query(query, options);
=======
.append(VariantQueryParam.FILE.key(), file12877);
queryResult = dbAdaptor.get(query, options);
>>>>>>>
.append(VariantQueryParam.FILE.key(), file12877);
queryResult = query(query, options);
<<<<<<<
.append(VariantQueryParam.FILE.key(), "1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz");
queryResult = query(query, options);
=======
.append(VariantQueryParam.FILE.key(), file12877);
queryResult = dbAdaptor.get(query, options);
>>>>>>>
.append(VariantQueryParam.FILE.key(), file12877);
queryResult = query(query, options);
<<<<<<<
.append(VariantQueryParam.FILE.key(), "1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz");
queryResult = query(query, options);
=======
.append(VariantQueryParam.FILE.key(), file12877);
queryResult = dbAdaptor.get(query, options);
>>>>>>>
.append(VariantQueryParam.FILE.key(), file12877);
queryResult = query(query, options);
<<<<<<<
"1K.end.platinum-genomes-vcf-NA12878_S1.genome.vcf.gz");
queryResult = query(query, options);
=======
file12878);
queryResult = dbAdaptor.get(query, options);
>>>>>>>
file12878);
queryResult = query(query, options);
<<<<<<<
"1K.end.platinum-genomes-vcf-NA12878_S1.genome.vcf.gz");
queryResult = query(query, options);
=======
file12878);
queryResult = dbAdaptor.get(query, options);
>>>>>>>
file12878);
queryResult = query(query, options);
<<<<<<<
"1K.end.platinum-genomes-vcf-NA12878_S1.genome.vcf.gz");
queryResult = query(query, options);
=======
file12878);
queryResult = dbAdaptor.get(query, options);
>>>>>>>
file12878);
queryResult = query(query, options);
<<<<<<<
"1K.end.platinum-genomes-vcf-NA12878_S1.genome.vcf.gz");
queryResult = query(query, options);
=======
file12878);
queryResult = dbAdaptor.get(query, options);
>>>>>>>
file12878);
queryResult = query(query, options);
<<<<<<<
"1K.end.platinum-genomes-vcf-NA12882_S1.genome.vcf.gz");
queryResult = query(query, options);
=======
file12882);
queryResult = dbAdaptor.get(query, options);
>>>>>>>
file12882);
queryResult = query(query, options);
<<<<<<<
.append(VariantQueryParam.FILE.key(), "1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz");
queryResult = query(query, options);
=======
.append(VariantQueryParam.FILE.key(), file12877);
queryResult = dbAdaptor.get(query, options);
>>>>>>>
.append(VariantQueryParam.FILE.key(), file12877);
queryResult = query(query, options);
<<<<<<<
.append(VariantQueryParam.FILE.key(), "1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz");
queryResult = query(query, options);
=======
.append(VariantQueryParam.FILE.key(), file12877);
queryResult = dbAdaptor.get(query, options);
>>>>>>>
.append(VariantQueryParam.FILE.key(), file12877);
queryResult = query(query, options);
<<<<<<<
.append(VariantQueryParam.FILE.key(), "1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz");
queryResult = query(query, options);
=======
.append(VariantQueryParam.FILE.key(), file12877);
queryResult = dbAdaptor.get(query, options);
>>>>>>>
.append(VariantQueryParam.FILE.key(), file12877);
queryResult = query(query, options);
<<<<<<<
.append(VariantQueryParam.FILE.key(), "1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz");
queryResult = query(query, options);
=======
.append(VariantQueryParam.FILE.key(), file12877);
queryResult = dbAdaptor.get(query, options);
>>>>>>>
.append(VariantQueryParam.FILE.key(), file12877);
queryResult = query(query, options); |
<<<<<<<
=======
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.type.TypeReference;
>>>>>>>
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.type.TypeReference;
<<<<<<<
=======
enum ABC {
A, B, C
}
enum AbcLC {
A, B, C;
@JsonValue
public String toLC() {
return name().toLowerCase();
}
}
static class ABCMapWrapper {
public Map<ABC,String> stuff = new HashMap<ABC,String>();
public ABCMapWrapper() {
stuff.put(ABC.B, "bar");
}
}
@JsonSerialize(keyUsing = ABCKeySerializer.class)
public static enum ABCMixin { }
static class BAR<T>{
T value;
public BAR(T value) {
this.value = value;
}
@JsonValue
public T getValue() {
return value;
}
@Override
public String toString() {
return this.getClass().getSimpleName()
+ ", value:" + value
;
}
}
static class UCString {
private String value;
public UCString(String v) {
value = v.toUpperCase();
}
@JsonValue
public String asString() {
return value;
}
}
static class ABCKeySerializer extends JsonSerializer<ABC> {
@Override
public void serialize(ABC value, JsonGenerator gen,
SerializerProvider provider) throws IOException {
gen.writeFieldName("xxx"+value);
}
}
public static class NullKeySerializer extends JsonSerializer<Object>
{
private String _null;
public NullKeySerializer(String s) { _null = s; }
@Override
public void serialize(Object value, JsonGenerator gen, SerializerProvider provider) throws IOException {
gen.writeFieldName(_null);
}
}
public static class NullValueSerializer extends JsonSerializer<Object>
{
private String _null;
public NullValueSerializer(String s) { _null = s; }
@Override
public void serialize(Object value, JsonGenerator gen, SerializerProvider provider) throws IOException {
gen.writeString(_null);
}
}
static class DefaultKeySerializer extends JsonSerializer<Object>
{
@Override
public void serialize(Object value, JsonGenerator g, SerializerProvider provider) throws IOException
{
g.writeFieldName("DEFAULT:"+value);
}
}
>>>>>>>
enum ABC {
A, B, C
}
enum AbcLC {
A, B, C;
@JsonValue
public String toLC() {
return name().toLowerCase();
}
}
static class ABCMapWrapper {
public Map<ABC,String> stuff = new HashMap<ABC,String>();
public ABCMapWrapper() {
stuff.put(ABC.B, "bar");
}
}
@JsonSerialize(keyUsing = ABCKeySerializer.class)
static enum ABCMixin { }
static class BAR<T>{
T value;
public BAR(T value) {
this.value = value;
}
@JsonValue
public T getValue() {
return value;
}
@Override
public String toString() {
return this.getClass().getSimpleName()
+ ", value:" + value
;
}
}
static class UCString {
private String value;
public UCString(String v) {
value = v.toUpperCase();
}
@JsonValue
public String asString() {
return value;
}
}
static class ABCKeySerializer extends JsonSerializer<ABC> {
@Override
public void serialize(ABC value, JsonGenerator gen,
SerializerProvider provider) throws IOException {
gen.writeFieldName("xxx"+value);
}
}
static class NullKeySerializer extends JsonSerializer<Object>
{
private String _null;
public NullKeySerializer(String s) { _null = s; }
@Override
public void serialize(Object value, JsonGenerator gen, SerializerProvider provider) throws IOException {
gen.writeFieldName(_null);
}
}
static class NullValueSerializer extends JsonSerializer<Object>
{
private String _null;
public NullValueSerializer(String s) { _null = s; }
@Override
public void serialize(Object value, JsonGenerator gen, SerializerProvider provider) throws IOException {
gen.writeString(_null);
}
}
static class DefaultKeySerializer extends JsonSerializer<Object>
{
@Override
public void serialize(Object value, JsonGenerator g, SerializerProvider provider) throws IOException {
g.writeFieldName("DEFAULT:"+value);
}
}
<<<<<<<
=======
// [databind#838]
@SuppressWarnings("deprecation")
public void testUnWrappedMapWithKeySerializer() throws Exception{
SimpleModule mod = new SimpleModule("test");
mod.addKeySerializer(ABC.class, new ABCKeySerializer());
final ObjectMapper mapper = new ObjectMapper()
.registerModule(mod)
.enable(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT)
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.disable(SerializationFeature.WRITE_NULL_MAP_VALUES)
.setSerializationInclusion(JsonInclude.Include.NON_EMPTY)
;
Map<ABC,BAR<?>> stuff = new HashMap<ABC,BAR<?>>();
stuff.put(ABC.B, new BAR<String>("bar"));
String json = mapper.writerFor(new TypeReference<Map<ABC,BAR<?>>>() {})
.writeValueAsString(stuff);
assertEquals("{\"xxxB\":\"bar\"}", json);
}
// [databind#838]
public void testUnWrappedMapWithDefaultType() throws Exception{
final ObjectMapper mapper = new ObjectMapper();
SimpleModule mod = new SimpleModule("test");
mod.addKeySerializer(ABC.class, new ABCKeySerializer());
mapper.registerModule(mod);
TypeResolverBuilder<?> typer = ObjectMapper.DefaultTypeResolverBuilder.construct(
ObjectMapper.DefaultTyping.NON_FINAL, mapper.getPolymorphicTypeValidator());
typer = typer.init(JsonTypeInfo.Id.NAME, null);
typer = typer.inclusion(JsonTypeInfo.As.PROPERTY);
//typer = typer.typeProperty(TYPE_FIELD);
typer = typer.typeIdVisibility(true);
mapper.setDefaultTyping(typer);
Map<ABC,String> stuff = new HashMap<ABC,String>();
stuff.put(ABC.B, "bar");
String json = mapper.writerFor(new TypeReference<Map<ABC, String>>() {})
.writeValueAsString(stuff);
assertEquals("{\"@type\":\"HashMap\",\"xxxB\":\"bar\"}", json);
}
// [databind#943]
public void testDynamicMapKeys() throws Exception
{
Map<Object,Integer> stuff = new LinkedHashMap<Object,Integer>();
stuff.put(AbcLC.B, Integer.valueOf(3));
stuff.put(new UCString("foo"), Integer.valueOf(4));
String json = MAPPER.writeValueAsString(stuff);
assertEquals(aposToQuotes("{'b':3,'FOO':4}"), json);
}
>>>>>>>
// [databind#838]
public void testUnWrappedMapWithKeySerializer() throws Exception{
SimpleModule mod = new SimpleModule("test");
mod.addKeySerializer(ABC.class, new ABCKeySerializer());
final ObjectMapper mapper = jsonMapperBuilder()
.changeDefaultPropertyInclusion(incl -> incl.withValueInclusion(JsonInclude.Include.NON_EMPTY))
.enable(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT)
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.addModule(mod)
.build()
;
Map<ABC,BAR<?>> stuff = new HashMap<ABC,BAR<?>>();
stuff.put(ABC.B, new BAR<String>("bar"));
String json = mapper.writerFor(new TypeReference<Map<ABC,BAR<?>>>() {})
.writeValueAsString(stuff);
assertEquals("{\"xxxB\":\"bar\"}", json);
}
// [databind#838]
public void testUnWrappedMapWithDefaultType() throws Exception{
SimpleModule mod = new SimpleModule("test");
mod.addKeySerializer(ABC.class, new ABCKeySerializer());
TypeResolverBuilder<?> typer = new DefaultTypeResolverBuilder(
NoCheckSubTypeValidator.instance,
DefaultTyping.NON_FINAL,
JsonTypeInfo.As.PROPERTY, JsonTypeInfo.Id.NAME, null)
.typeIdVisibility(true);
ObjectMapper mapper = jsonMapperBuilder()
.addModule(mod)
.setDefaultTyping(typer)
.build();
Map<ABC,String> stuff = new HashMap<ABC,String>();
stuff.put(ABC.B, "bar");
String json = mapper.writerFor(new TypeReference<Map<ABC, String>>() {})
.writeValueAsString(stuff);
assertEquals("{\"@type\":\"HashMap\",\"xxxB\":\"bar\"}", json);
}
// [databind#943]
public void testDynamicMapKeys() throws Exception
{
Map<Object,Integer> stuff = new LinkedHashMap<Object,Integer>();
stuff.put(AbcLC.B, Integer.valueOf(3));
stuff.put(new UCString("foo"), Integer.valueOf(4));
String json = MAPPER.writeValueAsString(stuff);
assertEquals(aposToQuotes("{'b':3,'FOO':4}"), json);
} |
<<<<<<<
StudyConfiguration studyConfiguration = studyConfigurationFactory.getStudyConfiguration(studyId, scm, new QueryOptions(), sessionId);
=======
StudyConfiguration studyConfiguration = studyConfigurationManager.getStudyConfiguration(studyId, null, scm, new QueryOptions(), sessionId);
>>>>>>>
StudyConfiguration studyConfiguration = studyConfigurationFactory.getStudyConfiguration(studyId, null, scm, new QueryOptions(), sessionId);
<<<<<<<
Study study = catalogManager.getStudyManager().get(String.valueOf((Long) studyId), null, sessionId).first();
StudyConfiguration studyConfiguration = studyConfigurationManager.getStudyConfiguration(studyId, null, new QueryOptions(), sessionId);
=======
Study study = catalogManager.getStudy(studyId, sessionId).first();
StudyConfiguration studyConfiguration = studyConfigurationManager.getStudyConfiguration(studyId, null, null, new QueryOptions(), sessionId);
>>>>>>>
Study study = catalogManager.getStudyManager().get(String.valueOf((Long) studyId), null, sessionId).first();
StudyConfiguration studyConfiguration = studyConfigurationManager.getStudyConfiguration(studyId, null, null, new QueryOptions(), sessionId); |
<<<<<<<
import org.opencb.commons.utils.StringUtils;
import org.opencb.opencga.catalog.managers.CatalogManagerExternalResource;
=======
>>>>>>>
import org.opencb.commons.utils.StringUtils;
<<<<<<<
=======
import org.opencb.opencga.catalog.managers.CatalogManagerExternalResource;
import org.opencb.opencga.catalog.managers.FileUtils;
import org.opencb.opencga.core.common.StringUtils;
>>>>>>>
import org.opencb.opencga.catalog.managers.CatalogManagerExternalResource;
import org.opencb.opencga.catalog.managers.FileUtils;
<<<<<<<
catalogManager.getUserManager().create("user", "User Name", "[email protected]", PASSWORD, "", null, Account.Type.FULL, null, null);
=======
catalogManager.getUserManager().create("user", "User Name", "[email protected]", PASSWORD, "", null, Account.Type.FULL, null);
>>>>>>>
catalogManager.getUserManager().create("user", "User Name", "[email protected]", PASSWORD, "", null, Account.Type.FULL, null, null); |
<<<<<<<
String study = String.valueOf(job.getAttributes().get(Job.OPENCGA_STUDY));
logger.info("[{}] - Registering job results from '{}'", job.getId(), outDirUri);
=======
logger.info("{} - Registering job results from '{}'", job.getId(), outDirUri);
>>>>>>>
logger.info("[{}] - Registering job results from '{}'", job.getId(), outDirUri);
<<<<<<<
logger.info("[{}] - stdout file '{}'", job.getId(), registeredFile.getUri().getPath());
updateParams.setLog(registeredFile);
=======
updateParams.setStdout(registeredFile);
>>>>>>>
logger.info("[{}] - stdout file '{}'", job.getId(), registeredFile.getUri().getPath());
updateParams.setStdout(registeredFile);
<<<<<<<
logger.info("[{}] - stderr file: '{}'", job.getId(), registeredFile.getUri().getPath());
updateParams.setErrorLog(registeredFile);
=======
updateParams.setStderr(registeredFile);
>>>>>>>
logger.info("[{}] - stderr file: '{}'", job.getId(), registeredFile.getUri().getPath());
updateParams.setStderr(registeredFile); |
<<<<<<<
o.putIfNotNull(FileDBAdaptor.QueryParams.STUDY.key(), filesCommandOptions.indexCommandOptions.studyId);
=======
o.putIfNotNull(VariantStorageManager.Options.RESUME.key(), filesCommandOptions.indexCommandOptions.resume);
>>>>>>>
o.putIfNotNull(FileDBAdaptor.QueryParams.STUDY.key(), filesCommandOptions.indexCommandOptions.studyId);
o.putIfNotNull(VariantStorageManager.Options.RESUME.key(), filesCommandOptions.indexCommandOptions.resume); |
<<<<<<<
=======
import org.opencb.opencga.catalog.monitor.exceptions.ExecutionException;
import org.opencb.opencga.catalog.monitor.executors.old.ExecutorManager;
import org.opencb.opencga.catalog.managers.CatalogManager;
>>>>>>>
<<<<<<<
import org.opencb.opencga.catalog.monitor.exceptions.ExecutionException;
import org.opencb.opencga.catalog.monitor.executors.old.ExecutorManager;
=======
>>>>>>>
import org.opencb.opencga.catalog.monitor.exceptions.ExecutionException;
import org.opencb.opencga.catalog.monitor.executors.old.ExecutorManager;
<<<<<<<
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
=======
import java.util.*;
>>>>>>>
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
<<<<<<<
new Job(jobName, catalogManager.getUserIdBySessionId(sessionId), toolName, description, commandLine, outDir,
inputFiles)));
=======
new Job(jobName, catalogManager.getUserIdBySessionId(sessionId), toolName, description, commandLine, outDir.getId(),
inputFiles, 1)));
>>>>>>>
new Job(jobName, catalogManager.getUserIdBySessionId(sessionId), toolName, description, commandLine, outDir,
inputFiles, 1))); |
<<<<<<<
customAnalysisOptions, opencgaHome.toString(), token);
InterpretationResult interpretationResult = customAnalysis.execute();
=======
customAnalysisOptions, opencgaHome.toString(), sessionId);
InterpretationResult interpretationResult = customAnalysis.compute();
>>>>>>>
customAnalysisOptions, opencgaHome.toString(), token);
InterpretationResult interpretationResult = customAnalysis.compute();
<<<<<<<
null, opencgaHome, token);
List<Variant> variants = secondaryFindingsAnalysis.execute().getResult();
=======
null, opencgaHome, sessionId);
List<Variant> variants = secondaryFindingsAnalysis.compute().getResult();
>>>>>>>
null, opencgaHome, token);
List<Variant> variants = secondaryFindingsAnalysis.compute().getResult(); |
<<<<<<<
TimeUtils.getTime(), description, status, external, size, new Experiment().setId(experimentId), samples,
new Job().setId(jobId), Collections.emptyList(), Collections.emptyList(), null, stats, attributes);
=======
TimeUtils.getTime(), description, status, external, size, new Experiment().setId(experimentId), sampleIds,
new Job().setId(jobId), Collections.emptyList(), Collections.emptyList(), null, stats,
catalogManager.getStudyManager().getCurrentRelease(studyId), attributes);
>>>>>>>
TimeUtils.getTime(), description, status, external, size, new Experiment().setId(experimentId), samples,
new Job().setId(jobId), Collections.emptyList(), Collections.emptyList(), null, stats,
catalogManager.getStudyManager().getCurrentRelease(studyId), attributes);
<<<<<<<
false, 0, new Experiment(), Collections.emptyList(), new Job(), Collections.emptyList(), allFileAcls.getResult(),
null, null, null);
=======
false, 0, new Experiment(), Collections.emptyList(), new Job(), Collections.emptyList(),
allFileAcls.getResult(), null, null, catalogManager.getStudyManager().getCurrentRelease(studyId), null);
>>>>>>>
false, 0, new Experiment(), Collections.emptyList(), new Job(), Collections.emptyList(), allFileAcls.getResult(),
null, null, catalogManager.getStudyManager().getCurrentRelease(studyId), null); |
<<<<<<<
OpenCGAResult<Cohort> cohortDataResult = cohortDBAdaptor.get(queryCopy, queryOptions, user);
if (cohortDataResult.getNumResults() == 0) {
cohortDataResult = cohortDBAdaptor.get(queryCopy, queryOptions);
if (cohortDataResult.getNumResults() == 0) {
=======
QueryResult<Cohort> cohortQueryResult = cohortDBAdaptor.get(studyUid, queryCopy, queryOptions, user);
if (cohortQueryResult.getNumResults() == 0) {
cohortQueryResult = cohortDBAdaptor.get(queryCopy, queryOptions);
if (cohortQueryResult.getNumResults() == 0) {
>>>>>>>
OpenCGAResult<Cohort> cohortDataResult = cohortDBAdaptor.get(studyUid, queryCopy, queryOptions, user);
if (cohortDataResult.getNumResults() == 0) {
cohortDataResult = cohortDBAdaptor.get(queryCopy, queryOptions);
if (cohortDataResult.getNumResults() == 0) {
<<<<<<<
OpenCGAResult<Cohort> cohortDataResult = cohortDBAdaptor.get(queryCopy, queryOptions, user);
=======
QueryResult<Cohort> cohortQueryResult = cohortDBAdaptor.get(studyUid, queryCopy, queryOptions, user);
>>>>>>>
OpenCGAResult<Cohort> cohortDataResult = cohortDBAdaptor.get(studyUid, queryCopy, queryOptions, user);
<<<<<<<
=======
@Override
public QueryResult<Cohort> get(String studyStr, Query query, QueryOptions options, String sessionId) throws CatalogException {
query = ParamUtils.defaultObject(query, Query::new);
options = ParamUtils.defaultObject(options, QueryOptions::new);
String userId = userManager.getUserId(sessionId);
Study study = catalogManager.getStudyManager().resolveId(studyStr, userId, new QueryOptions(QueryOptions.INCLUDE,
StudyDBAdaptor.QueryParams.VARIABLE_SET.key()));
// Fix query if it contains any annotation
AnnotationUtils.fixQueryAnnotationSearch(study, query);
AnnotationUtils.fixQueryOptionAnnotation(options);
fixQueryObject(study, query, userId);
query.append(CohortDBAdaptor.QueryParams.STUDY_UID.key(), study.getUid());
QueryResult<Cohort> cohortQueryResult = cohortDBAdaptor.get(study.getUid(), query, options, userId);
if (cohortQueryResult.getNumResults() == 0 && query.containsKey(CohortDBAdaptor.QueryParams.UID.key())) {
List<Long> idList = query.getAsLongList(CohortDBAdaptor.QueryParams.UID.key());
for (Long myId : idList) {
authorizationManager.checkCohortPermission(study.getUid(), myId, userId, CohortAclEntry.CohortPermissions.VIEW);
}
}
return cohortQueryResult;
}
>>>>>>>
<<<<<<<
query.append(CohortDBAdaptor.QueryParams.STUDY_UID.key(), study.getUid());
OpenCGAResult<Cohort> queryResult = cohortDBAdaptor.get(query, options, userId);
=======
query.append(CohortDBAdaptor.QueryParams.STUDY_UID.key(), study.getUid());
QueryResult<Cohort> queryResult = cohortDBAdaptor.get(study.getUid(), query, options, userId);
// authorizationManager.filterCohorts(userId, studyId, queryResultAux.getResult());
>>>>>>>
query.append(CohortDBAdaptor.QueryParams.STUDY_UID.key(), study.getUid());
OpenCGAResult<Cohort> queryResult = cohortDBAdaptor.get(study.getUid(), query, options, userId);
<<<<<<<
boolean checkPermissions;
try {
// If the user is the owner or the admin, we won't check if he has permissions for every single entry
checkPermissions = !authorizationManager.checkIsOwnerOrAdmin(study.getUid(), userId);
} catch (CatalogException e) {
auditManager.auditDelete(operationId, userId, AuditRecord.Resource.COHORT, "", "", study.getId(), study.getUuid(),
auditParams, new AuditRecord.Status(AuditRecord.Status.Result.ERROR, e.getError()));
throw e;
}
OpenCGAResult result = OpenCGAResult.empty();
for (String id : cohortIds) {
String cohortId = id;
String cohortUuid = "";
try {
OpenCGAResult<Cohort> internalResult = internalGet(study.getUid(), id, INCLUDE_COHORT_IDS, userId);
if (internalResult.getNumResults() == 0) {
throw new CatalogException("Cohort '" + id + "' not found");
}
// We set the proper values for the audit
cohortId = internalResult.first().getId();
cohortUuid = internalResult.first().getUuid();
if (checkPermissions) {
authorizationManager.checkCohortPermission(study.getUid(), internalResult.first().getUid(), userId,
CohortAclEntry.CohortPermissions.DELETE);
}
OpenCGAResult deleteResult = cohortDBAdaptor.delete(internalResult.first());
result.append(deleteResult);
auditManager.auditDelete(operationId, userId, AuditRecord.Resource.COHORT, internalResult.first().getId(),
internalResult.first().getUuid(), study.getId(), study.getUuid(), auditParams,
new AuditRecord.Status(AuditRecord.Status.Result.SUCCESS));
} catch (CatalogException e) {
Event event = new Event(Event.Type.ERROR, id, e.getMessage());
result.getEvents().add(event);
logger.error("Cannot delete cohort {}: {}", cohortId, e.getMessage());
auditManager.auditDelete(operationId, userId, AuditRecord.Resource.COHORT, cohortId, cohortUuid, study.getId(),
study.getUuid(), auditParams, new AuditRecord.Status(AuditRecord.Status.Result.ERROR, e.getError()));
}
}
return endResult(result, ignoreException);
=======
query.append(CohortDBAdaptor.QueryParams.STUDY_UID.key(), study.getUid());
QueryResult<Long> queryResultAux = cohortDBAdaptor.count(study.getUid(), query, userId,
StudyAclEntry.StudyPermissions.VIEW_COHORTS);
return new QueryResult<>("count", queryResultAux.getDbTime(), 0, queryResultAux.first(), queryResultAux.getWarningMsg(),
queryResultAux.getErrorMsg(), Collections.emptyList());
>>>>>>>
boolean checkPermissions;
try {
// If the user is the owner or the admin, we won't check if he has permissions for every single entry
checkPermissions = !authorizationManager.checkIsOwnerOrAdmin(study.getUid(), userId);
} catch (CatalogException e) {
auditManager.auditDelete(operationId, userId, AuditRecord.Resource.COHORT, "", "", study.getId(), study.getUuid(),
auditParams, new AuditRecord.Status(AuditRecord.Status.Result.ERROR, e.getError()));
throw e;
}
OpenCGAResult result = OpenCGAResult.empty();
for (String id : cohortIds) {
String cohortId = id;
String cohortUuid = "";
try {
OpenCGAResult<Cohort> internalResult = internalGet(study.getUid(), id, INCLUDE_COHORT_IDS, userId);
if (internalResult.getNumResults() == 0) {
throw new CatalogException("Cohort '" + id + "' not found");
}
// We set the proper values for the audit
cohortId = internalResult.first().getId();
cohortUuid = internalResult.first().getUuid();
if (checkPermissions) {
authorizationManager.checkCohortPermission(study.getUid(), internalResult.first().getUid(), userId,
CohortAclEntry.CohortPermissions.DELETE);
}
OpenCGAResult deleteResult = cohortDBAdaptor.delete(internalResult.first());
result.append(deleteResult);
auditManager.auditDelete(operationId, userId, AuditRecord.Resource.COHORT, internalResult.first().getId(),
internalResult.first().getUuid(), study.getId(), study.getUuid(), auditParams,
new AuditRecord.Status(AuditRecord.Status.Result.SUCCESS));
} catch (CatalogException e) {
Event event = new Event(Event.Type.ERROR, id, e.getMessage());
result.getEvents().add(event);
logger.error("Cannot delete cohort {}: {}", cohortId, e.getMessage());
auditManager.auditDelete(operationId, userId, AuditRecord.Resource.COHORT, cohortId, cohortUuid, study.getId(),
study.getUuid(), auditParams, new AuditRecord.Status(AuditRecord.Status.Result.ERROR, e.getError()));
}
}
return endResult(result, ignoreException);
<<<<<<<
iterator = cohortDBAdaptor.iterator(finalQuery, INCLUDE_COHORT_IDS, userId);
=======
iterator = cohortDBAdaptor.iterator(study.getUid(), finalQuery, QueryOptions.empty(), userId);
>>>>>>>
iterator = cohortDBAdaptor.iterator(study.getUid(), finalQuery, INCLUDE_COHORT_IDS, userId);
<<<<<<<
OpenCGAResult queryResult = cohortDBAdaptor.groupBy(query, fields, options, userId);
=======
QueryResult queryResult = cohortDBAdaptor.groupBy(study.getUid(), query, fields, options, userId);
>>>>>>>
OpenCGAResult queryResult = cohortDBAdaptor.groupBy(study.getUid(), query, fields, options, userId); |
<<<<<<<
if (isValidParam(query, VariantHadoopDBAdaptor.ANNOT_NAME)) {
String name = query.getString(VariantHadoopDBAdaptor.ANNOT_NAME.key());
scan.addColumn(genomeHelper.getColumnFamily(), Bytes.toBytes(VariantPhoenixHelper.getAnnotationSnapshotColumn(name)));
} else {
scan.addColumn(genomeHelper.getColumnFamily(), FULL_ANNOTATION.bytes());
}
=======
scan.addColumn(family, FULL_ANNOTATION.bytes());
>>>>>>>
if (isValidParam(query, VariantHadoopDBAdaptor.ANNOT_NAME)) {
String name = query.getString(VariantHadoopDBAdaptor.ANNOT_NAME.key());
scan.addColumn(family, Bytes.toBytes(VariantPhoenixHelper.getAnnotationSnapshotColumn(name)));
} else {
scan.addColumn(family, FULL_ANNOTATION.bytes());
} |
<<<<<<<
import org.opencb.opencga.storage.core.variant.VariantStorageOptions;
=======
import org.opencb.opencga.storage.core.variant.VariantStorageEngine;
import org.opencb.opencga.storage.core.variant.adaptors.GenotypeClass;
>>>>>>>
import org.opencb.opencga.storage.core.variant.VariantStorageOptions;
import org.opencb.opencga.storage.core.variant.adaptors.GenotypeClass; |
<<<<<<<
@Deprecated public static final String CONFIG_VCF_META_PROTO_FILE = "opencga.storage.hadoop.vcf.meta.proto.file";
@Deprecated public static final String CONFIG_VCF_META_PROTO_STRING = "opencga.storage.hadoop.vcf.meta.proto.string";
public static final String CONFIG_FILE_ID = "opencga.storage.hadoop.file_id";
public static final String CONFIG_ARCHIVE_TABLE = "opencga.storage.hadoop.archive_table";
=======
public static final String OPENCGA_STORAGE_HADOOP_STUDY_ID = "opencga.storage.hadoop.study.id";
public static final String CONFIG_VCF_META_PROTO_FILE = "opencga.storage.hadoop.vcf.meta.proto.file";
public static final String CONFIG_VCF_META_PROTO_STRING = "opencga.storage.hadoop.vcf.meta.proto.string";
>>>>>>>
@Deprecated public static final String CONFIG_VCF_META_PROTO_FILE = "opencga.storage.hadoop.vcf.meta.proto.file";
@Deprecated public static final String CONFIG_VCF_META_PROTO_STRING = "opencga.storage.hadoop.vcf.meta.proto.string";
public static final String CONFIG_FILE_ID = "opencga.storage.hadoop.file_id";
public static final String OPENCGA_STORAGE_HADOOP_STUDY_ID = "opencga.storage.hadoop.study.id";
public static final String CONFIG_ARCHIVE_TABLE = "opencga.storage.hadoop.archive_table"; |
<<<<<<<
public OpenCGAResult<Long> count(Query query, String user, StudyAclEntry.StudyPermissions studyPermissions)
throws CatalogDBException, CatalogAuthorizationException {
return count(null, query, user, studyPermissions);
}
OpenCGAResult<Long> count(ClientSession clientSession, Query query, String user, StudyAclEntry.StudyPermissions studyPermissions)
=======
public QueryResult<Long> count(long studyUid, Query query, String user, StudyAclEntry.StudyPermissions studyPermissions)
>>>>>>>
public OpenCGAResult<Long> count(long studyUid, Query query, String user, StudyAclEntry.StudyPermissions studyPermissions)
throws CatalogDBException, CatalogAuthorizationException {
return count(null, studyUid, query, user, studyPermissions);
}
OpenCGAResult<Long> count(ClientSession clientSession, long studyUid, Query query, String user,
StudyAclEntry.StudyPermissions studyPermissions)
<<<<<<<
Query studyQuery = new Query(StudyDBAdaptor.QueryParams.UID.key(), query.getLong(QueryParams.STUDY_UID.key()));
OpenCGAResult queryResult = dbAdaptorFactory.getCatalogStudyDBAdaptor().nativeGet(clientSession, studyQuery, QueryOptions.empty());
=======
Query studyQuery = new Query(StudyDBAdaptor.QueryParams.UID.key(), studyUid);
QueryResult queryResult = dbAdaptorFactory.getCatalogStudyDBAdaptor().nativeGet(studyQuery, QueryOptions.empty());
>>>>>>>
Query studyQuery = new Query(StudyDBAdaptor.QueryParams.UID.key(), studyUid);
OpenCGAResult queryResult = dbAdaptorFactory.getCatalogStudyDBAdaptor().nativeGet(clientSession, studyQuery, QueryOptions.empty());
<<<<<<<
return iterator(null, query, options);
}
DBIterator<Individual> iterator(ClientSession clientSession, Query query, QueryOptions options) throws CatalogDBException {
MongoCursor<Document> mongoCursor = getMongoCursor(clientSession, query, options);
return new IndividualMongoDBIterator<>(mongoCursor, individualConverter, null, dbAdaptorFactory, query.getLong(PRIVATE_STUDY_UID),
null, options);
=======
MongoCursor<Document> mongoCursor = getMongoCursor(query, options);
return new IndividualMongoDBIterator<>(mongoCursor, individualConverter, null, dbAdaptorFactory, options);
>>>>>>>
return iterator(null, query, options);
}
DBIterator<Individual> iterator(ClientSession clientSession, Query query, QueryOptions options) throws CatalogDBException {
MongoCursor<Document> mongoCursor = getMongoCursor(clientSession, query, options);
return new IndividualMongoDBIterator<>(mongoCursor, individualConverter, null, dbAdaptorFactory, options);
<<<<<<<
MongoCursor<Document> mongoCursor = getMongoCursor(clientSession, query, queryOptions);
return new IndividualMongoDBIterator(mongoCursor, null, null, dbAdaptorFactory, query.getLong(PRIVATE_STUDY_UID), null, options);
=======
MongoCursor<Document> mongoCursor = getMongoCursor(query, queryOptions);
return new IndividualMongoDBIterator(mongoCursor, null, null, dbAdaptorFactory, options);
>>>>>>>
MongoCursor<Document> mongoCursor = getMongoCursor(clientSession, query, queryOptions);
return new IndividualMongoDBIterator(mongoCursor, null, null, dbAdaptorFactory, options);
<<<<<<<
if (!query.getBoolean(QueryParams.DELETED.key())) {
return individualCollection.nativeQuery().find(clientSession, bson, qOptions).iterator();
} else {
return deletedIndividualCollection.nativeQuery().find(clientSession, bson, qOptions).iterator();
=======
return individualCollection.nativeQuery().find(bson, qOptions).iterator();
}
private Document getStudyDocument(long studyUid) throws CatalogDBException {
// Get the study document
Query studyQuery = new Query(StudyDBAdaptor.QueryParams.UID.key(), studyUid);
QueryResult<Document> queryResult = dbAdaptorFactory.getCatalogStudyDBAdaptor().nativeGet(studyQuery, QueryOptions.empty());
if (queryResult.getNumResults() == 0) {
throw new CatalogDBException("Study " + studyUid + " not found");
>>>>>>>
if (!query.getBoolean(QueryParams.DELETED.key())) {
return individualCollection.nativeQuery().find(clientSession, bson, qOptions).iterator();
} else {
return deletedIndividualCollection.nativeQuery().find(clientSession, bson, qOptions).iterator(); |
<<<<<<<
QueryResult<Study> studyQueryResult = catalogManager.getStudyManager().get(String.valueOf((Long) studyUid), QueryOptions.empty(),
token);
assertEquals(1, studyQueryResult.getNumResults());
=======
assertEquals(9, catalogManager.getSampleManager().count(String.valueOf(studyId), new Query(), token).getNumTotalResults());
>>>>>>>
assertEquals(9, catalogManager.getSampleManager().count(studyFqn, new Query(), token).getNumTotalResults());
<<<<<<<
thrown.expect(CatalogAuthorizationException.class);
catalogManager.getStudyManager().get(String.valueOf((Long) studyUid), QueryOptions.empty(), token);
=======
assertEquals(0, catalogManager.getSampleManager().count(String.valueOf(studyId), new Query(), token).getNumTotalResults());
>>>>>>>
assertEquals(0, catalogManager.getSampleManager().count(studyFqn, new Query(), token).getNumTotalResults());
<<<<<<<
public void testAssignPermissions() throws CatalogException, IOException {
catalogManager.getUserManager().create("test", "test", "[email protected]", "test", null, 100L, "guest", null, null);
=======
public void testAssignPermissions() throws CatalogException {
catalogManager.getUserManager().create("test", "test", "[email protected]", "test", null, 100L, "guest", null);
>>>>>>>
public void testAssignPermissions() throws CatalogException {
catalogManager.getUserManager().create("test", "test", "[email protected]", "test", null, 100L, "guest", null, null); |
<<<<<<<
BeanPropertyDefinition propDef = candidate.propertyDef(0);
boolean useProps = _checkIfCreatorPropertyBased(ctxt, ctor, propDef);
=======
final BeanPropertyDefinition propDef = candidate.propertyDef(0);
final boolean useProps = preferPropsBased || _checkIfCreatorPropertyBased(intr, ctor, propDef);
>>>>>>>
final BeanPropertyDefinition propDef = candidate.propertyDef(0);
final boolean useProps = preferPropsBased || _checkIfCreatorPropertyBased(ctxt, ctor, propDef); |
<<<<<<<
=======
import org.opencb.biodata.models.variant.avro.VariantAnnotation;
import org.opencb.biodata.models.variant.avro.VariantType;
>>>>>>>
<<<<<<<
variant.getStudy(STUDY_NAME).getAttributes().remove("src");
Variant loadedVariant = dbAdaptor.get(new Query(VariantDBAdaptor.VariantQueryParams.REGION.key(), variant.getChromosome() +
":" + variant.getStart() + "-" + variant.getEnd()), new QueryOptions()).first();
=======
if (variant.getAlternate().startsWith("<") || variant.getStart().equals(70146475) || variant.getStart().equals(107976940)) {
continue;
}
StudyEntry studyEntry = variant.getStudies().get(0);
studyEntry.setStudyId(STUDY_NAME);
variant.setStudies(Collections.singletonList(studyEntry));
studyEntry.getAttributes().remove("src");
List<List<String>> samplesData = studyEntry.getSamplesData();
//Remove PL
for (int sampleIdx = 0; sampleIdx < samplesData.size(); sampleIdx++) {
List<String> data = samplesData.get(sampleIdx);
List<String> newData = new ArrayList<>(3);
for (int i = 0; i < data.size(); i++) {
if (studyEntry.getFormat().get(i).endsWith("PL")) {
continue;
}
try {
String value = data.get(i);
newData.add(((Double) Double.parseDouble(value)).toString());
} catch (NumberFormatException ignore) {
newData.add(data.get(i));
}
}
samplesData.set(sampleIdx, newData);
}
studyEntry.setFormat(Arrays.asList("GT", "GL", "DS"));
Variant loadedVariant = dbAdaptor.get(new Query(VariantDBAdaptor.VariantQueryParams.REGION.key(), variant.getChromosome() + ":" + variant.getStart() + "-" + variant.getEnd()), new QueryOptions()).first();
>>>>>>>
if (variant.getAlternate().startsWith("<") || variant.getStart().equals(70146475) || variant.getStart().equals(107976940)) {
continue;
}
StudyEntry studyEntry = variant.getStudies().get(0);
studyEntry.setStudyId(STUDY_NAME);
variant.setStudies(Collections.singletonList(studyEntry));
Variant loadedVariant = dbAdaptor.get(new Query(VariantDBAdaptor.VariantQueryParams.REGION.key(),
variant.getChromosome() + ":" + variant.getStart() + "-" + variant.getEnd()), new QueryOptions()).first();
<<<<<<<
while (values.get(1).length() < 5) values.set(1, values.get(1) + "0"); //Set lost zeros
=======
>>>>>>>
while (values.get(2).length() < 5) values.set(2, values.get(2) + "0"); //Set lost zeros |
<<<<<<<
Map missingSamples = Collections.emptyMap();
String defaultGenotype = studyConfiguration.getAttributes().getString(MongoDBVariantStorageManager.DEFAULT_GENOTYPE, "");
if (defaultGenotype.equals(DBObjectToSamplesConverter.UNKNOWN_GENOTYPE)) {
logger.debug("Do not need fill gaps. DefaultGenotype is UNKNOWN_GENOTYPE({}).", DBObjectToSamplesConverter.UNKNOWN_GENOTYPE);
} else if (excludeGenotypes) {
logger.debug("Do not need fill gaps. Excluding genotypes.");
} else if (!loadedSampleIds.isEmpty()) {
missingSamples = new BasicDBObject(DBObjectToSamplesConverter.UNKNOWN_GENOTYPE, loadedSampleIds); // ?/?
}
=======
long nanoTime = System.nanoTime();
{
Map missingSamples = Collections.emptyMap();
String defaultGenotype = studyConfiguration.getAttributes().getString(MongoDBVariantStorageManager.DEFAULT_GENOTYPE, "");
if (defaultGenotype.equals(DBObjectToSamplesConverter.UNKNOWN_GENOTYPE)) {
logger.debug("Do not need fill gaps. DefaultGenotype is UNKNOWN_GENOTYPE({}).", DBObjectToSamplesConverter.UNKNOWN_GENOTYPE);
} else if (excludeGenotypes) {
logger.debug("Do not need fill gaps. Excluding genotypes.");
} else if (!loadedSampleIds.isEmpty()) {
missingSamples = new BasicDBObject(DBObjectToSamplesConverter.UNKNOWN_GENOTYPE, loadedSampleIds); // ?/?
}
>>>>>>>
long nanoTime = System.nanoTime();
Map missingSamples = Collections.emptyMap();
String defaultGenotype = studyConfiguration.getAttributes().getString(MongoDBVariantStorageManager.DEFAULT_GENOTYPE, "");
if (defaultGenotype.equals(DBObjectToSamplesConverter.UNKNOWN_GENOTYPE)) {
logger.debug("Do not need fill gaps. DefaultGenotype is UNKNOWN_GENOTYPE({}).", DBObjectToSamplesConverter.UNKNOWN_GENOTYPE);
} else if (excludeGenotypes) {
logger.debug("Do not need fill gaps. Excluding genotypes.");
} else if (!loadedSampleIds.isEmpty()) {
missingSamples = new BasicDBObject(DBObjectToSamplesConverter.UNKNOWN_GENOTYPE, loadedSampleIds); // ?/?
}
<<<<<<<
// }
=======
writeResult.setNewVariantsNanoTime(System.nanoTime() - nanoTime);
nanoTime = System.nanoTime();
>>>>>>>
writeResult.setNewVariantsNanoTime(System.nanoTime() - nanoTime);
nanoTime = System.nanoTime(); |
<<<<<<<
import org.apache.phoenix.schema.types.PInteger;
=======
import org.apache.phoenix.schema.types.PhoenixArray;
>>>>>>>
import org.apache.phoenix.schema.types.PInteger;
import org.apache.phoenix.schema.types.PhoenixArray;
<<<<<<<
=======
import org.opencb.opencga.storage.hadoop.variant.converters.AbstractPhoenixConverter;
import org.opencb.opencga.storage.hadoop.variant.index.phoenix.PhoenixHelper;
>>>>>>>
import org.opencb.opencga.storage.hadoop.variant.converters.AbstractPhoenixConverter;
<<<<<<<
import java.util.stream.Collectors;
=======
import java.util.stream.Collectors;
import static org.opencb.opencga.storage.core.variant.adaptors.VariantField.AdditionalAttributes.GROUP_NAME;
>>>>>>>
import java.util.stream.Collectors;
import static org.opencb.opencga.storage.core.variant.adaptors.VariantField.AdditionalAttributes.GROUP_NAME;
<<<<<<<
byte[] value = result.getValue(columnFamily, annotationColumn);
=======
byte[] value = result.getValue(columnFamily, VariantColumn.FULL_ANNOTATION.bytes());
>>>>>>>
byte[] value = result.getValue(columnFamily, annotationColumn);
<<<<<<<
Integer column = findColumn(resultSet, annotationColumnStr);
=======
Integer column = findColumn(resultSet, VariantColumn.FULL_ANNOTATION);
>>>>>>>
Integer column = findColumn(resultSet, annotationColumnStr);
<<<<<<<
String annotationId = this.defaultAnnotationId;
if (defaultAnnotationId == null) {
try {
int annotationIdNum = resultSet.getInt(VariantPhoenixHelper.VariantColumn.ANNOTATION_ID.column());
annotationId = annotationIds.get(annotationIdNum);
} catch (SQLException e) {
throw VariantQueryException.internalException(e);
}
}
return post(variantAnnotation, releases, annotationId);
=======
return post(variantAnnotation, releases, syncStatus, studies);
>>>>>>>
String annotationId = this.defaultAnnotationId;
if (defaultAnnotationId == null) {
try {
int annotationIdNum = resultSet.getInt(VariantPhoenixHelper.VariantColumn.ANNOTATION_ID.column());
annotationId = annotationIds.get(annotationIdNum);
} catch (SQLException e) {
throw VariantQueryException.internalException(e);
}
}
return post(variantAnnotation, releases, syncStatus, studies, annotationId);
<<<<<<<
private VariantAnnotation post(VariantAnnotation variantAnnotation, List<Integer> releases, String annotationId) {
=======
private VariantAnnotation post(VariantAnnotation variantAnnotation, List<Integer> releases, VariantSearchManager.SyncStatus syncStatus,
List<Integer> studies) {
boolean hasRelease = releases != null && !releases.isEmpty();
boolean hasIndex = syncStatus != null || studies != null;
>>>>>>>
private VariantAnnotation post(VariantAnnotation variantAnnotation, List<Integer> releases, VariantSearchManager.SyncStatus syncStatus,
List<Integer> studies, String annotationId) {
boolean hasRelease = releases != null && !releases.isEmpty();
boolean hasIndex = syncStatus != null || studies != null;
boolean hasAnnotationId = StringUtils.isNotEmpty(annotationId); |
<<<<<<<
public Cohort(String name, Study.Type type, String creationDate, String description, List<Sample> samples,
=======
public Cohort(String name, Study.Type type, String creationDate, String description, List<Long> samples, int release,
>>>>>>>
public Cohort(String name, Study.Type type, String creationDate, String description, List<Sample> samples, int release,
<<<<<<<
public Cohort(String name, Study.Type type, String creationDate, String description, List<Sample> samples,
List<AnnotationSet> annotationSetList, Map<String, Object> attributes) {
=======
public Cohort(String name, Study.Type type, String creationDate, String description, List<Long> samples,
List<AnnotationSet> annotationSetList, int release, Map<String, Object> attributes) {
>>>>>>>
public Cohort(String name, Study.Type type, String creationDate, String description, List<Sample> samples,
List<AnnotationSet> annotationSetList, int release, Map<String, Object> attributes) {
<<<<<<<
public Cohort(long id, String name, Study.Type type, String creationDate, CohortStatus status, String description,
List<Sample> samples, Family family, List<CohortAclEntry> acl, List<AnnotationSet> annotationSets,
Map<String, Object> stats, Map<String, Object> attributes) {
=======
public Cohort(long id, String name, Study.Type type, String creationDate, CohortStatus status, String description, List<Long> samples,
Family family, List<CohortAclEntry> acl, List<AnnotationSet> annotationSets, Map<String, Object> stats, int release,
Map<String, Object> attributes) {
>>>>>>>
public Cohort(long id, String name, Study.Type type, String creationDate, CohortStatus status, String description,
List<Sample> samples, Family family, List<CohortAclEntry> acl, List<AnnotationSet> annotationSets,
Map<String, Object> stats, int release, Map<String, Object> attributes) {
<<<<<<<
=======
public int getRelease() {
return release;
}
public Cohort setRelease(int release) {
this.release = release;
return this;
}
// @Override
// public List<AnnotationSet> getAnnotationSets() {
// return annotationSets;
// }
//
// @Override
// public Cohort setAnnotationSets(List<AnnotationSet> annotationSets) {
// this.annotationSets = annotationSets;
// return this;
// }
>>>>>>>
public int getRelease() {
return release;
}
public Cohort setRelease(int release) {
this.release = release;
return this;
} |
<<<<<<<
final Long fileId = fileIdStr == null ? null : catalogManager.getFileId(fileIdStr, Long.toString(studyId), sessionId);
=======
boolean resume = options.getBoolean(Options.RESUME.key(), Options.RESUME.defaultValue());
final Long fileId = fileIdStr == null ? null : catalogManager.getFileId(fileIdStr, sessionId);
>>>>>>>
boolean resume = options.getBoolean(Options.RESUME.key(), Options.RESUME.defaultValue());
final Long fileId = fileIdStr == null ? null : catalogManager.getFileId(fileIdStr, Long.toString(studyId), sessionId); |
<<<<<<<
import org.opencb.biodata.models.variant.Variant;
=======
import org.opencb.biodata.models.variant.VariantSource;
>>>>>>>
import org.opencb.biodata.models.variant.Variant;
import org.opencb.biodata.models.variant.VariantSource; |
<<<<<<<
=======
// [databind#28]: ObjectMapper.copy()
public void testCopy() throws Exception
{
ObjectMapper m = new ObjectMapper();
assertTrue(m.isEnabled(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES));
m.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
assertFalse(m.isEnabled(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES));
InjectableValues inj = new InjectableValues.Std();
m.setInjectableValues(inj);
assertFalse(m.isEnabled(JsonParser.Feature.IGNORE_UNDEFINED));
m.enable(JsonParser.Feature.IGNORE_UNDEFINED);
assertTrue(m.isEnabled(JsonParser.Feature.IGNORE_UNDEFINED));
// // First: verify that handling of features is decoupled:
ObjectMapper m2 = m.copy();
assertFalse(m2.isEnabled(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES));
m2.enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
assertTrue(m2.isEnabled(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES));
assertSame(inj, m2.getInjectableValues());
// but should NOT change the original
assertFalse(m.isEnabled(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES));
// nor vice versa:
assertFalse(m.isEnabled(DeserializationFeature.UNWRAP_ROOT_VALUE));
assertFalse(m2.isEnabled(DeserializationFeature.UNWRAP_ROOT_VALUE));
m.enable(DeserializationFeature.UNWRAP_ROOT_VALUE);
assertTrue(m.isEnabled(DeserializationFeature.UNWRAP_ROOT_VALUE));
assertFalse(m2.isEnabled(DeserializationFeature.UNWRAP_ROOT_VALUE));
// // Also, underlying JsonFactory instances should be distinct
assertNotSame(m.getFactory(), m2.getFactory());
// [databind#2755]: also need to copy this:
assertNotSame(m.getSubtypeResolver(), m2.getSubtypeResolver());
// [databind#122]: Need to ensure mix-ins are not shared
assertEquals(0, m.getSerializationConfig().mixInCount());
assertEquals(0, m2.getSerializationConfig().mixInCount());
assertEquals(0, m.getDeserializationConfig().mixInCount());
assertEquals(0, m2.getDeserializationConfig().mixInCount());
m.addMixIn(String.class, Integer.class);
assertEquals(1, m.getSerializationConfig().mixInCount());
assertEquals(0, m2.getSerializationConfig().mixInCount());
assertEquals(1, m.getDeserializationConfig().mixInCount());
assertEquals(0, m2.getDeserializationConfig().mixInCount());
// [databind#913]: Ensure JsonFactory Features copied
assertTrue(m2.isEnabled(JsonParser.Feature.IGNORE_UNDEFINED));
}
>>>>>>>
<<<<<<<
m = jsonMapperBuilder()
.changeDefaultPropertyInclusion(incl -> incl.withValueInclusion(JsonInclude.Include.NON_DEFAULT))
.changeDefaultVisibility(vc -> customVis)
.changeDefaultNullHandling(n -> n.withValueNulls(Nulls.SKIP))
.defaultMergeable(Boolean.TRUE)
.build();
=======
m.setVisibility(customVis);
assertSame(customVis, m.getVisibilityChecker());
// and verify that copy retains these settings
ObjectMapper m2 = m.copy();
SerializationConfig config2 = m2.getSerializationConfig();
assertSame(customIncl, config2.getDefaultPropertyInclusion());
assertSame(customSetter, config2.getDefaultSetterInfo());
assertEquals(Boolean.TRUE, config2.getDefaultMergeable());
assertSame(customVis, config2.getDefaultVisibilityChecker());
}
// [databind#2785]
public void testCopyOfSubtypeResolver2785() throws Exception {
ObjectMapper objectMapper = new ObjectMapper().copy();
objectMapper.registerSubtypes(Impl2785.class);
Object result = objectMapper.readValue("{ \"packetType\": \"myType\" }", Base2785.class);
assertNotNull(result);
}
public void testFailedCopy() throws Exception
{
NoCopyMapper src = new NoCopyMapper();
try {
src.copy();
fail("Should not pass");
} catch (IllegalStateException e) {
verifyException(e, "does not override copy()");
}
}
public void testAnnotationIntrospectorCopying()
{
ObjectMapper m = new ObjectMapper();
m.setAnnotationIntrospector(new MyAnnotationIntrospector());
assertEquals(MyAnnotationIntrospector.class,
m.getDeserializationConfig().getAnnotationIntrospector().getClass());
ObjectMapper m2 = m.copy();
assertEquals(MyAnnotationIntrospector.class,
m2.getDeserializationConfig().getAnnotationIntrospector().getClass());
assertEquals(MyAnnotationIntrospector.class,
m2.getSerializationConfig().getAnnotationIntrospector().getClass());
>>>>>>>
m = jsonMapperBuilder()
.changeDefaultPropertyInclusion(incl -> incl.withValueInclusion(JsonInclude.Include.NON_DEFAULT))
.changeDefaultVisibility(vc -> customVis)
.changeDefaultNullHandling(n -> n.withValueNulls(Nulls.SKIP))
.defaultMergeable(Boolean.TRUE)
.build();
<<<<<<<
=======
// For [databind#703], [databind#978]
public void testNonSerializabilityOfObject()
{
ObjectMapper m = new ObjectMapper();
assertFalse(m.canSerialize(Object.class));
// but this used to pass, incorrectly, second time around
assertFalse(m.canSerialize(Object.class));
// [databind#978]: Different answer if empty Beans ARE allowed
m = new ObjectMapper();
m.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
assertTrue(m.canSerialize(Object.class));
assertTrue(MAPPER.writer().without(SerializationFeature.FAIL_ON_EMPTY_BEANS)
.canSerialize(Object.class));
assertFalse(MAPPER.writer().with(SerializationFeature.FAIL_ON_EMPTY_BEANS)
.canSerialize(Object.class));
}
// for [databind#756]
public void testEmptyBeanSerializability()
{
// with default settings, error
assertFalse(MAPPER.writer().with(SerializationFeature.FAIL_ON_EMPTY_BEANS)
.canSerialize(EmptyBean.class));
// but with changes
assertTrue(MAPPER.writer().without(SerializationFeature.FAIL_ON_EMPTY_BEANS)
.canSerialize(EmptyBean.class));
}
// for [databind#2749]: just to check there's no NPE; method really not useful
public void testCanDeserialize()
{
assertTrue(MAPPER.canDeserialize(MAPPER.constructType(EmptyBean.class)));
assertTrue(MAPPER.canDeserialize(MAPPER.constructType(Object.class)));
}
>>>>>>> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.